From aeffbc3d21e4c58368ee1ccf7caee2b8af7a3c80 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Tue, 2 Dec 2025 14:28:35 -0500 Subject: [PATCH 01/32] feat: Migrate site, api, database, runtime, server packages to OSS - Copy database, runtime, api, site, server packages from blink.so - Replace MIT LICENSE with AGPL-3.0 from coder/coder - Remove billing pages from site - Stub out compute-protocol-worker and billing dependencies - Remove ai-gateway tests (billing-dependent) - Update root package.json with new workspaces and scripts - Update CI workflow to build new packages - Add prettier-plugin-organize-imports - Copy root files: bunfig.toml, .env.example, AGENTS.md, scripts/db.ts --- .github/workflows/ci.yml | 6 +- .gitignore | 1 + .prettierrc.json | 3 +- AGENTS.md | 166 + LICENSE | 681 +++- bun.lock | 2002 +++++++++- bunfig.toml | 7 + package.json | 32 +- packages/api/.gitignore | 2 + packages/api/package.json | 55 + packages/api/package.public.json | 41 + packages/api/scripts/no-server-imports.ts | 168 + packages/api/src/client-helper.test.ts | 60 + packages/api/src/client-helper.ts | 120 + packages/api/src/client.browser.ts | 105 + packages/api/src/client.node.ts | 19 + packages/api/src/constants.ts | 15 + packages/api/src/middleware.test.ts | 684 ++++ packages/api/src/middleware.ts | 457 +++ packages/api/src/react/index.ts | 1 + packages/api/src/react/use-chat.test.tsx | 456 +++ packages/api/src/react/use-chat.ts | 638 +++ .../api/src/routes/agent-request.server.ts | 352 ++ packages/api/src/routes/agent-request.test.ts | 61 + .../api/src/routes/agents/agents.client.ts | 359 ++ .../api/src/routes/agents/agents.server.ts | 487 +++ packages/api/src/routes/agents/agents.test.ts | 353 ++ .../src/routes/agents/deployments.client.ts | 259 ++ .../src/routes/agents/deployments.server.ts | 293 ++ .../api/src/routes/agents/deployments.test.ts | 268 ++ packages/api/src/routes/agents/env.client.ts | 144 + packages/api/src/routes/agents/env.server.ts | 206 + packages/api/src/routes/agents/env.test.ts | 94 + packages/api/src/routes/agents/logs.client.ts | 72 + packages/api/src/routes/agents/logs.server.ts | 36 + packages/api/src/routes/agents/logs.test.ts | 342 ++ .../api/src/routes/agents/me/me.client.ts | 281 ++ .../api/src/routes/agents/me/me.server.ts | 370 ++ packages/api/src/routes/agents/me/me.test.ts | 229 ++ .../api/src/routes/agents/members.client.ts | 144 + .../api/src/routes/agents/members.server.ts | 139 + packages/api/src/routes/agents/runs.client.ts | 76 + packages/api/src/routes/agents/runs.server.ts | 107 + packages/api/src/routes/agents/runs.test.ts | 226 ++ .../api/src/routes/agents/steps.client.ts | 84 + .../api/src/routes/agents/steps.server.ts | 198 + packages/api/src/routes/agents/steps.test.ts | 146 + .../api/src/routes/agents/traces.client.ts | 64 + .../api/src/routes/agents/traces.server.ts | 35 + packages/api/src/routes/agents/traces.test.ts | 487 +++ packages/api/src/routes/ai-gateway.server.ts | 590 +++ .../api/src/routes/ai-gateway.test-data.ts | 501 +++ packages/api/src/routes/api-keys.server.ts | 159 + packages/api/src/routes/api-keys.test.ts | 52 + packages/api/src/routes/auth/auth.client.ts | 343 ++ .../api/src/routes/auth/auth.server.test.ts | 1034 +++++ packages/api/src/routes/auth/auth.server.ts | 1220 ++++++ packages/api/src/routes/auth/auth.test.ts | 30 + packages/api/src/routes/chats/chats.client.ts | 416 ++ packages/api/src/routes/chats/chats.server.ts | 374 ++ packages/api/src/routes/chats/chats.test.ts | 439 ++ packages/api/src/routes/chats/runs.client.ts | 71 + packages/api/src/routes/chats/runs.server.ts | 48 + packages/api/src/routes/chats/runs.test.ts | 117 + packages/api/src/routes/chats/steps.client.ts | 113 + packages/api/src/routes/chats/steps.server.ts | 124 + packages/api/src/routes/chats/steps.test.ts | 68 + packages/api/src/routes/devhook.client.ts | 158 + packages/api/src/routes/devhook.server.ts | 21 + packages/api/src/routes/devhook.test.ts | 44 + packages/api/src/routes/files.client.ts | 29 + packages/api/src/routes/files.server.ts | 50 + packages/api/src/routes/files.test.ts | 14 + packages/api/src/routes/invites.client.ts | 141 + packages/api/src/routes/invites.server.ts | 233 ++ packages/api/src/routes/invites.test.ts | 104 + packages/api/src/routes/messages.client.ts | 194 + packages/api/src/routes/messages.server.ts | 441 +++ packages/api/src/routes/messages.test.ts | 252 ++ .../src/routes/organizations/agents.client.ts | 31 + .../src/routes/organizations/agents.server.ts | 28 + .../src/routes/organizations/agents.test.ts | 31 + .../routes/organizations/members.client.ts | 156 + .../routes/organizations/members.server.ts | 171 + .../src/routes/organizations/members.test.ts | 158 + .../organizations/organizations.client.ts | 129 + .../organizations/organizations.server.ts | 175 + .../organizations/organizations.test.ts | 68 + packages/api/src/routes/otlp/README.md | 1 + packages/api/src/routes/otlp/buf.gen.yaml | 10 + packages/api/src/routes/otlp/convert.test.ts | 1172 ++++++ packages/api/src/routes/otlp/convert.ts | 497 +++ .../collector/logs/v1/logs_service_pb.ts | 158 + .../metrics/v1/metrics_service_pb.ts | 158 + .../v1development/profiles_service_pb.ts | 179 + .../collector/trace/v1/trace_service_pb.ts | 158 + .../proto/common/v1/common_pb.ts | 289 ++ .../opentelemetry/proto/logs/v1/logs_pb.ts | 490 +++ .../proto/metrics/v1/metrics_pb.ts | 1326 +++++++ .../profiles/v1development/profiles_pb.ts | 897 +++++ .../proto/resource/v1/resource_pb.ts | 86 + .../opentelemetry/proto/trace/v1/trace_pb.ts | 707 ++++ packages/api/src/routes/otlp/otlp.server.ts | 27 + packages/api/src/routes/otlp/otlp.test.ts | 343 ++ .../api/src/routes/tools/compute.client.ts | 47 + .../api/src/routes/tools/compute.server.ts | 66 + packages/api/src/routes/tools/exa.server.ts | 62 + packages/api/src/routes/tools/exa.test.ts | 164 + .../api/src/routes/tools/tools.client.node.ts | 12 + packages/api/src/routes/tools/tools.server.ts | 23 + packages/api/src/routes/users.client.ts | 197 + packages/api/src/routes/users.server.ts | 282 ++ packages/api/src/routes/users.test.ts | 719 ++++ packages/api/src/server-helper.ts | 53 + packages/api/src/server.test.ts | 14 + packages/api/src/server.ts | 356 ++ packages/api/src/test.ts | 285 ++ .../api/src/util/async-iterable-stream.ts | 95 + packages/api/src/util/chat.ts | 606 +++ packages/api/tsconfig.json | 20 + packages/api/tsconfig.tsbuildinfo | 1 + packages/api/tsdown.config.ts | 53 + packages/billing/package.json | 18 + packages/billing/src/ingest-usage-event.ts | 20 + packages/billing/src/metronome.ts | 4 + packages/billing/src/money.ts | 22 + packages/blink/src/agent/agent.test.ts | 8 +- packages/blink/src/agent/client/index.ts | 3 +- packages/blink/src/agent/index.browser.ts | 2 +- .../convert-response-to-ui-message-stream.ts | 2 +- packages/blink/src/build/esbuild.ts | 5 +- packages/blink/src/build/index.ts | 4 +- .../src/build/plugins/ai-telemetry.test.ts | 8 +- .../blink/src/build/plugins/ai-telemetry.ts | 6 +- packages/blink/src/build/util.ts | 2 +- packages/blink/src/cli/chat.ts | 1 - packages/blink/src/cli/compute-server.test.ts | 4 +- packages/blink/src/cli/deploy.ts | 27 +- packages/blink/src/cli/dev.ts | 1 - packages/blink/src/cli/index.ts | 2 +- packages/blink/src/cli/init.test.ts | 14 +- packages/blink/src/cli/init.ts | 6 +- packages/blink/src/cli/lib/auth.ts | 5 +- packages/blink/src/cli/lib/devhook.ts | 4 +- packages/blink/src/cli/lib/first-run.ts | 2 +- packages/blink/src/cli/lib/migrate.ts | 6 +- packages/blink/src/cli/lib/templates.ts | 3 +- packages/blink/src/cli/lib/terminal.test.ts | 5 +- packages/blink/src/cli/lib/terminal.ts | 6 +- packages/blink/src/cli/lib/util.ts | 2 +- packages/blink/src/cli/run.ts | 14 +- .../cli/scripts/generate-templates.test.ts | 4 +- .../src/cli/scripts/generate-templates.ts | 4 +- packages/blink/src/cli/setup-slack-app.ts | 11 +- packages/blink/src/edit/agent.ts | 7 +- .../blink/src/edit/tools/create-github-app.ts | 4 +- packages/blink/src/edit/tsserver.test.ts | 2 +- packages/blink/src/local/chat-manager.test.ts | 6 +- packages/blink/src/local/chat-manager.ts | 9 +- packages/blink/src/local/disk-store.ts | 2 +- packages/blink/src/local/run-agent.test.ts | 2 +- packages/blink/src/local/server.ts | 5 +- packages/blink/src/react/index.browser.ts | 2 +- packages/blink/src/react/index.node.ts | 2 +- packages/blink/src/react/use-agent.ts | 4 +- packages/blink/src/react/use-auth.ts | 4 +- packages/blink/src/react/use-chat.ts | 3 +- packages/blink/src/react/use-dev-mode.ts | 22 +- packages/blink/src/react/use-devhook.ts | 7 +- packages/blink/src/react/use-options.test.tsx | 4 +- packages/blink/src/react/use-options.tsx | 4 +- .../blink/src/tui/components/markdown.tsx | 2 +- .../blink/src/tui/components/text-input.tsx | 12 +- packages/blink/src/tui/dev.tsx | 28 +- packages/blink/tsdown.config.ts | 4 +- packages/compute-protocol/src/client.test.ts | 2 +- .../compute-protocol/src/process-manager.ts | 2 +- packages/compute-protocol/src/server.ts | 6 +- packages/compute-protocol/src/tar.ts | 4 +- packages/compute/src/index.ts | 12 +- packages/database/bun.lock | 180 + packages/database/drizzle.config.ts | 17 + packages/database/dump_schema.ts | 61 + packages/database/migrate.ts | 37 + packages/database/migrations/0000_initial.sql | 437 ++ .../migrations/meta/0000_snapshot.json | 3257 +++++++++++++++ .../database/migrations/meta/_journal.json | 13 + packages/database/package.json | 28 + packages/database/reset.sh | 5 + packages/database/scripts/dump_full_schema.ts | 278 ++ .../database/src/agent-permissions.test.ts | 547 +++ packages/database/src/convert.ts | 150 + packages/database/src/encryption.test.ts | 182 + packages/database/src/encryption.ts | 161 + packages/database/src/knock-service.ts | 583 +++ .../database/src/observability/filters.ts | 68 + .../database/src/observability/logs.test.ts | 138 + packages/database/src/observability/logs.ts | 127 + packages/database/src/observability/traces.ts | 106 + packages/database/src/postgres-worker.ts | 602 +++ packages/database/src/postgres.test.ts | 38 + packages/database/src/postgres.ts | 45 + packages/database/src/querier.test.ts | 448 +++ packages/database/src/querier.ts | 3521 +++++++++++++++++ packages/database/src/schema.ts | 1041 +++++ packages/database/src/shared.ts | 71 + packages/database/src/test.ts | 338 ++ packages/database/src/usage-queries.test.ts | 654 +++ packages/database/tsconfig.json | 29 + packages/database/tsconfig.tsbuildinfo | 1 + packages/desktop/src/agent.tsx | 9 +- packages/desktop/src/app.tsx | 16 +- packages/desktop/src/components/AgentView.tsx | 44 +- .../desktop/src/components/MessageBubble.tsx | 4 +- .../desktop/src/components/SourceBrowser.tsx | 6 +- packages/desktop/src/components/ui/alert.tsx | 4 +- packages/desktop/src/components/ui/button.tsx | 2 +- packages/desktop/src/components/ui/card.tsx | 6 +- packages/desktop/src/components/ui/dialog.tsx | 1 - packages/desktop/src/components/ui/switch.tsx | 2 - .../desktop/src/components/ui/tooltip.tsx | 2 +- .../desktop/src/contexts/ThemeContext.tsx | 4 +- packages/desktop/src/file-viewer.tsx | 4 +- packages/desktop/src/hooks/index.ts | 2 +- packages/desktop/src/hooks/useAuth.ts | 4 +- packages/desktop/src/main.ts | 6 +- packages/desktop/src/renderer.tsx | 6 +- packages/model-intent/src/index.test.ts | 6 +- packages/multiplexer/src/multiplexer.test.ts | 6 +- packages/runtime/package.json | 16 + packages/runtime/scripts/generate.ts | 49 + .../lambda/fixtures/client-using-storage.ts | 32 + packages/runtime/src/lambda/runtime-lambda.ts | 341 ++ .../src/lambda/wrapper-lambda.generated.ts | 4 + .../runtime/src/lambda/wrapper-lambda.test.ts | 194 + packages/runtime/src/lambda/wrapper-lambda.ts | 221 ++ .../src/node/wrapper-node.generated.ts | 4 + packages/runtime/src/node/wrapper-node.ts | 27 + packages/runtime/src/server.ts | 173 + packages/runtime/src/types.ts | 13 + .../lib/compute/daytona/index.test.ts | 8 +- packages/scout-agent/lib/compute/docker.ts | 2 +- packages/scout-agent/lib/core.test.ts | 2 +- packages/scout-agent/lib/core.ts | 2 +- packages/scout-agent/lib/github.test.ts | 14 +- packages/scout-agent/lib/test-helpers.ts | 2 +- packages/server/.gitignore | 5 + packages/server/README.md | 1 + packages/server/package.json | 43 + packages/server/scripts/build.ts | 91 + packages/server/src/agent-deployment.ts | 236 ++ packages/server/src/chat.ts | 278 ++ packages/server/src/cli.ts | 78 + packages/server/src/logger.ts | 29 + packages/server/src/postgres.ts | 225 ++ packages/server/src/server.ts | 474 +++ packages/server/tsconfig.json | 10 + packages/server/tsdown.config.ts | 103 + packages/site/.gitignore | 1 + packages/site/.storybook/main.ts | 93 + packages/site/.storybook/preview.tsx | 46 + packages/site/.storybook/utils.tsx | 176 + packages/site/README.md | 15 + .../[agent]/access/add-member-modal.tsx | 203 + .../[agent]/access/agent-access-client.tsx | 142 + .../[agent]/access/members-table.tsx | 240 ++ .../[organization]/[agent]/access/page.tsx | 65 + .../[agent]/access/permissions-reference.tsx | 178 + .../[agent]/access/visibility-section.tsx | 184 + .../[agent]/chats/[[...id]]/page.tsx | 75 + .../[agent]/components/agent-daily-chats.tsx | 75 + .../[agent]/components/agent-logs.stories.tsx | 618 +++ .../[agent]/components/agent-logs.tsx | 503 +++ .../[agent]/components/agent-source.tsx | 511 +++ .../[agent]/components/date-range-filter.tsx | 282 ++ .../log-details-sidebar.stories.tsx | 305 ++ .../components/log-details-sidebar.tsx | 374 ++ .../[agent]/deployments/[number]/page.tsx | 53 + .../[agent]/deployments/[number]/view.tsx | 328 ++ .../[agent]/deployments/list.tsx | 442 +++ .../[agent]/deployments/page.tsx | 55 + .../[organization]/[agent]/develop/page.tsx | 26 + .../(app)/[organization]/[agent]/layout.tsx | 50 + .../[organization]/[agent]/logs/page.tsx | 94 + .../[organization]/[agent]/navigation.tsx | 106 + .../[organization]/[agent]/page.stories.tsx | 87 + .../app/(app)/[organization]/[agent]/page.tsx | 169 + .../[agent]/settings/agent-avatar-form.tsx | 142 + .../[agent]/settings/agent-delete-form.tsx | 99 + .../[agent]/settings/env/env-manager.tsx | 629 +++ .../[agent]/settings/env/page.tsx | 33 + .../[organization]/[agent]/settings/form.tsx | 157 + .../[agent]/settings/layout.tsx | 15 + .../[agent]/settings/navigation.tsx | 36 + .../[organization]/[agent]/settings/page.tsx | 58 + .../[agent]/settings/webhooks/page.tsx | 53 + .../settings/webhooks/webhooks-section.tsx | 128 + .../[organization]/[agent]/source/page.tsx | 45 + .../[organization]/[agent]/source/view.tsx | 71 + .../[agent]/traces/list.stories.tsx | 1228 ++++++ .../[organization]/[agent]/traces/list.tsx | 496 +++ .../[organization]/[agent]/traces/page.tsx | 85 + .../traces/span-details-sidebar.stories.tsx | 568 +++ .../[agent]/traces/span-details-sidebar.tsx | 456 +++ .../[agent]/traces/status-badges.tsx | 39 + .../traces/trace-filters-panel.stories.tsx | 189 + .../[agent]/traces/trace-filters-panel.tsx | 240 ++ .../traces/trace-tree-view.stories.tsx | 438 ++ .../[agent]/traces/trace-tree-view.tsx | 650 +++ .../[organization]/[agent]/traces/utils.ts | 34 + .../[agent]/usage/agent-usage.tsx | 614 +++ .../[organization]/[agent]/usage/page.tsx | 126 + .../[agent]/usage/time-range-selector.tsx | 40 + .../site/app/(app)/[organization]/layout.tsx | 114 + .../app/(app)/[organization]/navigation.tsx | 44 + .../app/(app)/[organization]/page.stories.tsx | 95 + .../site/app/(app)/[organization]/page.tsx | 299 ++ .../~/people/invite-link-modal.tsx | 278 ++ .../~/people/invite-member-modal.tsx | 164 + .../~/people/member-actions-dropdown.tsx | 404 ++ .../[organization]/~/people/members-table.tsx | 190 + .../organization-permissions-reference.tsx | 241 ++ .../(app)/[organization]/~/people/page.tsx | 56 + .../~/people/pending-invites-table.tsx | 78 + .../[organization]/~/people/people-page.tsx | 158 + .../[organization]/~/people/role-dropdown.tsx | 93 + .../(app)/[organization]/~/people/utils.ts | 29 + .../~/settings/api-keys/api-keys-manager.tsx | 199 + .../api-keys/create-api-key-modal.tsx | 155 + .../~/settings/api-keys/page.tsx | 22 + .../[organization]/~/settings/layout.tsx | 44 + .../[organization]/~/settings/navigation.tsx | 67 + .../~/settings/organization-avatar-form.tsx | 394 ++ .../~/settings/organization-delete-form.tsx | 142 + .../~/settings/organization-id-section.tsx | 50 + .../~/settings/organization-profile-form.tsx | 104 + .../(app)/[organization]/~/settings/page.tsx | 93 + .../~/settings/user-authentication-client.tsx | 209 + .../~/settings/user-authentication.tsx | 46 + .../~/settings/user-avatar-form.tsx | 149 + .../~/settings/user-delete-form.tsx | 133 + .../~/settings/user-email-form.tsx | 224 ++ .../~/settings/user-id-section.tsx | 43 + .../~/settings/user-profile-form.tsx | 118 + .../site/app/(app)/chat/[[...id]]/layout.tsx | 28 + .../site/app/(app)/chat/[[...id]]/page.tsx | 115 + packages/site/app/(app)/layout.tsx | 161 + packages/site/app/(app)/new/client.tsx | 163 + packages/site/app/(app)/new/page.tsx | 41 + .../app/(app)/telemetry/posthog-provider.tsx | 24 + packages/site/app/(app)/telemetry/posthog.tsx | 27 + packages/site/app/(app)/user/page.tsx | 32 + packages/site/app/(auth)/auth.mock.ts | 87 + packages/site/app/(auth)/auth.test.ts | 76 + packages/site/app/(auth)/auth.ts | 192 + packages/site/app/(auth)/auth/auth-client.tsx | 139 + packages/site/app/(auth)/auth/layout.tsx | 18 + packages/site/app/(auth)/auth/page.tsx | 28 + .../site/app/(auth)/auth/success/page.tsx | 53 + .../app/(public)/email-verification/form.tsx | 115 + .../email-verification/page.stories.tsx | 42 + .../app/(public)/email-verification/page.tsx | 77 + .../app/(public)/fonts/LayGrotesk-Medium.ttf | Bin 0 -> 19328 bytes .../(public)/fonts/LayGrotesk-Medium.woff2 | Bin 0 -> 8048 bytes .../app/(public)/fonts/LayGrotesk-Regular.ttf | Bin 0 -> 18548 bytes .../(public)/fonts/LayGrotesk-Regular.woff2 | Bin 0 -> 7580 bytes packages/site/app/(public)/home/page.tsx | 2104 ++++++++++ packages/site/app/(public)/layout.tsx | 327 ++ packages/site/app/(public)/login/form.tsx | 204 + .../site/app/(public)/login/page.stories.tsx | 72 + packages/site/app/(public)/login/page.tsx | 216 + packages/site/app/(public)/page.tsx | 47 + packages/site/app/(public)/privacy/page.tsx | 839 ++++ .../app/(public)/reset-password/new/form.tsx | 103 + .../reset-password/new/page.stories.tsx | 27 + .../app/(public)/reset-password/new/page.tsx | 46 + .../(public)/reset-password/page.stories.tsx | 25 + .../site/app/(public)/reset-password/page.tsx | 126 + .../(public)/reset-password/verify/form.tsx | 118 + .../reset-password/verify/page.stories.tsx | 42 + .../(public)/reset-password/verify/page.tsx | 56 + packages/site/app/(public)/signup/form.tsx | 185 + .../site/app/(public)/signup/page.stories.tsx | 32 + packages/site/app/(public)/signup/page.tsx | 156 + packages/site/app/(public)/styles.css | 356 ++ packages/site/app/(public)/terms/page.tsx | 614 +++ .../(public)/terms/third-party-terms/page.tsx | 196 + packages/site/app/globals.css | 614 +++ .../invite/[token]/accept-invite-button.tsx | 60 + .../site/app/invite/[token]/page.stories.tsx | 146 + packages/site/app/invite/[token]/page.tsx | 217 + packages/site/app/invite/layout.tsx | 6 + packages/site/app/layout.tsx | 93 + packages/site/app/not-found.tsx | 38 + packages/site/app/robots.ts | 29 + packages/site/app/sitemap.ts | 41 + packages/site/components/agent-chat.tsx | 766 ++++ packages/site/components/agent-pinned.tsx | 98 + packages/site/components/chat-history.tsx | 593 +++ .../components/chat-message-input.test.tsx | 84 + .../site/components/chat-message-input.tsx | 620 +++ .../components/chat-multimodal-input.test.tsx | 165 + .../site/components/chat-multimodal-input.tsx | 415 ++ packages/site/components/chat-sidebar.tsx | 95 + packages/site/components/chat.tsx | 59 + .../components/create-organization-modal.tsx | 119 + packages/site/components/file-part.tsx | 112 + packages/site/components/footer.tsx | 47 + packages/site/components/global-shortcuts.tsx | 27 + packages/site/components/header.tsx | 231 ++ packages/site/components/icons.tsx | 1756 ++++++++ packages/site/components/markdown.test.tsx | 67 + packages/site/components/markdown.tsx | 581 +++ .../site/components/message-actions.test.tsx | 287 ++ packages/site/components/message-actions.tsx | 112 + .../site/components/message-reasoning.tsx | 85 + packages/site/components/message.tsx | 200 + .../site/components/microphone-button.tsx | 214 + .../organization-agent-selector.tsx | 480 +++ packages/site/components/page-header.tsx | 31 + .../components/preview-attachment.test.tsx | 250 ++ .../site/components/preview-attachment.tsx | 110 + .../site/components/settings-navigation.tsx | 48 + packages/site/components/theme-color-meta.tsx | 52 + packages/site/components/theme-provider.tsx | 18 + packages/site/components/toast.tsx | 76 + packages/site/components/tool-call.tsx | 1449 +++++++ packages/site/components/ui/alert-dialog.tsx | 139 + packages/site/components/ui/alert.tsx | 62 + packages/site/components/ui/area-chart.tsx | 998 +++++ packages/site/components/ui/avatar.tsx | 64 + packages/site/components/ui/badge.tsx | 35 + packages/site/components/ui/button.tsx | 57 + packages/site/components/ui/card.tsx | 78 + packages/site/components/ui/checkbox.tsx | 30 + packages/site/components/ui/dialog.tsx | 134 + packages/site/components/ui/dropdown-menu.tsx | 196 + packages/site/components/ui/input.tsx | 22 + packages/site/components/ui/keycap.tsx | 17 + packages/site/components/ui/label.tsx | 23 + packages/site/components/ui/navigation.tsx | 150 + packages/site/components/ui/pagination.tsx | 121 + packages/site/components/ui/separator.tsx | 31 + packages/site/components/ui/sheet.tsx | 129 + packages/site/components/ui/sidebar.tsx | 1036 +++++ packages/site/components/ui/skeleton.tsx | 15 + packages/site/components/ui/tab-nav.tsx | 55 + packages/site/components/ui/table.tsx | 110 + packages/site/components/ui/textarea.tsx | 21 + packages/site/components/ui/tooltip.tsx | 30 + .../site/components/user-selector.test.tsx | 114 + packages/site/components/user-selector.tsx | 205 + packages/site/hooks/use-attachments.tsx | 138 + .../site/hooks/use-chat-messages-scroll.tsx | 88 + packages/site/hooks/use-mobile.tsx | 21 + packages/site/hooks/use-on-window-resize.tsx | 15 + packages/site/hooks/use-text-to-speech.tsx | 351 ++ packages/site/lib/api-client.ts | 14 + packages/site/lib/chart-utils.ts | 126 + packages/site/lib/constants.ts | 1 + packages/site/lib/database.mock.ts | 131 + packages/site/lib/database.ts | 15 + packages/site/lib/utils.ts | 211 + packages/site/middleware.ts | 135 + packages/site/next-env.d.ts | 5 + packages/site/next.config.ts | 256 ++ packages/site/package.json | 92 + packages/site/postcss.config.mjs | 8 + packages/site/public/.well-known/security.txt | 5 + packages/site/public/app-180.png | Bin 0 -> 677 bytes packages/site/public/blink-cubes.png | Bin 0 -> 167057 bytes packages/site/public/blink-five.png | Bin 0 -> 29995 bytes packages/site/public/blink-flash-static.png | Bin 0 -> 4042 bytes packages/site/public/blink-flash.png | Bin 0 -> 10030 bytes packages/site/public/blink-github-comment.png | Bin 0 -> 8746 bytes packages/site/public/blink-hop-static.png | Bin 0 -> 4062 bytes packages/site/public/blink-hop.png | Bin 0 -> 48463 bytes packages/site/public/blink-logo-black.svg | 27 + packages/site/public/blink-logo-white.svg | 27 + packages/site/public/blink-off.png | Bin 0 -> 8567 bytes packages/site/public/blink-slack-comment.png | Bin 0 -> 4136 bytes packages/site/public/blink-slide.png | Bin 0 -> 161260 bytes packages/site/public/blink-twist.png | Bin 0 -> 101827 bytes packages/site/public/center-hero.png | Bin 0 -> 100152 bytes packages/site/public/chime.mp3 | Bin 0 -> 20107 bytes packages/site/public/coder-logo-white.svg | 8 + packages/site/public/early-access-hero.png | Bin 0 -> 286352 bytes packages/site/public/email-footer.jpg | Bin 0 -> 3406 bytes packages/site/public/email-header.jpg | Bin 0 -> 6740 bytes packages/site/public/feature-1.png | Bin 0 -> 1276727 bytes packages/site/public/feature-2.png | Bin 0 -> 1920209 bytes packages/site/public/feature-3.png | Bin 0 -> 1184957 bytes .../site/public/fonts/LayGrotesk-Medium.ttf | Bin 0 -> 19328 bytes .../site/public/fonts/LayGrotesk-Medium.woff2 | Bin 0 -> 8048 bytes .../site/public/fonts/LayGrotesk-Regular.ttf | Bin 0 -> 18548 bytes .../public/fonts/LayGrotesk-Regular.woff2 | Bin 0 -> 7580 bytes packages/site/public/icon-dark.svg | 3 + packages/site/public/icon-light.svg | 3 + packages/site/public/left-hero.png | Bin 0 -> 77705 bytes packages/site/public/manifest.json | 24 + packages/site/public/noise.svg | 11 + packages/site/public/og-image.png | Bin 0 -> 30712 bytes packages/site/public/package-managers/bun.svg | 1 + packages/site/public/package-managers/npm.svg | 9 + .../site/public/package-managers/pnpm.svg | 3 + .../site/public/package-managers/yarn.svg | 1 + packages/site/public/right-hero.png | Bin 0 -> 126776 bytes packages/site/public/slack-1.png | Bin 0 -> 129468 bytes packages/site/public/slack-2.png | Bin 0 -> 193693 bytes packages/site/public/slack-3.png | Bin 0 -> 221572 bytes packages/site/public/slack-demo.mp4 | Bin 0 -> 12617231 bytes .../site/public/use-cases/blink-chat_1.jpg | Bin 0 -> 340994 bytes .../site/public/use-cases/blink-chat_10.jpg | Bin 0 -> 292399 bytes .../site/public/use-cases/blink-chat_11.jpg | Bin 0 -> 153558 bytes .../site/public/use-cases/blink-chat_12.jpg | Bin 0 -> 235317 bytes .../site/public/use-cases/blink-chat_13.jpg | Bin 0 -> 78362 bytes .../site/public/use-cases/blink-chat_14.jpg | Bin 0 -> 685822 bytes .../site/public/use-cases/blink-chat_15.jpg | Bin 0 -> 498373 bytes .../site/public/use-cases/blink-chat_2.jpg | Bin 0 -> 281820 bytes .../site/public/use-cases/blink-chat_3.jpg | Bin 0 -> 161023 bytes .../site/public/use-cases/blink-chat_4.jpg | Bin 0 -> 586680 bytes .../site/public/use-cases/blink-chat_5.jpg | Bin 0 -> 950820 bytes .../site/public/use-cases/blink-chat_6.jpg | Bin 0 -> 498803 bytes .../site/public/use-cases/blink-chat_7.jpg | Bin 0 -> 272043 bytes .../site/public/use-cases/blink-chat_8.jpg | Bin 0 -> 547631 bytes .../site/public/use-cases/blink-chat_9.jpg | Bin 0 -> 298147 bytes .../site/public/use-cases/top-use-cases.jpg | Bin 0 -> 778930 bytes .../site/public/use-cases/use-case-16.jpg | Bin 0 -> 372471 bytes packages/site/scripts/generate-templates.ts | 74 + packages/site/scripts/vercel-install.sh | 14 + packages/site/scripts/why-did-you-render.ts | 19 + packages/site/templates.json | 50 + packages/site/test.ts | 93 + packages/site/tsconfig.json | 29 + packages/site/tsconfig.tsbuildinfo | 1 + scripts/db.ts | 25 + 536 files changed, 85810 insertions(+), 367 deletions(-) create mode 100644 AGENTS.md create mode 100644 bunfig.toml create mode 100644 packages/api/.gitignore create mode 100644 packages/api/package.json create mode 100644 packages/api/package.public.json create mode 100644 packages/api/scripts/no-server-imports.ts create mode 100644 packages/api/src/client-helper.test.ts create mode 100644 packages/api/src/client-helper.ts create mode 100644 packages/api/src/client.browser.ts create mode 100644 packages/api/src/client.node.ts create mode 100644 packages/api/src/constants.ts create mode 100644 packages/api/src/middleware.test.ts create mode 100644 packages/api/src/middleware.ts create mode 100644 packages/api/src/react/index.ts create mode 100644 packages/api/src/react/use-chat.test.tsx create mode 100644 packages/api/src/react/use-chat.ts create mode 100644 packages/api/src/routes/agent-request.server.ts create mode 100644 packages/api/src/routes/agent-request.test.ts create mode 100644 packages/api/src/routes/agents/agents.client.ts create mode 100644 packages/api/src/routes/agents/agents.server.ts create mode 100644 packages/api/src/routes/agents/agents.test.ts create mode 100644 packages/api/src/routes/agents/deployments.client.ts create mode 100644 packages/api/src/routes/agents/deployments.server.ts create mode 100644 packages/api/src/routes/agents/deployments.test.ts create mode 100644 packages/api/src/routes/agents/env.client.ts create mode 100644 packages/api/src/routes/agents/env.server.ts create mode 100644 packages/api/src/routes/agents/env.test.ts create mode 100644 packages/api/src/routes/agents/logs.client.ts create mode 100644 packages/api/src/routes/agents/logs.server.ts create mode 100644 packages/api/src/routes/agents/logs.test.ts create mode 100644 packages/api/src/routes/agents/me/me.client.ts create mode 100644 packages/api/src/routes/agents/me/me.server.ts create mode 100644 packages/api/src/routes/agents/me/me.test.ts create mode 100644 packages/api/src/routes/agents/members.client.ts create mode 100644 packages/api/src/routes/agents/members.server.ts create mode 100644 packages/api/src/routes/agents/runs.client.ts create mode 100644 packages/api/src/routes/agents/runs.server.ts create mode 100644 packages/api/src/routes/agents/runs.test.ts create mode 100644 packages/api/src/routes/agents/steps.client.ts create mode 100644 packages/api/src/routes/agents/steps.server.ts create mode 100644 packages/api/src/routes/agents/steps.test.ts create mode 100644 packages/api/src/routes/agents/traces.client.ts create mode 100644 packages/api/src/routes/agents/traces.server.ts create mode 100644 packages/api/src/routes/agents/traces.test.ts create mode 100644 packages/api/src/routes/ai-gateway.server.ts create mode 100644 packages/api/src/routes/ai-gateway.test-data.ts create mode 100644 packages/api/src/routes/api-keys.server.ts create mode 100644 packages/api/src/routes/api-keys.test.ts create mode 100644 packages/api/src/routes/auth/auth.client.ts create mode 100644 packages/api/src/routes/auth/auth.server.test.ts create mode 100644 packages/api/src/routes/auth/auth.server.ts create mode 100644 packages/api/src/routes/auth/auth.test.ts create mode 100644 packages/api/src/routes/chats/chats.client.ts create mode 100644 packages/api/src/routes/chats/chats.server.ts create mode 100644 packages/api/src/routes/chats/chats.test.ts create mode 100644 packages/api/src/routes/chats/runs.client.ts create mode 100644 packages/api/src/routes/chats/runs.server.ts create mode 100644 packages/api/src/routes/chats/runs.test.ts create mode 100644 packages/api/src/routes/chats/steps.client.ts create mode 100644 packages/api/src/routes/chats/steps.server.ts create mode 100644 packages/api/src/routes/chats/steps.test.ts create mode 100644 packages/api/src/routes/devhook.client.ts create mode 100644 packages/api/src/routes/devhook.server.ts create mode 100644 packages/api/src/routes/devhook.test.ts create mode 100644 packages/api/src/routes/files.client.ts create mode 100644 packages/api/src/routes/files.server.ts create mode 100644 packages/api/src/routes/files.test.ts create mode 100644 packages/api/src/routes/invites.client.ts create mode 100644 packages/api/src/routes/invites.server.ts create mode 100644 packages/api/src/routes/invites.test.ts create mode 100644 packages/api/src/routes/messages.client.ts create mode 100644 packages/api/src/routes/messages.server.ts create mode 100644 packages/api/src/routes/messages.test.ts create mode 100644 packages/api/src/routes/organizations/agents.client.ts create mode 100644 packages/api/src/routes/organizations/agents.server.ts create mode 100644 packages/api/src/routes/organizations/agents.test.ts create mode 100644 packages/api/src/routes/organizations/members.client.ts create mode 100644 packages/api/src/routes/organizations/members.server.ts create mode 100644 packages/api/src/routes/organizations/members.test.ts create mode 100644 packages/api/src/routes/organizations/organizations.client.ts create mode 100644 packages/api/src/routes/organizations/organizations.server.ts create mode 100644 packages/api/src/routes/organizations/organizations.test.ts create mode 100644 packages/api/src/routes/otlp/README.md create mode 100644 packages/api/src/routes/otlp/buf.gen.yaml create mode 100644 packages/api/src/routes/otlp/convert.test.ts create mode 100644 packages/api/src/routes/otlp/convert.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/common/v1/common_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/logs/v1/logs_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/metrics/v1/metrics_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/profiles/v1development/profiles_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/resource/v1/resource_pb.ts create mode 100644 packages/api/src/routes/otlp/gen/opentelemetry/proto/trace/v1/trace_pb.ts create mode 100644 packages/api/src/routes/otlp/otlp.server.ts create mode 100644 packages/api/src/routes/otlp/otlp.test.ts create mode 100644 packages/api/src/routes/tools/compute.client.ts create mode 100644 packages/api/src/routes/tools/compute.server.ts create mode 100644 packages/api/src/routes/tools/exa.server.ts create mode 100644 packages/api/src/routes/tools/exa.test.ts create mode 100644 packages/api/src/routes/tools/tools.client.node.ts create mode 100644 packages/api/src/routes/tools/tools.server.ts create mode 100644 packages/api/src/routes/users.client.ts create mode 100644 packages/api/src/routes/users.server.ts create mode 100644 packages/api/src/routes/users.test.ts create mode 100644 packages/api/src/server-helper.ts create mode 100644 packages/api/src/server.test.ts create mode 100644 packages/api/src/server.ts create mode 100644 packages/api/src/test.ts create mode 100644 packages/api/src/util/async-iterable-stream.ts create mode 100644 packages/api/src/util/chat.ts create mode 100644 packages/api/tsconfig.json create mode 100644 packages/api/tsconfig.tsbuildinfo create mode 100644 packages/api/tsdown.config.ts create mode 100644 packages/billing/package.json create mode 100644 packages/billing/src/ingest-usage-event.ts create mode 100644 packages/billing/src/metronome.ts create mode 100644 packages/billing/src/money.ts create mode 100644 packages/database/bun.lock create mode 100644 packages/database/drizzle.config.ts create mode 100644 packages/database/dump_schema.ts create mode 100644 packages/database/migrate.ts create mode 100644 packages/database/migrations/0000_initial.sql create mode 100644 packages/database/migrations/meta/0000_snapshot.json create mode 100644 packages/database/migrations/meta/_journal.json create mode 100644 packages/database/package.json create mode 100755 packages/database/reset.sh create mode 100644 packages/database/scripts/dump_full_schema.ts create mode 100644 packages/database/src/agent-permissions.test.ts create mode 100644 packages/database/src/convert.ts create mode 100644 packages/database/src/encryption.test.ts create mode 100644 packages/database/src/encryption.ts create mode 100644 packages/database/src/knock-service.ts create mode 100644 packages/database/src/observability/filters.ts create mode 100644 packages/database/src/observability/logs.test.ts create mode 100644 packages/database/src/observability/logs.ts create mode 100644 packages/database/src/observability/traces.ts create mode 100644 packages/database/src/postgres-worker.ts create mode 100644 packages/database/src/postgres.test.ts create mode 100644 packages/database/src/postgres.ts create mode 100644 packages/database/src/querier.test.ts create mode 100644 packages/database/src/querier.ts create mode 100644 packages/database/src/schema.ts create mode 100644 packages/database/src/shared.ts create mode 100644 packages/database/src/test.ts create mode 100644 packages/database/src/usage-queries.test.ts create mode 100644 packages/database/tsconfig.json create mode 100644 packages/database/tsconfig.tsbuildinfo create mode 100644 packages/runtime/package.json create mode 100644 packages/runtime/scripts/generate.ts create mode 100644 packages/runtime/src/lambda/fixtures/client-using-storage.ts create mode 100644 packages/runtime/src/lambda/runtime-lambda.ts create mode 100644 packages/runtime/src/lambda/wrapper-lambda.generated.ts create mode 100644 packages/runtime/src/lambda/wrapper-lambda.test.ts create mode 100644 packages/runtime/src/lambda/wrapper-lambda.ts create mode 100644 packages/runtime/src/node/wrapper-node.generated.ts create mode 100644 packages/runtime/src/node/wrapper-node.ts create mode 100644 packages/runtime/src/server.ts create mode 100644 packages/runtime/src/types.ts create mode 100644 packages/server/.gitignore create mode 100644 packages/server/README.md create mode 100644 packages/server/package.json create mode 100644 packages/server/scripts/build.ts create mode 100644 packages/server/src/agent-deployment.ts create mode 100644 packages/server/src/chat.ts create mode 100644 packages/server/src/cli.ts create mode 100644 packages/server/src/logger.ts create mode 100644 packages/server/src/postgres.ts create mode 100644 packages/server/src/server.ts create mode 100644 packages/server/tsconfig.json create mode 100644 packages/server/tsdown.config.ts create mode 100644 packages/site/.gitignore create mode 100644 packages/site/.storybook/main.ts create mode 100644 packages/site/.storybook/preview.tsx create mode 100644 packages/site/.storybook/utils.tsx create mode 100644 packages/site/README.md create mode 100644 packages/site/app/(app)/[organization]/[agent]/access/add-member-modal.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/access/agent-access-client.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/access/members-table.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/access/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/access/permissions-reference.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/access/visibility-section.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/chats/[[...id]]/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/agent-daily-chats.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/agent-logs.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/agent-logs.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/agent-source.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/date-range-filter.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/deployments/[number]/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/deployments/[number]/view.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/deployments/list.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/deployments/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/develop/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/layout.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/logs/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/navigation.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/page.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/agent-avatar-form.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/agent-delete-form.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/env/env-manager.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/env/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/form.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/layout.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/navigation.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/webhooks/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/settings/webhooks/webhooks-section.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/source/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/source/view.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/list.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/list.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/span-details-sidebar.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/span-details-sidebar.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/status-badges.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/trace-filters-panel.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/trace-filters-panel.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/trace-tree-view.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/trace-tree-view.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/traces/utils.ts create mode 100644 packages/site/app/(app)/[organization]/[agent]/usage/agent-usage.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/usage/page.tsx create mode 100644 packages/site/app/(app)/[organization]/[agent]/usage/time-range-selector.tsx create mode 100644 packages/site/app/(app)/[organization]/layout.tsx create mode 100644 packages/site/app/(app)/[organization]/navigation.tsx create mode 100644 packages/site/app/(app)/[organization]/page.stories.tsx create mode 100644 packages/site/app/(app)/[organization]/page.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/invite-link-modal.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/invite-member-modal.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/member-actions-dropdown.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/members-table.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/organization-permissions-reference.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/page.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/pending-invites-table.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/people-page.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/role-dropdown.tsx create mode 100644 packages/site/app/(app)/[organization]/~/people/utils.ts create mode 100644 packages/site/app/(app)/[organization]/~/settings/api-keys/api-keys-manager.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/api-keys/create-api-key-modal.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/api-keys/page.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/layout.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/navigation.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/organization-avatar-form.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/organization-delete-form.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/organization-id-section.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/organization-profile-form.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/page.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-authentication-client.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-authentication.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-avatar-form.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-delete-form.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-email-form.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-id-section.tsx create mode 100644 packages/site/app/(app)/[organization]/~/settings/user-profile-form.tsx create mode 100644 packages/site/app/(app)/chat/[[...id]]/layout.tsx create mode 100644 packages/site/app/(app)/chat/[[...id]]/page.tsx create mode 100644 packages/site/app/(app)/layout.tsx create mode 100644 packages/site/app/(app)/new/client.tsx create mode 100644 packages/site/app/(app)/new/page.tsx create mode 100644 packages/site/app/(app)/telemetry/posthog-provider.tsx create mode 100644 packages/site/app/(app)/telemetry/posthog.tsx create mode 100644 packages/site/app/(app)/user/page.tsx create mode 100644 packages/site/app/(auth)/auth.mock.ts create mode 100644 packages/site/app/(auth)/auth.test.ts create mode 100644 packages/site/app/(auth)/auth.ts create mode 100644 packages/site/app/(auth)/auth/auth-client.tsx create mode 100644 packages/site/app/(auth)/auth/layout.tsx create mode 100644 packages/site/app/(auth)/auth/page.tsx create mode 100644 packages/site/app/(auth)/auth/success/page.tsx create mode 100644 packages/site/app/(public)/email-verification/form.tsx create mode 100644 packages/site/app/(public)/email-verification/page.stories.tsx create mode 100644 packages/site/app/(public)/email-verification/page.tsx create mode 100644 packages/site/app/(public)/fonts/LayGrotesk-Medium.ttf create mode 100644 packages/site/app/(public)/fonts/LayGrotesk-Medium.woff2 create mode 100644 packages/site/app/(public)/fonts/LayGrotesk-Regular.ttf create mode 100644 packages/site/app/(public)/fonts/LayGrotesk-Regular.woff2 create mode 100644 packages/site/app/(public)/home/page.tsx create mode 100644 packages/site/app/(public)/layout.tsx create mode 100644 packages/site/app/(public)/login/form.tsx create mode 100644 packages/site/app/(public)/login/page.stories.tsx create mode 100644 packages/site/app/(public)/login/page.tsx create mode 100644 packages/site/app/(public)/page.tsx create mode 100644 packages/site/app/(public)/privacy/page.tsx create mode 100644 packages/site/app/(public)/reset-password/new/form.tsx create mode 100644 packages/site/app/(public)/reset-password/new/page.stories.tsx create mode 100644 packages/site/app/(public)/reset-password/new/page.tsx create mode 100644 packages/site/app/(public)/reset-password/page.stories.tsx create mode 100644 packages/site/app/(public)/reset-password/page.tsx create mode 100644 packages/site/app/(public)/reset-password/verify/form.tsx create mode 100644 packages/site/app/(public)/reset-password/verify/page.stories.tsx create mode 100644 packages/site/app/(public)/reset-password/verify/page.tsx create mode 100644 packages/site/app/(public)/signup/form.tsx create mode 100644 packages/site/app/(public)/signup/page.stories.tsx create mode 100644 packages/site/app/(public)/signup/page.tsx create mode 100644 packages/site/app/(public)/styles.css create mode 100644 packages/site/app/(public)/terms/page.tsx create mode 100644 packages/site/app/(public)/terms/third-party-terms/page.tsx create mode 100644 packages/site/app/globals.css create mode 100644 packages/site/app/invite/[token]/accept-invite-button.tsx create mode 100644 packages/site/app/invite/[token]/page.stories.tsx create mode 100644 packages/site/app/invite/[token]/page.tsx create mode 100644 packages/site/app/invite/layout.tsx create mode 100644 packages/site/app/layout.tsx create mode 100644 packages/site/app/not-found.tsx create mode 100644 packages/site/app/robots.ts create mode 100644 packages/site/app/sitemap.ts create mode 100644 packages/site/components/agent-chat.tsx create mode 100644 packages/site/components/agent-pinned.tsx create mode 100644 packages/site/components/chat-history.tsx create mode 100644 packages/site/components/chat-message-input.test.tsx create mode 100644 packages/site/components/chat-message-input.tsx create mode 100644 packages/site/components/chat-multimodal-input.test.tsx create mode 100644 packages/site/components/chat-multimodal-input.tsx create mode 100644 packages/site/components/chat-sidebar.tsx create mode 100644 packages/site/components/chat.tsx create mode 100644 packages/site/components/create-organization-modal.tsx create mode 100644 packages/site/components/file-part.tsx create mode 100644 packages/site/components/footer.tsx create mode 100644 packages/site/components/global-shortcuts.tsx create mode 100644 packages/site/components/header.tsx create mode 100644 packages/site/components/icons.tsx create mode 100644 packages/site/components/markdown.test.tsx create mode 100644 packages/site/components/markdown.tsx create mode 100644 packages/site/components/message-actions.test.tsx create mode 100644 packages/site/components/message-actions.tsx create mode 100644 packages/site/components/message-reasoning.tsx create mode 100644 packages/site/components/message.tsx create mode 100644 packages/site/components/microphone-button.tsx create mode 100644 packages/site/components/organization-agent-selector.tsx create mode 100644 packages/site/components/page-header.tsx create mode 100644 packages/site/components/preview-attachment.test.tsx create mode 100644 packages/site/components/preview-attachment.tsx create mode 100644 packages/site/components/settings-navigation.tsx create mode 100644 packages/site/components/theme-color-meta.tsx create mode 100644 packages/site/components/theme-provider.tsx create mode 100644 packages/site/components/toast.tsx create mode 100644 packages/site/components/tool-call.tsx create mode 100644 packages/site/components/ui/alert-dialog.tsx create mode 100644 packages/site/components/ui/alert.tsx create mode 100644 packages/site/components/ui/area-chart.tsx create mode 100644 packages/site/components/ui/avatar.tsx create mode 100644 packages/site/components/ui/badge.tsx create mode 100644 packages/site/components/ui/button.tsx create mode 100644 packages/site/components/ui/card.tsx create mode 100644 packages/site/components/ui/checkbox.tsx create mode 100644 packages/site/components/ui/dialog.tsx create mode 100644 packages/site/components/ui/dropdown-menu.tsx create mode 100644 packages/site/components/ui/input.tsx create mode 100644 packages/site/components/ui/keycap.tsx create mode 100644 packages/site/components/ui/label.tsx create mode 100644 packages/site/components/ui/navigation.tsx create mode 100644 packages/site/components/ui/pagination.tsx create mode 100644 packages/site/components/ui/separator.tsx create mode 100644 packages/site/components/ui/sheet.tsx create mode 100644 packages/site/components/ui/sidebar.tsx create mode 100644 packages/site/components/ui/skeleton.tsx create mode 100644 packages/site/components/ui/tab-nav.tsx create mode 100644 packages/site/components/ui/table.tsx create mode 100644 packages/site/components/ui/textarea.tsx create mode 100644 packages/site/components/ui/tooltip.tsx create mode 100644 packages/site/components/user-selector.test.tsx create mode 100644 packages/site/components/user-selector.tsx create mode 100644 packages/site/hooks/use-attachments.tsx create mode 100644 packages/site/hooks/use-chat-messages-scroll.tsx create mode 100644 packages/site/hooks/use-mobile.tsx create mode 100644 packages/site/hooks/use-on-window-resize.tsx create mode 100644 packages/site/hooks/use-text-to-speech.tsx create mode 100644 packages/site/lib/api-client.ts create mode 100644 packages/site/lib/chart-utils.ts create mode 100644 packages/site/lib/constants.ts create mode 100644 packages/site/lib/database.mock.ts create mode 100644 packages/site/lib/database.ts create mode 100644 packages/site/lib/utils.ts create mode 100644 packages/site/middleware.ts create mode 100644 packages/site/next-env.d.ts create mode 100644 packages/site/next.config.ts create mode 100644 packages/site/package.json create mode 100644 packages/site/postcss.config.mjs create mode 100644 packages/site/public/.well-known/security.txt create mode 100644 packages/site/public/app-180.png create mode 100644 packages/site/public/blink-cubes.png create mode 100644 packages/site/public/blink-five.png create mode 100644 packages/site/public/blink-flash-static.png create mode 100644 packages/site/public/blink-flash.png create mode 100644 packages/site/public/blink-github-comment.png create mode 100644 packages/site/public/blink-hop-static.png create mode 100644 packages/site/public/blink-hop.png create mode 100644 packages/site/public/blink-logo-black.svg create mode 100644 packages/site/public/blink-logo-white.svg create mode 100644 packages/site/public/blink-off.png create mode 100644 packages/site/public/blink-slack-comment.png create mode 100644 packages/site/public/blink-slide.png create mode 100644 packages/site/public/blink-twist.png create mode 100644 packages/site/public/center-hero.png create mode 100644 packages/site/public/chime.mp3 create mode 100644 packages/site/public/coder-logo-white.svg create mode 100644 packages/site/public/early-access-hero.png create mode 100644 packages/site/public/email-footer.jpg create mode 100644 packages/site/public/email-header.jpg create mode 100644 packages/site/public/feature-1.png create mode 100644 packages/site/public/feature-2.png create mode 100644 packages/site/public/feature-3.png create mode 100644 packages/site/public/fonts/LayGrotesk-Medium.ttf create mode 100644 packages/site/public/fonts/LayGrotesk-Medium.woff2 create mode 100644 packages/site/public/fonts/LayGrotesk-Regular.ttf create mode 100644 packages/site/public/fonts/LayGrotesk-Regular.woff2 create mode 100644 packages/site/public/icon-dark.svg create mode 100644 packages/site/public/icon-light.svg create mode 100644 packages/site/public/left-hero.png create mode 100644 packages/site/public/manifest.json create mode 100644 packages/site/public/noise.svg create mode 100644 packages/site/public/og-image.png create mode 100644 packages/site/public/package-managers/bun.svg create mode 100644 packages/site/public/package-managers/npm.svg create mode 100644 packages/site/public/package-managers/pnpm.svg create mode 100644 packages/site/public/package-managers/yarn.svg create mode 100644 packages/site/public/right-hero.png create mode 100644 packages/site/public/slack-1.png create mode 100644 packages/site/public/slack-2.png create mode 100644 packages/site/public/slack-3.png create mode 100644 packages/site/public/slack-demo.mp4 create mode 100644 packages/site/public/use-cases/blink-chat_1.jpg create mode 100644 packages/site/public/use-cases/blink-chat_10.jpg create mode 100644 packages/site/public/use-cases/blink-chat_11.jpg create mode 100644 packages/site/public/use-cases/blink-chat_12.jpg create mode 100644 packages/site/public/use-cases/blink-chat_13.jpg create mode 100644 packages/site/public/use-cases/blink-chat_14.jpg create mode 100644 packages/site/public/use-cases/blink-chat_15.jpg create mode 100644 packages/site/public/use-cases/blink-chat_2.jpg create mode 100644 packages/site/public/use-cases/blink-chat_3.jpg create mode 100644 packages/site/public/use-cases/blink-chat_4.jpg create mode 100644 packages/site/public/use-cases/blink-chat_5.jpg create mode 100644 packages/site/public/use-cases/blink-chat_6.jpg create mode 100644 packages/site/public/use-cases/blink-chat_7.jpg create mode 100644 packages/site/public/use-cases/blink-chat_8.jpg create mode 100644 packages/site/public/use-cases/blink-chat_9.jpg create mode 100644 packages/site/public/use-cases/top-use-cases.jpg create mode 100644 packages/site/public/use-cases/use-case-16.jpg create mode 100644 packages/site/scripts/generate-templates.ts create mode 100755 packages/site/scripts/vercel-install.sh create mode 100644 packages/site/scripts/why-did-you-render.ts create mode 100644 packages/site/templates.json create mode 100644 packages/site/test.ts create mode 100644 packages/site/tsconfig.json create mode 100644 packages/site/tsconfig.tsbuildinfo create mode 100644 scripts/db.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c0b50c..ea2008d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,12 +32,14 @@ jobs: bun run --cwd packages/slack build bun run --cwd packages/model-intent build bun run --cwd packages/blink build + bun run --cwd packages/api build + bun run --cwd packages/server build - name: Run formatter check - run: bun run format --check + run: bun run format:check - name: Run type checking run: bun run typecheck - name: Run tests - run: bun test + run: bun test --timeout 30000 diff --git a/.gitignore b/.gitignore index 0c3f1c9..d8bebe2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist/ *.tgz .env.* .sonda +.blink diff --git a/.prettierrc.json b/.prettierrc.json index 2eef55d..efc0286 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -4,5 +4,6 @@ "singleQuote": false, "printWidth": 80, "tabWidth": 2, - "useTabs": false + "useTabs": false, + "plugins": ["prettier-plugin-organize-imports"] } diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..cdb106c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,166 @@ +# Blink Development + +## 1 Repository Overview + +Blink is a Bun-powered monorepo managed via Bun workspaces (see `package.json → workspaces`). Each top-level package has a focused responsibility: + +| Package | Purpose | +| -------------------- | ------------------------------------------------------------------------- | +| `packages/site/` | Next.js App Router front-end (Tailwind, React server & client components) | +| `packages/worker/` | Cloudflare Worker back-end (chat, webhooks, file uploads, etc.) | +| `packages/database/` | Drizzle-based PostgreSQL access layer & migrations | +| Other `packages/*` | Supporting SDKs, CLIs, event helpers, etc. | + +Top-level scripts (`/scripts/*.ts`) orchestrate local tasks (DB, data dumps, etc.). `main` is always deployable. + +## 2 Local Development + +@cmux: Always run `bun i` when beginning to install packages. Pull all submodules before you begin as well. They are needed for development. + +Test: `bun test` +Format: `bun format` +Typecheck: `bun typecheck` + +All three _must_ work before CI will pass. + +## 3 Coding Conventions + +• **Formatting & linting** – Prettier is the single source of style; run `bun format` before committing. No ESLint rules are enforced beyond TS‐strictness. + +• **Imports** – Use absolute path aliases: + +- Front-end: `@/lib/foo`, `@/components/Bar`. +- DB: `@database/...` (provided by `packages/database/tsconfig.json`). +- Worker: `@worker/...`. + Relative `../..` chains are discouraged except inside tests. + +• **React / Next** + +- Functional components only. +- Tailwind for styling; avoid extra CSS files. Rare global styles go in `packages/site/app/globals.css`. +- Memoisation (`React.memo`, `useMemo`) only where **obviously** valuable. + +• **Comments** – Keep them Go-style (`//`) and minimal. Code should be self-explanatory. + +• **Logging** – `console.log` is sufficient for now; avoid external logging services unless discussed first. + +• **Testing** + +- No wait/sleep – favor determinism. +- Flat structure – avoid deeply nested `describe` blocks. +- No duplicative naming – if a file is named "Example", the tests do not need to start with "Example –". +- Isolation – never call external network APIs in unit tests. Use local mocks (see `packages/*/*.mock.ts`). +- Database – use the helpers in `packages/database/test.ts` for setup/teardown. Never hit a live DB. + +• **Database** + +- Never write queries outside of `querier.ts`. These are centralized for easy migrations. +- NEVER write manual migrations. Always adjust `schema.ts` and use `cd packages/database/ && bun generate`. Format afterwards. + +• **API** + +- All API routes go in `packages/api/`. These are consumed and injected by the Worker, but are intentionally separated. +- Do not make API routes in `packages/site/` - ever. + +## 4 Commit & PR Etiquette + +• Write clear, concise commit messages (prefixes like `feat:`, `fix:` are welcome but optional). Squash or merge—author’s choice. + +• CI (GitHub Actions) runs `bun format:check`, `bun typecheck`, and `bun test` on every PR; **all must pass** before merging. There are **no pre-commit hooks**, so run these commands locally or let CI catch issues. + +• Keep the default branch (`main`) green; avoid merging failing builds. + +• Mention any migrations or required env-vars in the PR description. + +## 5 AI-Generated Content Attribution + +When creating public operations (commits, PRs, issues), always include: + +- 🤖 emoji in the title +- "_Generated with `cmux`_" in the body (if applicable) + +This ensures transparency about AI-generated contributions. + +--- + +## 6 PR Management + +After submitting or updating PRs, **always check merge status**: + +```bash +gh pr view --json mergeable,mergeStateStatus | jq '.' +``` + +This is especially important with rapid development where branches quickly fall behind. + +**Wait for PR checks to complete:** + +```bash +./scripts/wait_pr_checks.sh +``` + +This script polls every 5 seconds and fails immediately on CI failure, bad merge status, or unresolved review comments. It will notify you when the PR is ready to merge. + +**Key status values:** + +- `mergeable: "MERGEABLE"` = No conflicts, can merge +- `mergeable: "CONFLICTING"` = Has conflicts, needs resolution +- `mergeStateStatus: "CLEAN"` = Ready to merge ✅ +- `mergeStateStatus: "BLOCKED"` = Waiting for CI checks +- `mergeStateStatus: "BEHIND"` = Branch is behind base, rebase needed +- `mergeStateStatus: "DIRTY"` = Has conflicts + +**If branch is behind:** + +```bash +git fetch origin +git rebase origin/main +git push --force-with-lease +``` + +**ALWAYS AWAIT PRs UNTIL THEY PASS, OR YOU GET STUCK** + +### ⚠️ NEVER Auto-Merge PRs + +**DO NOT** enable auto-merge (`gh pr merge --auto`) or merge PRs (`gh pr merge`) without **explicit user instruction**. + +Reason: PRs may need human review, discussion, or additional changes based on review comments (e.g., Codex feedback). Always: + +1. Submit the PR +2. Wait for checks to pass +3. Report PR status to user +4. **Wait for user to decide** whether to merge + +Only merge if the user explicitly says "merge it" or similar. + +### Writing PR Descriptions + +Write PR bodies for **busy reviewers**. Be concise and avoid redundancy: + +- **Each section should add new information** - Don't restate the same thing in different words +- **Structure emerges from content** - Some fixes need problem/solution/testing, others just need "what changed and why" +- **If it's obvious, omit it** - Problem obvious from solution? Don't state it. Solution obvious from problem? Skip to implementation details. + +❌ **Bad** (redundant): + +``` +Problem: Markdown rendering is slow, causing 50ms tasks +Solution: Make markdown rendering faster +Impact: Reduces task time to <16ms +``` + +✅ **Good** (each section adds value): + +``` +ReactMarkdown was re-parsing content on every parent render because plugin arrays +were created fresh each time. Moved to module scope for stable references. + +Verify with React DevTools Profiler - MarkdownCore should only re-render when content changes. +``` + +## 7 Design + +- **Avoid using too many font sizes** - this makes it visually difficult for the user. +- **Avoid using bold** - Bold expresses a really strong signal to the user, only use bold when it's truly very important to. +- **Density** - Blink is a platform for developers - developers use interfaces like VS Code and Cursor, which have visual density and highly idiomatic user-experience. +- **Styling** - Aim to make things beautiful by making them simple. Think like Apple. diff --git a/LICENSE b/LICENSE index 8bb9ce0..0ad25db 100644 --- a/LICENSE +++ b/LICENSE @@ -1,20 +1,661 @@ -The MIT License - -Copyright (c) 2025 Coder Technologies Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/bun.lock b/bun.lock index 3f4ae85..8753a14 100644 --- a/bun.lock +++ b/bun.lock @@ -5,16 +5,60 @@ "": { "name": "blink-repo", "devDependencies": { - "@types/bun": "latest", - "@typescript/native-preview": "^7.0.0-dev.20250907.1", - "prettier": "^3.6.2", + "@ai-sdk/openai": "^2.0.27", + "@ai-sdk/provider-utils": "^3.0.8", + "@cloudflare/workers-types": "^4.20250509.0", + "@modelcontextprotocol/sdk": "^1.13.0", + "@neondatabase/serverless": "^1.0.0", + "@types/bun": "^1.2.12", + "@types/node": "^24.10.1", + "@typescript/native-preview": "^7.0.0-dev.20250701.1", + "@whatwg-node/server": "^0.10.12", + "ai": "^5.0.39", + "blink": "^1.0.3", + "knip": "^5.69.0", + "next-auth": "5.0.0-beta.28", + "prettier": "^3.4.2", + "prettier-plugin-organize-imports": "^4.3.0", "tsdown": "^0.15.7", "tsx": "^4.20.5", + "wrangler": "^4.31.0", + "zod": "^3.25.28", }, "peerDependencies": { - "typescript": "^5", + "typescript": "^5.9.3", }, }, + "packages/api": { + "name": "@blink.so/api", + "dependencies": { + "bcrypt-ts": "^7.1.0", + "next-auth": "5.0.0-beta.28", + }, + "devDependencies": { + "@bufbuild/protobuf": "^2.9.0", + "eventsource-parser": "^3.0.6", + "hono": "^4.9.7", + "msw": "^2.12.1", + "tsdown": "^0.15.1", + "zod": "^4.1.9", + "zod-validation-error": "^4.0.1", + }, + "optionalDependencies": { + "@blink-sdk/compute-protocol": ">= 0.0.2", + }, + "peerDependencies": { + "ai": ">= 5", + "react": ">= 18", + "zod": ">= 4", + }, + "optionalPeers": [ + "react", + ], + }, + "packages/billing": { + "name": "@blink.so/billing", + }, "packages/blink": { "name": "blink", "version": "1.1.33", @@ -123,6 +167,18 @@ "zod": ">= 4", }, }, + "packages/database": { + "name": "@blink.so/database", + "devDependencies": { + "@electric-sql/pglite": "0.3.2", + "dotenv": "^17.2.3", + "drizzle-kit": "^0.31.5", + "drizzle-orm": "^0.44.5", + "pg": "^8.16.0", + "pg-gateway": "^0.3.0-beta.4", + "postgres": "^3.4.7", + }, + }, "packages/desktop": { "name": "@blink/desktop", "version": "0.1.0", @@ -197,9 +253,16 @@ "@blink-sdk/events": "workspace:*", }, }, + "packages/runtime": { + "name": "@blink.so/runtime", + "devDependencies": { + "aws4fetch": "^1.0.20", + "jszip": "^3.10.1", + }, + }, "packages/scout-agent": { "name": "@blink-sdk/scout-agent", - "version": "0.0.1", + "version": "0.0.6", "dependencies": { "@blink-sdk/compute": "^0.0.15", "@blink-sdk/github": "^0.0.22", @@ -228,6 +291,99 @@ "blink": ">= 1", }, }, + "packages/server": { + "name": "blink-server", + "version": "0.0.7", + "bin": { + "blink-server": "dist/cli.js", + }, + "devDependencies": { + "@types/node": "^22.10.2", + "@types/pg": "^8.11.10", + "@types/ws": "^8.5.13", + "boxen": "^8.0.1", + "chalk": "^5.4.1", + "commander": "^12.1.0", + "drizzle-orm": "^0.44.5", + "fetch-to-node": "^2.1.0", + "pg": "^8.16.0", + "ws": "^8.18.0", + }, + }, + "packages/site": { + "name": "@blink.so/site", + "dependencies": { + "@stripe/react-stripe-js": "^3.9.0", + "@stripe/stripe-js": "^7.8.0", + "fast-deep-equal": "^3.1.3", + }, + "devDependencies": { + "@lexical/react": "^0.32.1", + "@lexical/utils": "^0.32.1", + "@next/bundle-analyzer": "^15.5.3", + "@radix-ui/react-alert-dialog": "^1.1.13", + "@radix-ui/react-checkbox": "^1.3.3", + "@radix-ui/react-dialog": "^1.1.13", + "@radix-ui/react-dropdown-menu": "^2.1.14", + "@radix-ui/react-separator": "^1.1.6", + "@radix-ui/react-slot": "^1.2.2", + "@radix-ui/react-tabs": "^1.1.12", + "@radix-ui/react-tooltip": "^1.2.6", + "@remixicon/react": "^4.6.0", + "@storybook/experimental-nextjs-vite": "^8.6.14", + "@storybook/react": "8.6.14", + "@storybook/test": "8.6.14", + "@tailwindcss/forms": "^0.5.10", + "@tailwindcss/postcss": "^4.1.13", + "@tailwindcss/typography": "^0.5.16", + "@testing-library/react": "^16.3.0", + "@types/react": "^19.1.2", + "@types/react-dom": "^19.1.3", + "@types/react-syntax-highlighter": "^15.5.13", + "@welldone-software/why-did-you-render": "^10.0.1", + "@xterm/xterm": "^5.5.0", + "bcrypt-ts": "^7.0.0", + "class-variance-authority": "^0.7.1", + "classnames": "^2.5.1", + "clsx": "^2.1.1", + "date-fns": "^4.1.0", + "dotenv": "^16.5.0", + "framer-motion": "^12.9.7", + "happy-dom": "^18.0.1", + "lexical": "^0.32.1", + "lucide-react": "^0.507.0", + "mermaid": "^11.7.0", + "next": "^15.4.2-canary.44", + "next-auth": "^5.0.0-beta.29", + "next-themes": "^0.4.6", + "postcss": "^8.5.3", + "posthog-js": "^1.261.6", + "react": "^19.1.1", + "react-diff-view": "^3.3.1", + "react-dom": "^19.1.1", + "react-markdown": "^10.1.0", + "react-syntax-highlighter": "^15.6.1", + "recharts": "^3.2.1", + "rehype-raw": "^7.0.0", + "rehype-sanitize": "^6.0.0", + "remark-gfm": "^4.0.1", + "sonner": "^2.0.3", + "storybook": "8.6.14", + "stripe": "^18.2.1", + "swr": "^2.3.3", + "tailwind-merge": "^3.2.0", + "tailwindcss": "^4.1.13", + "tailwindcss-animate": "^1.0.7", + "unist-util-visit": "^5.0.0", + "usehooks-ts": "^3.1.1", + "vite-plugin-inspect": "^11.1.0", + "vite-plugin-node-polyfills": "^0.24.0", + "zod": "^3.25.23", + }, + "peerDependencies": { + "typescript": "^5", + }, + }, "packages/slack": { "name": "@blink-sdk/slack", "version": "1.1.2", @@ -248,11 +404,11 @@ "packages": { "7zip-bin": ["7zip-bin@5.2.0", "", {}, "sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A=="], - "@adobe/css-tools": ["@adobe/css-tools@4.3.3", "", {}, "sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ=="], + "@adobe/css-tools": ["@adobe/css-tools@4.4.4", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="], "@ai-sdk/anthropic": ["@ai-sdk/anthropic@2.0.23", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.10" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ZEBiiv1UhjGjBwUU63pFhLK5LCSlNDb1idY9K1oZHm5/Fda1cuTojf32tOp0opH0RPbPAN/F8fyyNjbU33n9Kw=="], - "@ai-sdk/gateway": ["@ai-sdk/gateway@2.0.9", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.17", "@vercel/oidc": "3.0.3" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-E6x4h5CPPPJ0za1r5HsLtHbeI+Tp3H+YFtcH8G3dSSPFE6w+PZINzB4NxLZmg1QqSeA5HTP3ZEzzsohp0o2GEw=="], + "@ai-sdk/gateway": ["@ai-sdk/gateway@2.0.15", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.17", "@vercel/oidc": "3.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-i1YVKzC1dg9LGvt+GthhD7NlRhz9J4+ZRj3KELU14IZ/MHPsOBiFeEoCCIDLR+3tqT8/+5nIsK3eZ7DFRfMfdw=="], "@ai-sdk/google": ["@ai-sdk/google@2.0.17", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.10" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-6LyuUrCZuiULg0rUV+kT4T2jG19oUntudorI4ttv1ARkSbwl8A39ue3rA487aDDy6fUScdbGFiV5Yv/o4gidVA=="], @@ -274,8 +430,12 @@ "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], + "@antfu/install-pkg": ["@antfu/install-pkg@1.1.0", "", { "dependencies": { "package-manager-detector": "^1.3.0", "tinyexec": "^1.0.1" } }, "sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ=="], + "@antfu/utils": ["@antfu/utils@8.1.1", "", {}, "sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ=="], + "@auth/core": ["@auth/core@0.39.1", "", { "dependencies": { "@panva/hkdf": "^1.2.1", "jose": "^6.0.6", "oauth4webapi": "^3.3.0", "preact": "10.24.3", "preact-render-to-string": "6.5.11" }, "peerDependencies": { "@simplewebauthn/browser": "^9.0.1", "@simplewebauthn/server": "^9.0.2", "nodemailer": "^6.8.0" }, "optionalPeers": ["@simplewebauthn/browser", "@simplewebauthn/server", "nodemailer"] }, "sha512-McD8slui0oOA1pjR5sPjLPl5Zm//nLP/8T3kr8hxIsvNLvsiudYvPHhDFPjh1KcZ2nFxCkZmP6bRxaaPd/AnLA=="], + "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="], "@aws-crypto/crc32c": ["@aws-crypto/crc32c@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-+iWb8qaHLYKrNvGRbiYRHSdKRWhto5XlZUEBwDjYNf+ly5SVYG6zEoYIdxvf5R3zyeP16w4PLBn3rH1xc74Rag=="], @@ -360,16 +520,36 @@ "@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], + "@babel/compat-data": ["@babel/compat-data@7.28.5", "", {}, "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA=="], + + "@babel/core": ["@babel/core@7.28.5", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.28.3", "@babel/helpers": "^7.28.4", "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw=="], + "@babel/generator": ["@babel/generator@7.28.3", "", { "dependencies": { "@babel/parser": "^7.28.3", "@babel/types": "^7.28.2", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw=="], + "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.27.2", "", { "dependencies": { "@babel/compat-data": "^7.27.2", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ=="], + + "@babel/helper-globals": ["@babel/helper-globals@7.28.0", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="], + + "@babel/helper-module-imports": ["@babel/helper-module-imports@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w=="], + + "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.28.3", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1", "@babel/traverse": "^7.28.3" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw=="], + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="], + "@babel/helper-validator-option": ["@babel/helper-validator-option@7.27.1", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="], + + "@babel/helpers": ["@babel/helpers@7.28.4", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.28.4" } }, "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w=="], + "@babel/parser": ["@babel/parser@7.28.4", "", { "dependencies": { "@babel/types": "^7.28.4" }, "bin": "./bin/babel-parser.js" }, "sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg=="], "@babel/runtime": ["@babel/runtime@7.28.4", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="], + "@babel/template": ["@babel/template@7.27.2", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", "@babel/types": "^7.27.1" } }, "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw=="], + + "@babel/traverse": ["@babel/traverse@7.28.5", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", "@babel/types": "^7.28.5", "debug": "^4.3.1" } }, "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ=="], + "@babel/types": ["@babel/types@7.28.4", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q=="], "@biomejs/biome": ["@biomejs/biome@2.3.2", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.3.2", "@biomejs/cli-darwin-x64": "2.3.2", "@biomejs/cli-linux-arm64": "2.3.2", "@biomejs/cli-linux-arm64-musl": "2.3.2", "@biomejs/cli-linux-x64": "2.3.2", "@biomejs/cli-linux-x64-musl": "2.3.2", "@biomejs/cli-win32-arm64": "2.3.2", "@biomejs/cli-win32-x64": "2.3.2" }, "bin": { "biome": "bin/biome" } }, "sha512-8e9tzamuDycx7fdrcJ/F/GDZ8SYukc5ud6tDicjjFqURKYFSWMl0H0iXNXZEGmcmNUmABgGuHThPykcM41INgg=="], @@ -406,18 +586,58 @@ "@blink-sdk/slack": ["@blink-sdk/slack@workspace:packages/slack"], - "@blink.so/api": ["@blink.so/api@0.0.11", "", { "optionalDependencies": { "@blink-sdk/compute-protocol": ">= 0.0.2" }, "peerDependencies": { "ai": ">= 5", "react": ">= 18", "zod": ">= 4" }, "optionalPeers": ["react"] }, "sha512-4JW0fsGFn8IN5r+FpdbkqXkFqyCXQ8sDXoETdIBczLe3/+JP0Q2ItvN9XtR/eLNIshIL9Yz+gZtB6AVWQIcIWg=="], + "@blink.so/api": ["@blink.so/api@workspace:packages/api"], + + "@blink.so/billing": ["@blink.so/billing@workspace:packages/billing"], + + "@blink.so/database": ["@blink.so/database@workspace:packages/database"], + + "@blink.so/runtime": ["@blink.so/runtime@workspace:packages/runtime"], + + "@blink.so/site": ["@blink.so/site@workspace:packages/site"], "@blink/desktop": ["@blink/desktop@workspace:packages/desktop"], "@borewit/text-codec": ["@borewit/text-codec@0.1.1", "", {}, "sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA=="], + "@braintree/sanitize-url": ["@braintree/sanitize-url@7.1.1", "", {}, "sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw=="], + + "@bufbuild/protobuf": ["@bufbuild/protobuf@2.10.1", "", {}, "sha512-ckS3+vyJb5qGpEYv/s1OebUHDi/xSNtfgw1wqKZo7MR9F2z+qXr0q5XagafAG/9O0QPVIUfST0smluYSTpYFkg=="], + + "@chevrotain/cst-dts-gen": ["@chevrotain/cst-dts-gen@11.0.3", "", { "dependencies": { "@chevrotain/gast": "11.0.3", "@chevrotain/types": "11.0.3", "lodash-es": "4.17.21" } }, "sha512-BvIKpRLeS/8UbfxXxgC33xOumsacaeCKAjAeLyOn7Pcp95HiRbrpl14S+9vaZLolnbssPIUuiUd8IvgkRyt6NQ=="], + + "@chevrotain/gast": ["@chevrotain/gast@11.0.3", "", { "dependencies": { "@chevrotain/types": "11.0.3", "lodash-es": "4.17.21" } }, "sha512-+qNfcoNk70PyS/uxmj3li5NiECO+2YKZZQMbmjTqRI3Qchu8Hig/Q9vgkHpI3alNjr7M+a2St5pw5w5F6NL5/Q=="], + + "@chevrotain/regexp-to-ast": ["@chevrotain/regexp-to-ast@11.0.3", "", {}, "sha512-1fMHaBZxLFvWI067AVbGJav1eRY7N8DDvYCTwGBiE/ytKBgP8azTdgyrKyWZ9Mfh09eHWb5PgTSO8wi7U824RA=="], + + "@chevrotain/types": ["@chevrotain/types@11.0.3", "", {}, "sha512-gsiM3G8b58kZC2HaWR50gu6Y1440cHiJ+i3JUvcp/35JchYejb2+5MVeJK0iKThYpAa/P2PYFV4hoi44HD+aHQ=="], + + "@chevrotain/utils": ["@chevrotain/utils@11.0.3", "", {}, "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ=="], + "@clack/core": ["@clack/core@0.5.0", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow=="], "@clack/prompts": ["@clack/prompts@0.11.0", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="], + "@cloudflare/kv-asset-handler": ["@cloudflare/kv-asset-handler@0.4.1", "", { "dependencies": { "mime": "^3.0.0" } }, "sha512-Nu8ahitGFFJztxUml9oD/DLb7Z28C8cd8F46IVQ7y5Btz575pvMY8AqZsXkX7Gds29eCKdMgIHjIvzskHgPSFg=="], + + "@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.7.11", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": "^1.20251106.1" }, "optionalPeers": ["workerd"] }, "sha512-se23f1D4PxKrMKOq+Stz+Yn7AJ9ITHcEecXo2Yjb+UgbUDCEBch1FXQC6hx6uT5fNA3kmX3mfzeZiUmpK1W9IQ=="], + + "@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20251125.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-xDIVJi8fPxBseRoEIzLiUJb0N+DXnah/ynS+Unzn58HEoKLetUWiV/T1Fhned//lo5krnToG9KRgVRs0SOOTpw=="], + + "@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20251125.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-k5FQET5PXnWjeDqZUpl4Ah/Rn0bH6mjfUtTyeAy6ky7QB3AZpwIhgWQD0vOFB3OvJaK4J/K4cUtNChYXB9mY/A=="], + + "@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20251125.0", "", { "os": "linux", "cpu": "x64" }, "sha512-at6n/FomkftykWx0EqVLUZ0juUFz3ORtEPeBbW9ZZ3BQEyfVUtYfdcz/f1cN8Yyb7TE9ovF071P0mBRkx83ODw=="], + + "@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20251125.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-EiRn+jrNaIs1QveabXGHFoyn3s/l02ui6Yp3nssyNhtmtgviddtt8KObBfM1jQKjXTpZlunhwdN4Bxf4jhlOMw=="], + + "@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20251125.0", "", { "os": "win32", "cpu": "x64" }, "sha512-6fdIsSeu65g++k8Y2DKzNKs0BkoU+KKI6GAAVBOLh2vvVWWnCP1OgMdVb5JAdjDrjDT5i0GSQu0bgQ8fPsW6zw=="], + + "@cloudflare/workers-types": ["@cloudflare/workers-types@4.20251202.0", "", {}, "sha512-Q7m1Ivu2fbKalOPm00KLpu6GfRaq4TlrPknqugvZgp/gDH96OYKINO4x7jvCIBvCz/aK9vVoOj8tlbSQBervVA=="], + "@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="], + "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="], + "@daytonaio/api-client": ["@daytonaio/api-client@0.117.0", "", { "dependencies": { "axios": "^1.6.1" } }, "sha512-xXowLiOH6KXiQ83gQAlXCaNB6MV3FA8e3dYx4aUerxiWnSI2WO638LLvHrw6i4MsAfweRgIEdOtEuWEpZMJVBw=="], "@daytonaio/sdk": ["@daytonaio/sdk@0.117.0", "", { "dependencies": { "@aws-sdk/client-s3": "^3.787.0", "@aws-sdk/lib-storage": "^3.798.0", "@daytonaio/api-client": "0.117.0", "@daytonaio/toolbox-api-client": "0.117.0", "@iarna/toml": "^2.2.5", "axios": "^1.11.0", "busboy": "^1.0.0", "dotenv": "^17.0.1", "expand-tilde": "^2.0.2", "fast-glob": "^3.3.0", "form-data": "^4.0.4", "isomorphic-ws": "^5.0.0", "pathe": "^2.0.3", "shell-quote": "^1.8.2", "tar": "^6.2.0" } }, "sha512-Ub9ttABhDJRuz0j3irHCh6kwTfZ0hpDsbl5dBf8l37bZz2tYMhyUlacjBmKOnhoP+/a8NiXdTh2euI5i/U+RHw=="], @@ -426,6 +646,12 @@ "@develar/schema-utils": ["@develar/schema-utils@2.6.5", "", { "dependencies": { "ajv": "^6.12.0", "ajv-keywords": "^3.4.1" } }, "sha512-0cp4PsWQ/9avqTVMCtZ+GirikIA36ikvjtHweU4/j8yLtgObI0+JUPhYFScgwlteveGB1rt3Cm8UhN04XayDig=="], + "@discoveryjs/json-ext": ["@discoveryjs/json-ext@0.5.7", "", {}, "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw=="], + + "@drizzle-team/brocli": ["@drizzle-team/brocli@0.10.2", "", {}, "sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w=="], + + "@electric-sql/pglite": ["@electric-sql/pglite@0.3.2", "", {}, "sha512-zfWWa+V2ViDCY/cmUfRqeWY1yLto+EpxjXnZzenB1TyxsTiXaTWeZFIZw6mac52BsuQm0RjCnisjBtdBaXOI6w=="], + "@electron/asar": ["@electron/asar@3.2.18", "", { "dependencies": { "commander": "^5.0.0", "glob": "^7.1.6", "minimatch": "^3.0.4" }, "bin": { "asar": "bin/asar.js" } }, "sha512-2XyvMe3N3Nrs8cV39IKELRHTYUWFKrmqqSY1U+GMlc0jvqjIVnoxhNd2H4JolWQncbJi1DCvb5TNxZuI2fEjWg=="], "@electron/fuses": ["@electron/fuses@1.8.0", "", { "dependencies": { "chalk": "^4.1.1", "fs-extra": "^9.0.1", "minimist": "^1.2.5" }, "bin": { "electron-fuses": "dist/bin.js" } }, "sha512-zx0EIq78WlY/lBb1uXlziZmDZI4ubcCXIMJ4uGjXzZW0nS19TjSPeXPAjzzTmKQlJUZm0SbmZhPKP7tuQ1SsEw=="], @@ -446,7 +672,7 @@ "@electron/windows-sign": ["@electron/windows-sign@1.2.2", "", { "dependencies": { "cross-dirname": "^0.1.0", "debug": "^4.3.4", "fs-extra": "^11.1.1", "minimist": "^1.2.8", "postject": "^1.0.0-alpha.6" }, "bin": { "electron-windows-sign": "bin/electron-windows-sign.js" } }, "sha512-dfZeox66AvdPtb2lD8OsIIQh12Tp0GNCRUDfBHIKGpbmopZto2/A8nSpYYLoedPIHpqkeblZ/k8OV0Gy7PYuyQ=="], - "@emnapi/core": ["@emnapi/core@1.5.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg=="], + "@emnapi/core": ["@emnapi/core@1.7.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg=="], "@emnapi/runtime": ["@emnapi/runtime@1.5.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ=="], @@ -454,6 +680,10 @@ "@envelop/instrumentation": ["@envelop/instrumentation@1.0.0", "", { "dependencies": { "@whatwg-node/promise-helpers": "^1.2.1", "tslib": "^2.5.0" } }, "sha512-cxgkB66RQB95H3X27jlnxCRNTmPuSTgmBAq6/4n2Dtv4hsk4yz8FadA1ggmd0uZzvKqWD6CR+WFgTjhDqg7eyw=="], + "@esbuild-kit/core-utils": ["@esbuild-kit/core-utils@3.3.2", "", { "dependencies": { "esbuild": "~0.18.20", "source-map-support": "^0.5.21" } }, "sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ=="], + + "@esbuild-kit/esm-loader": ["@esbuild-kit/esm-loader@2.6.5", "", { "dependencies": { "@esbuild-kit/core-utils": "^3.3.2", "get-tsconfig": "^4.7.0" } }, "sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA=="], + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.0", "", { "os": "aix", "cpu": "ppc64" }, "sha512-KuZrd2hRjz01y5JK9mEBSD3Vj3mbCvemhT466rSuJYeE/hjuBrHfjjcjMdTm/sz7au+++sdbJZJmuBwQLuw68A=="], "@esbuild/android-arm": ["@esbuild/android-arm@0.27.0", "", { "os": "android", "cpu": "arm" }, "sha512-j67aezrPNYWJEOHUNLPj9maeJte7uSMM6gMoxfPC9hOg8N02JuQi/T7ewumf4tNvJadFkvLZMlAq73b9uwdMyQ=="], @@ -508,6 +738,16 @@ "@fastify/busboy": ["@fastify/busboy@3.2.0", "", {}, "sha512-m9FVDXU3GT2ITSe0UaMA5rU3QkfC/UXtCU8y0gSN/GugTqtVldOBWIB5V6V3sbmenVZUIpU6f+mPEO2+m5iTaA=="], + "@floating-ui/core": ["@floating-ui/core@1.7.3", "", { "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w=="], + + "@floating-ui/dom": ["@floating-ui/dom@1.7.4", "", { "dependencies": { "@floating-ui/core": "^1.7.3", "@floating-ui/utils": "^0.2.10" } }, "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA=="], + + "@floating-ui/react": ["@floating-ui/react@0.27.16", "", { "dependencies": { "@floating-ui/react-dom": "^2.1.6", "@floating-ui/utils": "^0.2.10", "tabbable": "^6.0.0" }, "peerDependencies": { "react": ">=17.0.0", "react-dom": ">=17.0.0" } }, "sha512-9O8N4SeG2z++TSM8QA/KTeKFBVCNEz/AGS7gWPJf6KFRzmRWixFRnCnkPHRDwSVZW6QPDO6uT0P2SpWNKCc9/g=="], + + "@floating-ui/react-dom": ["@floating-ui/react-dom@2.1.6", "", { "dependencies": { "@floating-ui/dom": "^1.7.4" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw=="], + + "@floating-ui/utils": ["@floating-ui/utils@0.2.10", "", {}, "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ=="], + "@gar/promisify": ["@gar/promisify@1.1.3", "", {}, "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw=="], "@google/gemini-cli-core": ["@jaaydenh/gemini-cli-core@0.11.0-nightly-20251022-2", "", { "dependencies": { "@google/genai": "1.16.0", "@joshua.litt/get-ripgrep": "^0.0.2", "@modelcontextprotocol/sdk": "^1.11.0", "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-logs-otlp-grpc": "^0.203.0", "@opentelemetry/exporter-logs-otlp-http": "^0.203.0", "@opentelemetry/exporter-metrics-otlp-grpc": "^0.203.0", "@opentelemetry/exporter-metrics-otlp-http": "^0.203.0", "@opentelemetry/exporter-trace-otlp-grpc": "^0.203.0", "@opentelemetry/exporter-trace-otlp-http": "^0.203.0", "@opentelemetry/instrumentation-http": "^0.203.0", "@opentelemetry/sdk-node": "^0.203.0", "@types/glob": "^8.1.0", "@types/html-to-text": "^9.0.4", "@xterm/headless": "5.5.0", "ajv": "^8.17.1", "ajv-formats": "^3.0.0", "chardet": "^2.1.0", "diff": "^7.0.0", "dotenv": "^17.1.0", "fast-levenshtein": "^2.0.6", "fast-uri": "^3.0.6", "fdir": "^6.4.6", "fzf": "^0.5.2", "glob": "^10.4.5", "google-auth-library": "^9.11.0", "html-to-text": "^9.0.5", "https-proxy-agent": "^7.0.6", "ignore": "^7.0.0", "marked": "^15.0.12", "mime": "4.0.7", "mnemonist": "^0.40.3", "open": "^10.1.2", "picomatch": "^4.0.1", "shell-quote": "^1.8.3", "simple-git": "^3.28.0", "strip-ansi": "^7.1.0", "undici": "^7.10.0", "ws": "^8.18.0" }, "optionalDependencies": { "@lydell/node-pty": "1.1.0", "@lydell/node-pty-darwin-arm64": "1.1.0", "@lydell/node-pty-darwin-x64": "1.1.0", "@lydell/node-pty-linux-x64": "1.1.0", "@lydell/node-pty-win32-arm64": "1.1.0", "@lydell/node-pty-win32-x64": "1.1.0", "node-pty": "^1.0.0" } }, "sha512-v8R8LaPjffxZJdRU4cXWMvpCpZPvFyj4mZJ63+ZKQJ+ZH92j3MGW+rmIajgq3U7euew5YGdIlNKik5OsHpIIEA=="], @@ -522,6 +762,60 @@ "@iarna/toml": ["@iarna/toml@2.2.5", "", {}, "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg=="], + "@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="], + + "@iconify/utils": ["@iconify/utils@3.1.0", "", { "dependencies": { "@antfu/install-pkg": "^1.1.0", "@iconify/types": "^2.0.0", "mlly": "^1.8.0" } }, "sha512-Zlzem1ZXhI1iHeeERabLNzBHdOa4VhQbqAcOQaMKuTuyZCpwKbC2R4Dd0Zo3g9EAc+Y4fiarO8HIHRAth7+skw=="], + + "@img/colour": ["@img/colour@1.0.0", "", {}, "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw=="], + + "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.0.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ=="], + + "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.0.4" }, "os": "darwin", "cpu": "x64" }, "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q=="], + + "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.0.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg=="], + + "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.0.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ=="], + + "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.0.5", "", { "os": "linux", "cpu": "arm" }, "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g=="], + + "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA=="], + + "@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.2.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA=="], + + "@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.2.4", "", { "os": "linux", "cpu": "none" }, "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA=="], + + "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.0.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA=="], + + "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw=="], + + "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA=="], + + "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw=="], + + "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.0.5" }, "os": "linux", "cpu": "arm" }, "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ=="], + + "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA=="], + + "@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.2.4" }, "os": "linux", "cpu": "ppc64" }, "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA=="], + + "@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.2.4" }, "os": "linux", "cpu": "none" }, "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw=="], + + "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.0.4" }, "os": "linux", "cpu": "s390x" }, "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q=="], + + "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA=="], + + "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g=="], + + "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw=="], + + "@img/sharp-wasm32": ["@img/sharp-wasm32@0.33.5", "", { "dependencies": { "@emnapi/runtime": "^1.2.0" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="], + + "@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.34.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g=="], + + "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.33.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ=="], + + "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.33.5", "", { "os": "win32", "cpu": "x64" }, "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg=="], + "@inquirer/ansi": ["@inquirer/ansi@1.0.2", "", {}, "sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ=="], "@inquirer/confirm": ["@inquirer/confirm@5.1.21", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ=="], @@ -544,6 +838,8 @@ "@joshua.litt/get-ripgrep": ["@joshua.litt/get-ripgrep@0.0.2", "", { "dependencies": { "@lvce-editor/verror": "^1.6.0", "execa": "^9.5.2", "extract-zip": "^2.0.1", "fs-extra": "^11.3.0", "got": "^14.4.5", "path-exists": "^5.0.0", "xdg-basedir": "^5.1.0" } }, "sha512-cSHA+H+HEkOXeiCxrNvGj/pgv2Y0bfp4GbH3R87zr7Vob2pDUZV3BkUL9ucHMoDFID4GteSy5z5niN/lF9QeuQ=="], + "@joshwooding/vite-plugin-react-docgen-typescript": ["@joshwooding/vite-plugin-react-docgen-typescript@0.5.0", "", { "dependencies": { "glob": "^10.0.0", "magic-string": "^0.27.0", "react-docgen-typescript": "^2.2.2" }, "peerDependencies": { "typescript": ">= 4.3.x", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["typescript"] }, "sha512-qYDdL7fPwLRI+bJNurVcis+tNgJmvWjH4YTBGXTA8xMuxFrnAz6E5o35iyzyKbq5J5Lr8mJGfrR5GXl+WGwhgQ=="], + "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], @@ -560,6 +856,48 @@ "@kwsites/promise-deferred": ["@kwsites/promise-deferred@1.1.1", "", {}, "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="], + "@lexical/clipboard": ["@lexical/clipboard@0.32.1", "", { "dependencies": { "@lexical/html": "0.32.1", "@lexical/list": "0.32.1", "@lexical/selection": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-oO7CuMVh3EFEqtE6+7Ccf7jMD5RNUmSdTnFm/X4kYNGqs9lgGt8j5PgSk7oP9OuAjxKNdBTbltSlh54CX3AUIg=="], + + "@lexical/code": ["@lexical/code@0.32.1", "", { "dependencies": { "@lexical/utils": "0.32.1", "lexical": "0.32.1", "prismjs": "^1.30.0" } }, "sha512-2rXj8s/CG32XKQ2EpORpACfpzyAxB+/SrQW2cjwczarLs5Fxnx6u6HwahZnxaF0z5UHIPUy90qDiOiRExc74Yg=="], + + "@lexical/devtools-core": ["@lexical/devtools-core@0.32.1", "", { "dependencies": { "@lexical/html": "0.32.1", "@lexical/link": "0.32.1", "@lexical/mark": "0.32.1", "@lexical/table": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" }, "peerDependencies": { "react": ">=17.x", "react-dom": ">=17.x" } }, "sha512-3WnZQo6Qig7ccjDu2b8s1Kb5CCXowxnK0i8CCRG9mHAw7i6XpZUYAbk4rmcK/qbhLHrc7LwUrAMFzGtfLEH3XA=="], + + "@lexical/dragon": ["@lexical/dragon@0.32.1", "", { "dependencies": { "lexical": "0.32.1" } }, "sha512-Dlx8P2b/O7gZLmXnoanmDkFL5RgA8Vvix4ZuSvT0apblqySzgi8l3NHHwwqXy1g2nfSupvpr7Dsf10Lu3l0Hlw=="], + + "@lexical/hashtag": ["@lexical/hashtag@0.32.1", "", { "dependencies": { "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-S63bb7uIB4hO2V0UmzUiKlwAGegQlyFKqrOw9NJwOb8O96gHRxr27FUsEb8ToWLM8TSm2aw1WsZXs7CJQqGtCg=="], + + "@lexical/history": ["@lexical/history@0.32.1", "", { "dependencies": { "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-IRsKllumYEWxmzR2evN30MFY+JBM723lSyzm2PAQcgHCeBxi8t0Vc3EdyJRay+YdN65JgrohQi1WbktbK923uQ=="], + + "@lexical/html": ["@lexical/html@0.32.1", "", { "dependencies": { "@lexical/selection": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-uctCdC9gVzx/Sw9CimT4C2IDfSbfEGYunyIrJBpsfcdqp0rroGNizjIoZNBH3xcgkk9UDboSADo+wimbzEoy8A=="], + + "@lexical/link": ["@lexical/link@0.32.1", "", { "dependencies": { "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-atdwNpWjZ0U2/kgS0ATTkZ8lJLHiv3TsJgqJL33BuV9Gn7advJokd4faM79Y8XxkhiPi1lVTBSHgI8V4hs+c+Q=="], + + "@lexical/list": ["@lexical/list@0.32.1", "", { "dependencies": { "@lexical/selection": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-3zShCfEdAvodR6mQ5CNN1gcEwfV341LXJzWCIkZzG1cPwaiBHUlT7TynQtKTPn1sATCEMmxoDG0/T+itsRNZgA=="], + + "@lexical/mark": ["@lexical/mark@0.32.1", "", { "dependencies": { "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-AXF2wmUvvSI45y+sgZKnU0pnUdttd9v75DDQgdplqtCkyDqHVGxVCNCrLE+PJtzIrwJxtA2UyC8yFZMBM92HpA=="], + + "@lexical/markdown": ["@lexical/markdown@0.32.1", "", { "dependencies": { "@lexical/code": "0.32.1", "@lexical/link": "0.32.1", "@lexical/list": "0.32.1", "@lexical/rich-text": "0.32.1", "@lexical/text": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-AmUTRRx6Je0AOiQqp48Xn92/71AzhFgi4nO1EtPW5eae1CihrtiEh5UQr48mV6EyjvH9D3OlOLU8XrzS+J9a+w=="], + + "@lexical/offset": ["@lexical/offset@0.32.1", "", { "dependencies": { "lexical": "0.32.1" } }, "sha512-zfHqoLlQ0lq1akFHy81xnDaRRE5KkqFa7OovOxKPBpALQCiJIAb2ykqj/Woc2oUeYaEcnkaFU9+kEWMK9yY0fQ=="], + + "@lexical/overflow": ["@lexical/overflow@0.32.1", "", { "dependencies": { "lexical": "0.32.1" } }, "sha512-wjcFGjzkbugds2Q5Wag59WrcxJwMUACEXms1FtFdu1/YcBPqNAKJSyfo8Z/5LGfstQEb2nPtSuEQZUb7v+XYyA=="], + + "@lexical/plain-text": ["@lexical/plain-text@0.32.1", "", { "dependencies": { "@lexical/clipboard": "0.32.1", "@lexical/selection": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-uFS3xoETB3phnYHZXfMKvl8gh6YRW7rpokuJmQVMHNNBklORmMpN00rRQ/zsc/jt/nPzaPpE5cLwSHXeJdqJUg=="], + + "@lexical/react": ["@lexical/react@0.32.1", "", { "dependencies": { "@floating-ui/react": "^0.27.8", "@lexical/devtools-core": "0.32.1", "@lexical/dragon": "0.32.1", "@lexical/hashtag": "0.32.1", "@lexical/history": "0.32.1", "@lexical/link": "0.32.1", "@lexical/list": "0.32.1", "@lexical/mark": "0.32.1", "@lexical/markdown": "0.32.1", "@lexical/overflow": "0.32.1", "@lexical/plain-text": "0.32.1", "@lexical/rich-text": "0.32.1", "@lexical/table": "0.32.1", "@lexical/text": "0.32.1", "@lexical/utils": "0.32.1", "@lexical/yjs": "0.32.1", "lexical": "0.32.1", "react-error-boundary": "^3.1.4" }, "peerDependencies": { "react": ">=17.x", "react-dom": ">=17.x" } }, "sha512-PCiAiwGIGfkYb2o9Kx+gGGqXwxqb7/W4cGSnw1nzmNtCerJ3S64WZs87Lgcow0RlDSwqzpH534+eCyIddueSqw=="], + + "@lexical/rich-text": ["@lexical/rich-text@0.32.1", "", { "dependencies": { "@lexical/clipboard": "0.32.1", "@lexical/selection": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-SnmpZ7boTLxeYfNezNLvchDiJOAALA2nD0Uq/SpkIOJ6R01R7m1aPdLv55LGKoBT9UxCRdo0HWXytwiVZI+ehQ=="], + + "@lexical/selection": ["@lexical/selection@0.32.1", "", { "dependencies": { "lexical": "0.32.1" } }, "sha512-X1aXJdq/5EOuSuMOqK3t+rEVmpqLf+vc2Kl5YuP8+gGWUbXuxR6iryrQuy1mAViZpF/5qw4HO/Sb+9JjubaZEg=="], + + "@lexical/table": ["@lexical/table@0.32.1", "", { "dependencies": { "@lexical/clipboard": "0.32.1", "@lexical/utils": "0.32.1", "lexical": "0.32.1" } }, "sha512-sGk2jUbQHj5hatpxRyl6IE2oWsjRnYhmaP94THzn95/uK69o8eSizcnd148WzYsX8Zz+L9PTLS1xjvCbfLTP+A=="], + + "@lexical/text": ["@lexical/text@0.32.1", "", { "dependencies": { "lexical": "0.32.1" } }, "sha512-0Ek8F3KC4d16b2YaTHdyYFqDSBZ5KRtGrqU3GBog+VOGxucGaEbXEK1/ypX5CTe/wwkQDrH0FKWPQbd3l5t5YQ=="], + + "@lexical/utils": ["@lexical/utils@0.32.1", "", { "dependencies": { "@lexical/list": "0.32.1", "@lexical/selection": "0.32.1", "@lexical/table": "0.32.1", "lexical": "0.32.1" } }, "sha512-ZaqZZksNIHJd+g8GXc11D1ESi8JzsdLVQZ+9odXVaNxtwDIaGIqMSccFyuZ9VSoJDde4JXZkgp/0PShbAZDkyw=="], + + "@lexical/yjs": ["@lexical/yjs@0.32.1", "", { "dependencies": { "@lexical/offset": "0.32.1", "@lexical/selection": "0.32.1", "lexical": "0.32.1" }, "peerDependencies": { "yjs": ">=13.5.22" } }, "sha512-VHGTg5z4wcDkPe8NnhzA5+CoOKJ5tVmTmMvoiZ91rtNUFQPxWRky88Gjt1e3yXldYp4pImNEgtAjlWqvaJBYGA=="], + "@lvce-editor/verror": ["@lvce-editor/verror@1.7.0", "", {}, "sha512-+LGuAEIC2L7pbvkyAQVWM2Go0dAy+UWEui28g07zNtZsCBhm+gusBK8PNwLJLV5Jay+TyUYuwLIbJdjLLzqEBg=="], "@lydell/node-pty": ["@lydell/node-pty@1.1.0", "", { "optionalDependencies": { "@lydell/node-pty-darwin-arm64": "1.1.0", "@lydell/node-pty-darwin-x64": "1.1.0", "@lydell/node-pty-linux-arm64": "1.1.0", "@lydell/node-pty-linux-x64": "1.1.0", "@lydell/node-pty-win32-arm64": "1.1.0", "@lydell/node-pty-win32-x64": "1.1.0" } }, "sha512-VDD8LtlMTOrPKWMXUAcB9+LTktzuunqrMwkYR1DMRBkS6LQrCt+0/Ws1o2rMml/n3guePpS7cxhHF7Nm5K4iMw=="], @@ -580,11 +918,35 @@ "@malept/flatpak-bundler": ["@malept/flatpak-bundler@0.4.0", "", { "dependencies": { "debug": "^4.1.1", "fs-extra": "^9.0.0", "lodash": "^4.17.15", "tmp-promise": "^3.0.2" } }, "sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q=="], + "@mermaid-js/parser": ["@mermaid-js/parser@0.6.3", "", { "dependencies": { "langium": "3.3.1" } }, "sha512-lnjOhe7zyHjc+If7yT4zoedx2vo4sHaTmtkl1+or8BRTnCtDmcTpAjpzDSfCZrshM5bCoz0GyidzadJAH1xobA=="], + "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.19.1", "", { "dependencies": { "ajv": "^6.12.6", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-3Y2h3MZKjec1eAqSTBclATlX+AbC6n1LgfVzRMJLt3v6w0RCYgwLrjbxPDbhsYHt6Wdqc/aCceNJYgj448ELQQ=="], "@mswjs/interceptors": ["@mswjs/interceptors@0.40.0", "", { "dependencies": { "@open-draft/deferred-promise": "^2.2.0", "@open-draft/logger": "^0.3.0", "@open-draft/until": "^2.0.0", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "strict-event-emitter": "^0.5.1" } }, "sha512-EFd6cVbHsgLa6wa4RljGj6Wk75qoHxUSyc5asLyyPSyuhIcdS2Q3Phw6ImS1q+CkALthJRShiYfKANcQMuMqsQ=="], - "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.0.7", "", { "dependencies": { "@emnapi/core": "^1.5.0", "@emnapi/runtime": "^1.5.0", "@tybys/wasm-util": "^0.10.1" } }, "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.0", "", { "dependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1", "@tybys/wasm-util": "^0.10.1" } }, "sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA=="], + + "@neondatabase/serverless": ["@neondatabase/serverless@1.0.2", "", { "dependencies": { "@types/node": "^22.15.30", "@types/pg": "^8.8.0" } }, "sha512-I5sbpSIAHiB+b6UttofhrN/UJXII+4tZPAq1qugzwCwLIL8EZLV7F/JyHUrEIiGgQpEXzpnjlJ+zwcEhheGvCw=="], + + "@next/bundle-analyzer": ["@next/bundle-analyzer@15.5.6", "", { "dependencies": { "webpack-bundle-analyzer": "4.10.1" } }, "sha512-IHeyk2s9/fVDAGDLNbBkCSG8XBabhuMajiaJggjsg4GyFIswh78DzLo5Nl5th8QTs3U/teYeczvfeV9w1Tx3qA=="], + + "@next/env": ["@next/env@15.5.6", "", {}, "sha512-3qBGRW+sCGzgbpc5TS1a0p7eNxnOarGVQhZxfvTdnV0gFI61lX7QNtQ4V1TSREctXzYn5NetbUsLvyqwLFJM6Q=="], + + "@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@15.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ES3nRz7N+L5Umz4KoGfZ4XX6gwHplwPhioVRc25+QNsDa7RtUF/z8wJcbuQ2Tffm5RZwuN2A063eapoJ1u4nPg=="], + + "@next/swc-darwin-x64": ["@next/swc-darwin-x64@15.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-JIGcytAyk9LQp2/nuVZPAtj8uaJ/zZhsKOASTjxDug0SPU9LAM3wy6nPU735M1OqacR4U20LHVF5v5Wnl9ptTA=="], + + "@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@15.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-qvz4SVKQ0P3/Im9zcS2RmfFL/UCQnsJKJwQSkissbngnB/12c6bZTCB0gHTexz1s6d/mD0+egPKXAIRFVS7hQg=="], + + "@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@15.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-FsbGVw3SJz1hZlvnWD+T6GFgV9/NYDeLTNQB2MXoPN5u9VA9OEDy6fJEfePfsUKAhJufFbZLgp0cPxMuV6SV0w=="], + + "@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@15.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-3QnHGFWlnvAgyxFxt2Ny8PTpXtQD7kVEeaFat5oPAHHI192WKYB+VIKZijtHLGdBBvc16tiAkPTDmQNOQ0dyrA=="], + + "@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@15.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-OsGX148sL+TqMK9YFaPFPoIaJKbFJJxFzkXZljIgA9hjMjdruKht6xDCEv1HLtlLNfkx3c5w2GLKhj7veBQizQ=="], + + "@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@15.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-ONOMrqWxdzXDJNh2n60H6gGyKed42Ieu6UTVPZteXpuKbLZTH4G4eBMsr5qWgOBA+s7F+uB4OJbZnrkEDnZ5Fg=="], + + "@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@15.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-pxK4VIjFRx1MY92UycLOOw7dTdvccWsNETQ0kDHkBlcFH1GrTLUjSiHU1ohrznnux6TqRHgv5oflhfIWZwVROQ=="], "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], @@ -808,6 +1170,48 @@ "@oxc-project/types": ["@oxc-project/types@0.94.0", "", {}, "sha512-+UgQT/4o59cZfH6Cp7G0hwmqEQ0wE+AdIwhikdwnhWI9Dp8CgSY081+Q3O67/wq3VJu8mgUEB93J9EHHn70fOw=="], + "@oxc-resolver/binding-android-arm-eabi": ["@oxc-resolver/binding-android-arm-eabi@11.14.2", "", { "os": "android", "cpu": "arm" }, "sha512-bTrdE4Z1JcGwPxBOaGbxRbpOHL8/xPVJTTq3/bAZO2euWX0X7uZ+XxsbC+5jUDMhLenqdFokgE1akHEU4xsh6A=="], + + "@oxc-resolver/binding-android-arm64": ["@oxc-resolver/binding-android-arm64@11.14.2", "", { "os": "android", "cpu": "arm64" }, "sha512-bL7/f6YGKUvt/wzpX7ZrHCf1QerotbSG+IIb278AklXuwr6yQdfQHt7KQ8hAWqSYpB2TAbPbAa9HE4wzVyxL9Q=="], + + "@oxc-resolver/binding-darwin-arm64": ["@oxc-resolver/binding-darwin-arm64@11.14.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-0zhMhqHz/kC6/UzMC4D9mVBz3/M9UTorbaULfHjAW5b8SUC08H01lZ5fR3OzfDbJI0ByLfiQZmbovuR/pJ8Wzg=="], + + "@oxc-resolver/binding-darwin-x64": ["@oxc-resolver/binding-darwin-x64@11.14.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-kRJBTCQnrGy1mjO+658yMrlGYWEKi6j4JvKt92PRCoeDX0vW4jvzgoJXzZXNxZL1pCY6jIdwsn9u53v4jwpR6g=="], + + "@oxc-resolver/binding-freebsd-x64": ["@oxc-resolver/binding-freebsd-x64@11.14.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-lpKiya7qPq5EAV5E16SJbxfhNYRCBZATGngn9mZxR2fMLDVbHISDIP2Br8eWA8M1FBJFsOGgBzxDo+42ySSNZQ=="], + + "@oxc-resolver/binding-linux-arm-gnueabihf": ["@oxc-resolver/binding-linux-arm-gnueabihf@11.14.2", "", { "os": "linux", "cpu": "arm" }, "sha512-zRIf49IGs4cE9rwpVM3NxlHWquZpwQLebtc9dY9S+4+B+PSLIP95BrzdRfkspwzWC5DKZsOWpvGQjxQiLoUwGA=="], + + "@oxc-resolver/binding-linux-arm-musleabihf": ["@oxc-resolver/binding-linux-arm-musleabihf@11.14.2", "", { "os": "linux", "cpu": "arm" }, "sha512-sF1fBrcfwoRkv1pR3Kp6D5MuBeHRPxYuzk9rhaun/50vq5nAMOaomkEm4hBbTSubfU86CoBIEbLUQ+1f7NvUVA=="], + + "@oxc-resolver/binding-linux-arm64-gnu": ["@oxc-resolver/binding-linux-arm64-gnu@11.14.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-O8iTBqz6oxf1k93Rn6WMGGQYo2jV1K81hq4N/Nke3dHE25EIEg2RKQqMz1dFrvVb2RkvD7QaUTEevbx0Lq+4wQ=="], + + "@oxc-resolver/binding-linux-arm64-musl": ["@oxc-resolver/binding-linux-arm64-musl@11.14.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-HOfzpS6eUxvdch9UlXCMx2kNJWMNBjUpVJhseqAKDB1dlrfCHgexeLyBX977GLXkq2BtNXKsY3KCryy1QhRSRw=="], + + "@oxc-resolver/binding-linux-ppc64-gnu": ["@oxc-resolver/binding-linux-ppc64-gnu@11.14.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-0uLG6F2zljUseQAUmlpx/9IdKpiLsSirpmrr8/aGVfiEurIJzC/1lo2HQskkM7e0VVOkXg37AjHUDLE23Fi8SA=="], + + "@oxc-resolver/binding-linux-riscv64-gnu": ["@oxc-resolver/binding-linux-riscv64-gnu@11.14.2", "", { "os": "linux", "cpu": "none" }, "sha512-Pdh0BH/E0YIK7Qg95IsAfQyU9rAoDoFh50R19zCTNfjSnwsoDMGHjmUc82udSfPo2YMnuxA+/+aglxmLQVSu2Q=="], + + "@oxc-resolver/binding-linux-riscv64-musl": ["@oxc-resolver/binding-linux-riscv64-musl@11.14.2", "", { "os": "linux", "cpu": "none" }, "sha512-3DLQhJ2r53rCH5cudYFqD7nh+Z6ABvld3GjbiqHhT43GMIPw3JcHekC2QunLRNjRr1G544fo1HtjTJz9rCBpyg=="], + + "@oxc-resolver/binding-linux-s390x-gnu": ["@oxc-resolver/binding-linux-s390x-gnu@11.14.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-G5BnAOQ5f+RUG1cvlJ4BvV+P7iKLYBv67snqgcfwD5b2N4UwJj32bt4H5JfolocWy4x3qUjEDWTIjHdE+2uZ9w=="], + + "@oxc-resolver/binding-linux-x64-gnu": ["@oxc-resolver/binding-linux-x64-gnu@11.14.2", "", { "os": "linux", "cpu": "x64" }, "sha512-VirQAX2PqKrhWtQGsSDEKlPhbgh3ggjT1sWuxLk4iLFwtyA2tLEPXJNAsG0kfAS2+VSA8OyNq16wRpQlMPZ4yA=="], + + "@oxc-resolver/binding-linux-x64-musl": ["@oxc-resolver/binding-linux-x64-musl@11.14.2", "", { "os": "linux", "cpu": "x64" }, "sha512-q4ORcwMkpzu4EhZyka/s2TuH2QklEHAr/mIQBXzu5BACeBJZIFkICp8qrq4XVnkEZ+XhSFTvBECqfMTT/4LSkA=="], + + "@oxc-resolver/binding-openharmony-arm64": ["@oxc-resolver/binding-openharmony-arm64@11.14.2", "", { "os": "none", "cpu": "arm64" }, "sha512-ZsMIpDCxSFpUM/TwOovX5vZUkV0IukPFnrKTGaeJRuTKXMcJxMiQGCYTwd6y684Y3j55QZqIMkVM9NdCGUX6Kw=="], + + "@oxc-resolver/binding-wasm32-wasi": ["@oxc-resolver/binding-wasm32-wasi@11.14.2", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.1.0" }, "cpu": "none" }, "sha512-Lvq5ZZNvSjT3Jq/buPFMtp55eNyGlEWsq30tN+yLOfODSo6T6yAJNs6+wXtqu9PiMj4xpVtgXypHtbQ1f+t7kw=="], + + "@oxc-resolver/binding-win32-arm64-msvc": ["@oxc-resolver/binding-win32-arm64-msvc@11.14.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-7w7WHSLSSmkkYHH52QF7TrO0Z8eaIjRUrre5M56hSWRAZupCRzADZxBVMpDnHobZ8MAa2kvvDEfDbERuOK/avQ=="], + + "@oxc-resolver/binding-win32-ia32-msvc": ["@oxc-resolver/binding-win32-ia32-msvc@11.14.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-hIrdlWa6tzqyfuWrxUetURBWHttBS+NMbBrGhCupc54NCXFy2ArB+0JOOaLYiI2ShKL5a3uqB7EWxmjzOuDdPQ=="], + + "@oxc-resolver/binding-win32-x64-msvc": ["@oxc-resolver/binding-win32-x64-msvc@11.14.2", "", { "os": "win32", "cpu": "x64" }, "sha512-dP9aV6AZRRpg5mlg0eMuTROtttpQwj3AiegNJ/NNmMSjs+0+aLNcgkWRPhskK3vjTsthH4/+kKLpnQhSxdJkNg=="], + + "@panva/hkdf": ["@panva/hkdf@1.2.1", "", {}, "sha512-6oclG6Y3PiDFcoyk8srjLfVKyMfVCKJ27JwNPViuXziFpmdz+MZnZN/aKY0JGXgYuO/VghU0jcOAZgWXZ1Dmrw=="], + "@parcel/watcher": ["@parcel/watcher@2.5.1", "", { "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", "micromatch": "^4.0.5", "node-addon-api": "^7.0.0" }, "optionalDependencies": { "@parcel/watcher-android-arm64": "2.5.1", "@parcel/watcher-darwin-arm64": "2.5.1", "@parcel/watcher-darwin-x64": "2.5.1", "@parcel/watcher-freebsd-x64": "2.5.1", "@parcel/watcher-linux-arm-glibc": "2.5.1", "@parcel/watcher-linux-arm-musl": "2.5.1", "@parcel/watcher-linux-arm64-glibc": "2.5.1", "@parcel/watcher-linux-arm64-musl": "2.5.1", "@parcel/watcher-linux-x64-glibc": "2.5.1", "@parcel/watcher-linux-x64-musl": "2.5.1", "@parcel/watcher-win32-arm64": "2.5.1", "@parcel/watcher-win32-ia32": "2.5.1", "@parcel/watcher-win32-x64": "2.5.1" } }, "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg=="], "@parcel/watcher-android-arm64": ["@parcel/watcher-android-arm64@2.5.1", "", { "os": "android", "cpu": "arm64" }, "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA=="], @@ -844,6 +1248,16 @@ "@pnpm/npm-conf": ["@pnpm/npm-conf@2.3.1", "", { "dependencies": { "@pnpm/config.env-replace": "^1.1.0", "@pnpm/network.ca-file": "^1.0.1", "config-chain": "^1.1.11" } }, "sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw=="], + "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], + + "@poppinss/colors": ["@poppinss/colors@4.1.5", "", { "dependencies": { "kleur": "^4.1.5" } }, "sha512-FvdDqtcRCtz6hThExcFOgW0cWX+xwSMWcRuQe5ZEb2m7cVQOAVZOIMt+/v9RxGiD9/OY16qJBXK4CVKWAPalBw=="], + + "@poppinss/dumper": ["@poppinss/dumper@0.6.5", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@sindresorhus/is": "^7.0.2", "supports-color": "^10.0.0" } }, "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw=="], + + "@poppinss/exception": ["@poppinss/exception@1.2.2", "", {}, "sha512-m7bpKCD4QMlFCjA/nKTs23fuvoVFoA83brRKmObCUNmi/9tVu8Ve3w4YQAnJu4q3Tjf5fr685HYIC/IA2zHRSg=="], + + "@posthog/core": ["@posthog/core@1.6.0", "", { "dependencies": { "cross-spawn": "^7.0.6" } }, "sha512-Tbh8UACwbb7jFdDC7wwXHtfNzO+4wKh3VbyMHmp2UBe6w1jliJixexTJNfkqdGZm+ht3M10mcKvGGPnoZ2zLBg=="], + "@protobufjs/aspromise": ["@protobufjs/aspromise@1.1.2", "", {}, "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="], "@protobufjs/base64": ["@protobufjs/base64@1.1.2", "", {}, "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="], @@ -868,28 +1282,52 @@ "@radix-ui/primitive": ["@radix-ui/primitive@1.1.3", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="], + "@radix-ui/react-alert-dialog": ["@radix-ui/react-alert-dialog@1.1.15", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dialog": "1.1.15", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-oTVLkEw5GpdRe29BqJ0LSDFWI3qu0vR1M0mUkOQWDIUnY/QIkLpgDMWuKxP94c2NAC2LGcgVhG1ImF3jkZ5wXw=="], + + "@radix-ui/react-arrow": ["@radix-ui/react-arrow@1.1.7", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w=="], + + "@radix-ui/react-checkbox": ["@radix-ui/react-checkbox@1.3.3", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-controllable-state": "1.2.2", "@radix-ui/react-use-previous": "1.1.1", "@radix-ui/react-use-size": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-wBbpv+NQftHDdG86Qc0pIyXk5IR3tM8Vd0nWLKDcX8nNn4nXFOFwsKuqw2okA/1D/mpaAkmuyndrPJTYDNZtFw=="], + + "@radix-ui/react-collection": ["@radix-ui/react-collection@1.1.7", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw=="], + "@radix-ui/react-compose-refs": ["@radix-ui/react-compose-refs@1.1.2", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg=="], "@radix-ui/react-context": ["@radix-ui/react-context@1.1.2", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA=="], "@radix-ui/react-dialog": ["@radix-ui/react-dialog@1.1.15", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-focus-guards": "1.1.3", "@radix-ui/react-focus-scope": "1.1.7", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-controllable-state": "1.2.2", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-TCglVRtzlffRNxRMEyR36DGBLJpeusFcgMVD9PZEzAKnUs1lKCgX5u9BmC2Yg+LL9MgZDugFFs1Vl+Jp4t/PGw=="], + "@radix-ui/react-direction": ["@radix-ui/react-direction@1.1.1", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw=="], + "@radix-ui/react-dismissable-layer": ["@radix-ui/react-dismissable-layer@1.1.11", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-escape-keydown": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg=="], + "@radix-ui/react-dropdown-menu": ["@radix-ui/react-dropdown-menu@2.1.16", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-menu": "2.1.16", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-controllable-state": "1.2.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-1PLGQEynI/3OX/ftV54COn+3Sud/Mn8vALg2rWnBLnRaGtJDduNW/22XjlGgPdpcIbiQxjKtb7BkcjP00nqfJw=="], + "@radix-ui/react-focus-guards": ["@radix-ui/react-focus-guards@1.1.3", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw=="], "@radix-ui/react-focus-scope": ["@radix-ui/react-focus-scope@1.1.7", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw=="], "@radix-ui/react-id": ["@radix-ui/react-id@1.1.1", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg=="], + "@radix-ui/react-menu": ["@radix-ui/react-menu@2.1.16", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-collection": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-direction": "1.1.1", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-focus-guards": "1.1.3", "@radix-ui/react-focus-scope": "1.1.7", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-popper": "1.2.8", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-roving-focus": "1.1.11", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-callback-ref": "1.1.1", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-72F2T+PLlphrqLcAotYPp0uJMr5SjP5SL01wfEspJbru5Zs5vQaSHb4VB3ZMJPimgHHCHG7gMOeOB9H3Hdmtxg=="], + + "@radix-ui/react-popper": ["@radix-ui/react-popper@1.2.8", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw=="], + "@radix-ui/react-portal": ["@radix-ui/react-portal@1.1.9", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ=="], "@radix-ui/react-presence": ["@radix-ui/react-presence@1.1.5", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ=="], "@radix-ui/react-primitive": ["@radix-ui/react-primitive@2.1.3", "", { "dependencies": { "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ=="], + "@radix-ui/react-roving-focus": ["@radix-ui/react-roving-focus@1.1.11", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-collection": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-direction": "1.1.1", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-controllable-state": "1.2.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA=="], + + "@radix-ui/react-separator": ["@radix-ui/react-separator@1.1.8", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-sDvqVY4itsKwwSMEe0jtKgfTh+72Sy3gPmQpjqcQneqQ4PFmr/1I0YA+2/puilhggCe2gJcx5EBAYFkWkdpa5g=="], + "@radix-ui/react-slot": ["@radix-ui/react-slot@1.2.3", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A=="], + "@radix-ui/react-tabs": ["@radix-ui/react-tabs@1.1.13", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-direction": "1.1.1", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-roving-focus": "1.1.11", "@radix-ui/react-use-controllable-state": "1.2.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-7xdcatg7/U+7+Udyoj2zodtI9H/IIopqo+YOIcZOq1nJwXWBZ9p8xiu5llXlekDbZkca79a/fozEYQXIA4sW6A=="], + + "@radix-ui/react-tooltip": ["@radix-ui/react-tooltip@1.2.8", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-popper": "1.2.8", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-controllable-state": "1.2.2", "@radix-ui/react-visually-hidden": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg=="], + "@radix-ui/react-use-callback-ref": ["@radix-ui/react-use-callback-ref@1.1.1", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg=="], "@radix-ui/react-use-controllable-state": ["@radix-ui/react-use-controllable-state@1.2.2", "", { "dependencies": { "@radix-ui/react-use-effect-event": "0.0.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg=="], @@ -900,6 +1338,20 @@ "@radix-ui/react-use-layout-effect": ["@radix-ui/react-use-layout-effect@1.1.1", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="], + "@radix-ui/react-use-previous": ["@radix-ui/react-use-previous@1.1.1", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-2dHfToCj/pzca2Ck724OZ5L0EVrr3eHRNsG/b3xQJLA2hZpVCS99bLAX+hm1IHXDEnzU6by5z/5MIY794/a8NQ=="], + + "@radix-ui/react-use-rect": ["@radix-ui/react-use-rect@1.1.1", "", { "dependencies": { "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w=="], + + "@radix-ui/react-use-size": ["@radix-ui/react-use-size@1.1.1", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ=="], + + "@radix-ui/react-visually-hidden": ["@radix-ui/react-visually-hidden@1.2.3", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-pzJq12tEaaIhqjbzpCuv/OypJY/BPavOofm+dbab+MHLajy277+1lLm6JFcGgF5eskJ6mquGirhXY2GD/8u8Ug=="], + + "@radix-ui/rect": ["@radix-ui/rect@1.1.1", "", {}, "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw=="], + + "@reduxjs/toolkit": ["@reduxjs/toolkit@2.11.0", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@standard-schema/utils": "^0.3.0", "immer": "^11.0.0", "redux": "^5.0.1", "redux-thunk": "^3.1.0", "reselect": "^5.1.0" }, "peerDependencies": { "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" }, "optionalPeers": ["react", "react-redux"] }, "sha512-hBjYg0aaRL1O2Z0IqWhnTLytnjDIxekmRxm1snsHjHaKVmIF1HiImWqsq+PuEbn6zdMlkIj9WofK1vR8jjx+Xw=="], + + "@remixicon/react": ["@remixicon/react@4.7.0", "", { "peerDependencies": { "react": ">=18.2.0" } }, "sha512-ODBQjdbOjnFguCqctYkpDjERXOInNaBnRPDKfZOBvbzExBAwr2BaH/6AHFTg/UAFzBDkwtylfMT8iKPAkLwPLQ=="], + "@rocicorp/lock": ["@rocicorp/lock@1.0.4", "", { "dependencies": { "@rocicorp/resolver": "^1.0.2" } }, "sha512-FavTiO8ETXFXDVfA87IThGduTTTR8iqzBnr/c60gUUmbk7knGEXPmf2B+yiNuluJD0ku0fL2V2r62UXnsLXl6w=="], "@rocicorp/resolver": ["@rocicorp/resolver@1.0.2", "", {}, "sha512-TfjMTQp9cNNqNtHFfa+XHEGdA7NnmDRu+ZJH4YF3dso0Xk/b9DMhg/sl+b6CR4ThFZArXXDsG1j8Mwl34wcOZQ=="], @@ -934,8 +1386,54 @@ "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.43", "", {}, "sha512-5Uxg7fQUCmfhax7FJke2+8B6cqgeUJUD9o2uXIKXhD+mG0mL6NObmVoi9wXEU1tY89mZKgAYA6fTbftx3q2ZPQ=="], + "@rollup/plugin-inject": ["@rollup/plugin-inject@5.0.5", "", { "dependencies": { "@rollup/pluginutils": "^5.0.1", "estree-walker": "^2.0.2", "magic-string": "^0.30.3" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-2+DEJbNBoPROPkgTDNe8/1YXWcqxbN5DTjASVIOx8HS+pITXushyNiBV56RB08zuptzz8gT3YfkqriTBVycepg=="], + "@rollup/pluginutils": ["@rollup/pluginutils@5.3.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.53.3", "", { "os": "android", "cpu": "arm" }, "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w=="], + + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.53.3", "", { "os": "android", "cpu": "arm64" }, "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w=="], + + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.53.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA=="], + + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.53.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ=="], + + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.53.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w=="], + + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.53.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q=="], + + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.53.3", "", { "os": "linux", "cpu": "arm" }, "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw=="], + + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.53.3", "", { "os": "linux", "cpu": "arm" }, "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg=="], + + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.53.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w=="], + + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.53.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A=="], + + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.53.3", "", { "os": "linux", "cpu": "none" }, "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g=="], + + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.53.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw=="], + + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.53.3", "", { "os": "linux", "cpu": "none" }, "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g=="], + + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.53.3", "", { "os": "linux", "cpu": "none" }, "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A=="], + + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.53.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg=="], + + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.53.3", "", { "os": "linux", "cpu": "x64" }, "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w=="], + + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.53.3", "", { "os": "linux", "cpu": "x64" }, "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q=="], + + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.53.3", "", { "os": "none", "cpu": "arm64" }, "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw=="], + + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.53.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw=="], + + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.53.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA=="], + + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.53.3", "", { "os": "win32", "cpu": "x64" }, "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg=="], + + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.53.3", "", { "os": "win32", "cpu": "x64" }, "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ=="], + "@sec-ant/readable-stream": ["@sec-ant/readable-stream@0.4.1", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="], "@selderee/plugin-htmlparser2": ["@selderee/plugin-htmlparser2@0.11.0", "", { "dependencies": { "domhandler": "^5.0.3", "selderee": "^0.11.0" } }, "sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ=="], @@ -1058,10 +1556,50 @@ "@smithy/uuid": ["@smithy/uuid@1.1.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-4aUIteuyxtBUhVdiQqcDhKFitwfd9hqoSDYY2KRXiWtgoWJ9Bmise+KfEPDiVHWeJepvF8xJO9/9+WDIciMFFw=="], + "@speed-highlight/core": ["@speed-highlight/core@1.2.12", "", {}, "sha512-uilwrK0Ygyri5dToHYdZSjcvpS2ZwX0w5aSt3GCEN9hrjxWCoeV4Z2DTXuxjwbntaLQIEEAlCeNQss5SoHvAEA=="], + "@standard-schema/spec": ["@standard-schema/spec@1.0.0", "", {}, "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA=="], + "@standard-schema/utils": ["@standard-schema/utils@0.3.0", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="], + + "@storybook/builder-vite": ["@storybook/builder-vite@8.6.14", "", { "dependencies": { "@storybook/csf-plugin": "8.6.14", "browser-assert": "^1.2.1", "ts-dedent": "^2.0.0" }, "peerDependencies": { "storybook": "^8.6.14", "vite": "^4.0.0 || ^5.0.0 || ^6.0.0" } }, "sha512-ajWYhy32ksBWxwWHrjwZzyC0Ii5ZTeu5lsqA95Q/EQBB0P5qWlHWGM3AVyv82Mz/ND03ebGy123uVwgf6olnYQ=="], + + "@storybook/components": ["@storybook/components@8.6.14", "", { "peerDependencies": { "storybook": "^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0" } }, "sha512-HNR2mC5I4Z5ek8kTrVZlIY/B8gJGs5b3XdZPBPBopTIN6U/YHXiDyOjY3JlaS4fSG1fVhp/Qp1TpMn1w/9m1pw=="], + + "@storybook/core": ["@storybook/core@8.6.14", "", { "dependencies": { "@storybook/theming": "8.6.14", "better-opn": "^3.0.2", "browser-assert": "^1.2.1", "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0 || ^0.24.0 || ^0.25.0", "esbuild-register": "^3.5.0", "jsdoc-type-pratt-parser": "^4.0.0", "process": "^0.11.10", "recast": "^0.23.5", "semver": "^7.6.2", "util": "^0.12.5", "ws": "^8.2.3" }, "peerDependencies": { "prettier": "^2 || ^3" }, "optionalPeers": ["prettier"] }, "sha512-1P/w4FSNRqP8j3JQBOi3yGt8PVOgSRbP66Ok520T78eJBeqx9ukCfl912PQZ7SPbW3TIunBwLXMZOjZwBB/JmA=="], + + "@storybook/csf-plugin": ["@storybook/csf-plugin@8.6.14", "", { "dependencies": { "unplugin": "^1.3.1" }, "peerDependencies": { "storybook": "^8.6.14" } }, "sha512-dErtc9teAuN+eelN8FojzFE635xlq9cNGGGEu0WEmMUQ4iJ8pingvBO1N8X3scz4Ry7KnxX++NNf3J3gpxS8qQ=="], + + "@storybook/experimental-nextjs-vite": ["@storybook/experimental-nextjs-vite@8.6.14", "", { "dependencies": { "@storybook/builder-vite": "8.6.14", "@storybook/react": "8.6.14", "@storybook/react-vite": "8.6.14", "@storybook/test": "8.6.14", "styled-jsx": "5.1.6", "vite-plugin-storybook-nextjs": "^1.1.5" }, "optionalDependencies": { "sharp": "^0.33.3" }, "peerDependencies": { "next": "^14.1.0 || ^15.0.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "storybook": "^8.6.14", "vite": "^5.0.0 || ^6.0.0" } }, "sha512-U0wNQV0LLnz6OpMx3AmxxoqC9d2l3Jmmxce6KcJu71gwMzdZL4i0N4wOlFVz+iI3tCrIcJsGkYShcxeSpQpoRA=="], + + "@storybook/global": ["@storybook/global@5.0.0", "", {}, "sha512-FcOqPAXACP0I3oJ/ws6/rrPT9WGhu915Cg8D02a9YxLo0DE9zI+a9A5gRGvmQ09fiWPukqI8ZAEoQEdWUKMQdQ=="], + + "@storybook/instrumenter": ["@storybook/instrumenter@8.6.14", "", { "dependencies": { "@storybook/global": "^5.0.0", "@vitest/utils": "^2.1.1" }, "peerDependencies": { "storybook": "^8.6.14" } }, "sha512-iG4MlWCcz1L7Yu8AwgsnfVAmMbvyRSk700Mfy2g4c8y5O+Cv1ejshE1LBBsCwHgkuqU0H4R0qu4g23+6UnUemQ=="], + + "@storybook/manager-api": ["@storybook/manager-api@8.6.14", "", { "peerDependencies": { "storybook": "^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0" } }, "sha512-ez0Zihuy17udLbfHZQXkGqwtep0mSGgHcNzGN7iZrMP1m+VmNo+7aGCJJdvXi7+iU3yq8weXSQFWg5DqWgLS7g=="], + + "@storybook/preview-api": ["@storybook/preview-api@8.6.14", "", { "peerDependencies": { "storybook": "^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0" } }, "sha512-2GhcCd4dNMrnD7eooEfvbfL4I83qAqEyO0CO7JQAmIO6Rxb9BsOLLI/GD5HkvQB73ArTJ+PT50rfaO820IExOQ=="], + + "@storybook/react": ["@storybook/react@8.6.14", "", { "dependencies": { "@storybook/components": "8.6.14", "@storybook/global": "^5.0.0", "@storybook/manager-api": "8.6.14", "@storybook/preview-api": "8.6.14", "@storybook/react-dom-shim": "8.6.14", "@storybook/theming": "8.6.14" }, "peerDependencies": { "@storybook/test": "8.6.14", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "storybook": "^8.6.14", "typescript": ">= 4.2.x" }, "optionalPeers": ["@storybook/test", "typescript"] }, "sha512-BOepx5bBFwl/CPI+F+LnmMmsG1wQYmrX/UQXgUbHQUU9Tj7E2ndTnNbpIuSLc8IrM03ru+DfwSg1Co3cxWtT+g=="], + + "@storybook/react-dom-shim": ["@storybook/react-dom-shim@8.6.14", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "storybook": "^8.6.14" } }, "sha512-0hixr3dOy3f3M+HBofp3jtMQMS+sqzjKNgl7Arfuj3fvjmyXOks/yGjDImySR4imPtEllvPZfhiQNlejheaInw=="], + + "@storybook/react-vite": ["@storybook/react-vite@8.6.14", "", { "dependencies": { "@joshwooding/vite-plugin-react-docgen-typescript": "0.5.0", "@rollup/pluginutils": "^5.0.2", "@storybook/builder-vite": "8.6.14", "@storybook/react": "8.6.14", "find-up": "^5.0.0", "magic-string": "^0.30.0", "react-docgen": "^7.0.0", "resolve": "^1.22.8", "tsconfig-paths": "^4.2.0" }, "peerDependencies": { "@storybook/test": "8.6.14", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", "storybook": "^8.6.14", "vite": "^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@storybook/test"] }, "sha512-FZU0xMPxa4/TO87FgcWwappOxLBHZV5HSRK5K+2bJD7rFJAoNorbHvB4Q1zvIAk7eCMjkr2GPCPHx9PRB9vJFg=="], + + "@storybook/test": ["@storybook/test@8.6.14", "", { "dependencies": { "@storybook/global": "^5.0.0", "@storybook/instrumenter": "8.6.14", "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "6.5.0", "@testing-library/user-event": "14.5.2", "@vitest/expect": "2.0.5", "@vitest/spy": "2.0.5" }, "peerDependencies": { "storybook": "^8.6.14" } }, "sha512-GkPNBbbZmz+XRdrhMtkxPotCLOQ1BaGNp/gFZYdGDk2KmUWBKmvc5JxxOhtoXM2703IzNFlQHSSNnhrDZYuLlw=="], + + "@storybook/theming": ["@storybook/theming@8.6.14", "", { "peerDependencies": { "storybook": "^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0" } }, "sha512-r4y+LsiB37V5hzpQo+BM10PaCsp7YlZ0YcZzQP1OCkPlYXmUAFy2VvDKaFRpD8IeNPKug2u4iFm/laDEbs03dg=="], + + "@stripe/react-stripe-js": ["@stripe/react-stripe-js@3.10.0", "", { "dependencies": { "prop-types": "^15.7.2" }, "peerDependencies": { "@stripe/stripe-js": ">=1.44.1 <8.0.0", "react": ">=16.8.0 <20.0.0", "react-dom": ">=16.8.0 <20.0.0" } }, "sha512-UPqHZwMwDzGSax0ZI7XlxR3tZSpgIiZdk3CiwjbTK978phwR/fFXeAXQcN/h8wTAjR4ZIAzdlI9DbOqJhuJdeg=="], + + "@stripe/stripe-js": ["@stripe/stripe-js@7.9.0", "", {}, "sha512-ggs5k+/0FUJcIgNY08aZTqpBTtbExkJMYMLSMwyucrhtWexVOEY1KJmhBsxf+E/Q15f5rbwBpj+t0t2AW2oCsQ=="], + + "@swc/helpers": ["@swc/helpers@0.5.15", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g=="], + "@szmarczak/http-timer": ["@szmarczak/http-timer@4.0.6", "", { "dependencies": { "defer-to-connect": "^2.0.0" } }, "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w=="], + "@tailwindcss/forms": ["@tailwindcss/forms@0.5.10", "", { "dependencies": { "mini-svg-data-uri": "^1.2.3" }, "peerDependencies": { "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20 || >= 4.0.0-beta.1" } }, "sha512-utI1ONF6uf/pPNO68kmN1b8rEwNXv3czukalo8VtJH8ksIkZXr3Q3VYudZLkCsDd4Wku120uF02hYK25XGPorw=="], + "@tailwindcss/node": ["@tailwindcss/node@4.1.14", "", { "dependencies": { "@jridgewell/remapping": "^2.3.4", "enhanced-resolve": "^5.18.3", "jiti": "^2.6.0", "lightningcss": "1.30.1", "magic-string": "^0.30.19", "source-map-js": "^1.2.1", "tailwindcss": "4.1.14" } }, "sha512-hpz+8vFk3Ic2xssIA3e01R6jkmsAhvkQdXlEbRTk6S10xDAtiQiM3FyvZVGsucefq764euO/b8WUW9ysLdThHw=="], "@tailwindcss/oxide": ["@tailwindcss/oxide@4.1.14", "", { "dependencies": { "detect-libc": "^2.0.4", "tar": "^7.5.1" }, "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.1.14", "@tailwindcss/oxide-darwin-arm64": "4.1.14", "@tailwindcss/oxide-darwin-x64": "4.1.14", "@tailwindcss/oxide-freebsd-x64": "4.1.14", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.14", "@tailwindcss/oxide-linux-arm64-gnu": "4.1.14", "@tailwindcss/oxide-linux-arm64-musl": "4.1.14", "@tailwindcss/oxide-linux-x64-gnu": "4.1.14", "@tailwindcss/oxide-linux-x64-musl": "4.1.14", "@tailwindcss/oxide-wasm32-wasi": "4.1.14", "@tailwindcss/oxide-win32-arm64-msvc": "4.1.14", "@tailwindcss/oxide-win32-x64-msvc": "4.1.14" } }, "sha512-23yx+VUbBwCg2x5XWdB8+1lkPajzLmALEfMb51zZUBYaYVPDQvBSD/WYDqiVyBIo2BZFa3yw1Rpy3G2Jp+K0dw=="], @@ -1092,6 +1630,16 @@ "@tailwindcss/postcss": ["@tailwindcss/postcss@4.1.14", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.1.14", "@tailwindcss/oxide": "4.1.14", "postcss": "^8.4.41", "tailwindcss": "4.1.14" } }, "sha512-BdMjIxy7HUNThK87C7BC8I1rE8BVUsfNQSI5siQ4JK3iIa3w0XyVvVL9SXLWO//CtYTcp1v7zci0fYwJOjB+Zg=="], + "@tailwindcss/typography": ["@tailwindcss/typography@0.5.19", "", { "dependencies": { "postcss-selector-parser": "6.0.10" }, "peerDependencies": { "tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1" } }, "sha512-w31dd8HOx3k9vPtcQh5QHP9GwKcgbMp87j58qi6xgiBnFFtKEAgCWnDw4qUT8aHwkCp8bKvb/KGKWWHedP0AAg=="], + + "@testing-library/dom": ["@testing-library/dom@10.4.0", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "chalk": "^4.1.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "pretty-format": "^27.0.2" } }, "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ=="], + + "@testing-library/jest-dom": ["@testing-library/jest-dom@6.5.0", "", { "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "chalk": "^3.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "lodash": "^4.17.21", "redent": "^3.0.0" } }, "sha512-xGGHpBXYSHUUr6XsKBfs85TWlYKpTc37cSBBVrXcib2MkHLboWlkClhWF37JKlDb9KEq3dHs+f2xR7XJEWGBxA=="], + + "@testing-library/react": ["@testing-library/react@16.3.0", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-kFSyxiEDwv1WLl2fgsq6pPBbw5aWKrsY2/noi1Id0TK0UParSF62oFQFGHXIyaG4pp2tEub/Zlel+fjjZILDsw=="], + + "@testing-library/user-event": ["@testing-library/user-event@14.5.2", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ=="], + "@tokenizer/inflate": ["@tokenizer/inflate@0.2.7", "", { "dependencies": { "debug": "^4.4.0", "fflate": "^0.8.2", "token-types": "^6.0.0" } }, "sha512-MADQgmZT1eKjp06jpI2yozxaU9uVs4GzzgSL+uEq7bVcJ9V1ZXQkeGNql1fsSI0gMy1vhvNTNbUqrx+pZfJVmg=="], "@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="], @@ -1100,8 +1648,18 @@ "@tybys/wasm-util": ["@tybys/wasm-util@0.10.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="], + "@types/aria-query": ["@types/aria-query@5.0.4", "", {}, "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw=="], + "@types/aws-lambda": ["@types/aws-lambda@8.10.152", "", {}, "sha512-soT/c2gYBnT5ygwiHPmd9a1bftj462NWVk2tKCc1PYHSIacB2UwbTS2zYG4jzag1mRDuzg/OjtxQjQ2NKRB6Rw=="], + "@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="], + + "@types/babel__generator": ["@types/babel__generator@7.27.0", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="], + + "@types/babel__template": ["@types/babel__template@7.4.4", "", { "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A=="], + + "@types/babel__traverse": ["@types/babel__traverse@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="], + "@types/body-parser": ["@types/body-parser@1.19.6", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g=="], "@types/bun": ["@types/bun@1.2.23", "", { "dependencies": { "bun-types": "1.2.23" } }, "sha512-le8ueOY5b6VKYf19xT3McVbXqLqmxzPXHsQT/q9JHgikJ2X22wyTW3g3ohz2ZMnp7dod6aduIiq8A14Xyimm0A=="], @@ -1116,8 +1674,72 @@ "@types/connect": ["@types/connect@3.4.38", "", { "dependencies": { "@types/node": "*" } }, "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug=="], + "@types/d3": ["@types/d3@7.4.3", "", { "dependencies": { "@types/d3-array": "*", "@types/d3-axis": "*", "@types/d3-brush": "*", "@types/d3-chord": "*", "@types/d3-color": "*", "@types/d3-contour": "*", "@types/d3-delaunay": "*", "@types/d3-dispatch": "*", "@types/d3-drag": "*", "@types/d3-dsv": "*", "@types/d3-ease": "*", "@types/d3-fetch": "*", "@types/d3-force": "*", "@types/d3-format": "*", "@types/d3-geo": "*", "@types/d3-hierarchy": "*", "@types/d3-interpolate": "*", "@types/d3-path": "*", "@types/d3-polygon": "*", "@types/d3-quadtree": "*", "@types/d3-random": "*", "@types/d3-scale": "*", "@types/d3-scale-chromatic": "*", "@types/d3-selection": "*", "@types/d3-shape": "*", "@types/d3-time": "*", "@types/d3-time-format": "*", "@types/d3-timer": "*", "@types/d3-transition": "*", "@types/d3-zoom": "*" } }, "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww=="], + + "@types/d3-array": ["@types/d3-array@3.2.2", "", {}, "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw=="], + + "@types/d3-axis": ["@types/d3-axis@3.0.6", "", { "dependencies": { "@types/d3-selection": "*" } }, "sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw=="], + + "@types/d3-brush": ["@types/d3-brush@3.0.6", "", { "dependencies": { "@types/d3-selection": "*" } }, "sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A=="], + + "@types/d3-chord": ["@types/d3-chord@3.0.6", "", {}, "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg=="], + + "@types/d3-color": ["@types/d3-color@3.1.3", "", {}, "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A=="], + + "@types/d3-contour": ["@types/d3-contour@3.0.6", "", { "dependencies": { "@types/d3-array": "*", "@types/geojson": "*" } }, "sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg=="], + + "@types/d3-delaunay": ["@types/d3-delaunay@6.0.4", "", {}, "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw=="], + + "@types/d3-dispatch": ["@types/d3-dispatch@3.0.7", "", {}, "sha512-5o9OIAdKkhN1QItV2oqaE5KMIiXAvDWBDPrD85e58Qlz1c1kI/J0NcqbEG88CoTwJrYe7ntUCVfeUl2UJKbWgA=="], + + "@types/d3-drag": ["@types/d3-drag@3.0.7", "", { "dependencies": { "@types/d3-selection": "*" } }, "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ=="], + + "@types/d3-dsv": ["@types/d3-dsv@3.0.7", "", {}, "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g=="], + + "@types/d3-ease": ["@types/d3-ease@3.0.2", "", {}, "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA=="], + + "@types/d3-fetch": ["@types/d3-fetch@3.0.7", "", { "dependencies": { "@types/d3-dsv": "*" } }, "sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA=="], + + "@types/d3-force": ["@types/d3-force@3.0.10", "", {}, "sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw=="], + + "@types/d3-format": ["@types/d3-format@3.0.4", "", {}, "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g=="], + + "@types/d3-geo": ["@types/d3-geo@3.1.0", "", { "dependencies": { "@types/geojson": "*" } }, "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ=="], + + "@types/d3-hierarchy": ["@types/d3-hierarchy@3.1.7", "", {}, "sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg=="], + + "@types/d3-interpolate": ["@types/d3-interpolate@3.0.4", "", { "dependencies": { "@types/d3-color": "*" } }, "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA=="], + + "@types/d3-path": ["@types/d3-path@3.1.1", "", {}, "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg=="], + + "@types/d3-polygon": ["@types/d3-polygon@3.0.2", "", {}, "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA=="], + + "@types/d3-quadtree": ["@types/d3-quadtree@3.0.6", "", {}, "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg=="], + + "@types/d3-random": ["@types/d3-random@3.0.3", "", {}, "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ=="], + + "@types/d3-scale": ["@types/d3-scale@4.0.9", "", { "dependencies": { "@types/d3-time": "*" } }, "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw=="], + + "@types/d3-scale-chromatic": ["@types/d3-scale-chromatic@3.1.0", "", {}, "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ=="], + + "@types/d3-selection": ["@types/d3-selection@3.0.11", "", {}, "sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w=="], + + "@types/d3-shape": ["@types/d3-shape@3.1.7", "", { "dependencies": { "@types/d3-path": "*" } }, "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg=="], + + "@types/d3-time": ["@types/d3-time@3.0.4", "", {}, "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g=="], + + "@types/d3-time-format": ["@types/d3-time-format@4.0.3", "", {}, "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg=="], + + "@types/d3-timer": ["@types/d3-timer@3.0.2", "", {}, "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw=="], + + "@types/d3-transition": ["@types/d3-transition@3.0.9", "", { "dependencies": { "@types/d3-selection": "*" } }, "sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg=="], + + "@types/d3-zoom": ["@types/d3-zoom@3.0.8", "", { "dependencies": { "@types/d3-interpolate": "*", "@types/d3-selection": "*" } }, "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw=="], + "@types/debug": ["@types/debug@4.1.12", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="], + "@types/doctrine": ["@types/doctrine@0.0.9", "", {}, "sha512-eOIHzCUSH7SMfonMG1LsC2f8vxBFtho6NGBznK41R84YzPuvSBzrhEps33IsQiOW9+VL6NQ9DbjQJznk/S4uRA=="], + "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], "@types/estree-jsx": ["@types/estree-jsx@1.0.5", "", { "dependencies": { "@types/estree": "*" } }, "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg=="], @@ -1128,6 +1750,8 @@ "@types/fs-extra": ["@types/fs-extra@9.0.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA=="], + "@types/geojson": ["@types/geojson@7946.0.16", "", {}, "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg=="], + "@types/glob": ["@types/glob@8.1.0", "", { "dependencies": { "@types/minimatch": "^5.1.2", "@types/node": "*" } }, "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w=="], "@types/gradient-string": ["@types/gradient-string@1.1.6", "", { "dependencies": { "@types/tinycolor2": "*" } }, "sha512-LkaYxluY4G5wR1M4AKQUal2q61Di1yVVCw42ImFTuaIoQVgmV0WP1xUaLB8zwb47mp82vWTpePI9JmrjEnJ7nQ=="], @@ -1180,6 +1804,8 @@ "@types/react-syntax-highlighter": ["@types/react-syntax-highlighter@15.5.13", "", { "dependencies": { "@types/react": "*" } }, "sha512-uLGJ87j6Sz8UaBAooU0T6lWJ0dBmjZgN1PZTrj05TNql2/XpC6+4HhMT5syIdFUUt+FASfCeLLv4kBygNU+8qA=="], + "@types/resolve": ["@types/resolve@1.20.6", "", {}, "sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ=="], + "@types/responselike": ["@types/responselike@1.0.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw=="], "@types/retry": ["@types/retry@0.12.0", "", {}, "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA=="], @@ -1196,12 +1822,18 @@ "@types/tinycolor2": ["@types/tinycolor2@1.4.6", "", {}, "sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw=="], + "@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="], + "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="], "@types/update-notifier": ["@types/update-notifier@6.0.8", "", { "dependencies": { "@types/configstore": "*", "boxen": "^7.1.1" } }, "sha512-IlDFnfSVfYQD+cKIg63DEXn3RFmd7W1iYtKQsJodcHK9R1yr8aKbKaPKfBxzPpcHCq2DU8zUq4PIPmy19Thjfg=="], + "@types/use-sync-external-store": ["@types/use-sync-external-store@0.0.6", "", {}, "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg=="], + "@types/verror": ["@types/verror@1.10.11", "", {}, "sha512-RlDm9K7+o5stv0Co8i8ZRGxDbrTxhJtgjqjFyVh/tXQyl/rYtTKlnTvZ88oSTeYREWurwx20Js4kTuKCsFkUtg=="], + "@types/whatwg-mimetype": ["@types/whatwg-mimetype@3.0.2", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], + "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], "@types/yauzl": ["@types/yauzl@2.10.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="], @@ -1224,7 +1856,17 @@ "@ungap/structured-clone": ["@ungap/structured-clone@1.3.0", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="], - "@vercel/oidc": ["@vercel/oidc@3.0.3", "", {}, "sha512-yNEQvPcVrK9sIe637+I0jD6leluPxzwJKx/Haw6F4H77CdDsszUn5V3o96LPziXkSNE2B83+Z3mjqGKBK/R6Gg=="], + "@vercel/oidc": ["@vercel/oidc@3.0.5", "", {}, "sha512-fnYhv671l+eTTp48gB4zEsTW/YtRgRPnkI2nT7x6qw5rkI1Lq2hTmQIpHPgyThI0znLK+vX2n9XxKdXZ7BUbbw=="], + + "@vitest/expect": ["@vitest/expect@2.0.5", "", { "dependencies": { "@vitest/spy": "2.0.5", "@vitest/utils": "2.0.5", "chai": "^5.1.1", "tinyrainbow": "^1.2.0" } }, "sha512-yHZtwuP7JZivj65Gxoi8upUN2OzHTi3zVfjwdpu2WrvCZPLwsJ2Ey5ILIPccoW23dd/zQBlJ4/dhi7DWNyXCpA=="], + + "@vitest/pretty-format": ["@vitest/pretty-format@2.1.9", "", { "dependencies": { "tinyrainbow": "^1.2.0" } }, "sha512-KhRIdGV2U9HOUzxfiHmY8IFHTdqtOhIzCpd8WRdJiE7D/HUcZVD0EgQCVjm+Q9gkUXWgBvMmTtZgIG48wq7sOQ=="], + + "@vitest/spy": ["@vitest/spy@2.0.5", "", { "dependencies": { "tinyspy": "^3.0.0" } }, "sha512-c/jdthAhvJdpfVuaexSrnawxZz6pywlTPe84LUB2m/4t3rl2fTo9NFGBG4oWgaD+FTgDDV8hJ/nibT7IfH3JfA=="], + + "@vitest/utils": ["@vitest/utils@2.1.9", "", { "dependencies": { "@vitest/pretty-format": "2.1.9", "loupe": "^3.1.2", "tinyrainbow": "^1.2.0" } }, "sha512-v0psaMSkNJ3A2NMrUEHFRzJtDPFn+/VWZ5WxImB21T9fjucJRmS7xCS3ppEnARb9y11OAzaD+P2Ps+b+BGX5iQ=="], + + "@welldone-software/why-did-you-render": ["@welldone-software/why-did-you-render@10.0.1", "", { "dependencies": { "lodash": "^4" }, "peerDependencies": { "react": "^19" } }, "sha512-tMgGkt30iVYeLMUKExNmtm019QgyjLtA7lwB0QAizYNEuihlCG2eoAWBBaz/bDeI7LeqAJ9msC6hY3vX+JB97g=="], "@whatwg-node/disposablestack": ["@whatwg-node/disposablestack@0.0.6", "", { "dependencies": { "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.6.3" } }, "sha512-LOtTn+JgJvX8WfBVJtF08TGrdjuFzGJc4mkP8EdDI8ADbvO7kiexYep1o8dwnt0okb0jYclCDXF13xU7Ge4zSw=="], @@ -1248,10 +1890,12 @@ "accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="], - "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="], "acorn-import-attributes": ["acorn-import-attributes@1.9.5", "", { "peerDependencies": { "acorn": "^8" } }, "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ=="], + "acorn-walk": ["acorn-walk@8.3.2", "", {}, "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A=="], + "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], "agentkeepalive": ["agentkeepalive@4.6.0", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="], @@ -1260,7 +1904,7 @@ "ai": ["ai@5.0.102", "", { "dependencies": { "@ai-sdk/gateway": "2.0.15", "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.17", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-snRK3nS5DESOjjpq7S74g8YszWVMzjagfHqlJWZsbtl9PyOS+2XUd8dt2wWg/jdaq/jh0aU66W1mx5qFjUQyEg=="], - "ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], + "ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="], @@ -1286,10 +1930,20 @@ "aria-hidden": ["aria-hidden@1.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="], + "aria-query": ["aria-query@5.3.0", "", { "dependencies": { "dequal": "^2.0.3" } }, "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A=="], + + "asn1.js": ["asn1.js@4.10.1", "", { "dependencies": { "bn.js": "^4.0.0", "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0" } }, "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw=="], + + "assert": ["assert@2.1.0", "", { "dependencies": { "call-bind": "^1.0.2", "is-nan": "^1.3.2", "object-is": "^1.1.5", "object.assign": "^4.1.4", "util": "^0.12.5" } }, "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw=="], + "assert-plus": ["assert-plus@1.0.0", "", {}, "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw=="], + "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], + "ast-kit": ["ast-kit@2.1.2", "", { "dependencies": { "@babel/parser": "^7.28.0", "pathe": "^2.0.3" } }, "sha512-cl76xfBQM6pztbrFWRnxbrDm9EOqDr1BF6+qQnnDZG2Co2LjyUktkN9GTJfBAfdae+DbT2nJf2nCGAdDDN7W2g=="], + "ast-types": ["ast-types@0.16.1", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg=="], + "astral-regex": ["astral-regex@2.0.0", "", {}, "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ=="], "async": ["async@3.2.6", "", {}, "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="], @@ -1306,6 +1960,10 @@ "autoprefixer": ["autoprefixer@10.4.21", "", { "dependencies": { "browserslist": "^4.24.4", "caniuse-lite": "^1.0.30001702", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "peerDependencies": { "postcss": "^8.1.0" }, "bin": { "autoprefixer": "bin/autoprefixer" } }, "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ=="], + "available-typed-arrays": ["available-typed-arrays@1.0.7", "", { "dependencies": { "possible-typed-array-names": "^1.0.0" } }, "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ=="], + + "aws4fetch": ["aws4fetch@1.0.20", "", {}, "sha512-/djoAN709iY65ETD6LKCtyyEI04XIBP5xVvfmNxsEP0uJB5tyaGBztSryRr4HqMStr9R06PisQE7m9zDTXKu6g=="], + "axios": ["axios@1.12.2", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.4", "proxy-from-env": "^1.1.0" } }, "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw=="], "b4a": ["b4a@1.7.3", "", { "peerDependencies": { "react-native-b4a": "*" }, "optionalPeers": ["react-native-b4a"] }, "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q=="], @@ -1320,28 +1978,56 @@ "baseline-browser-mapping": ["baseline-browser-mapping@2.8.12", "", { "bin": { "baseline-browser-mapping": "dist/cli.js" } }, "sha512-vAPMQdnyKCBtkmQA6FMCBvU9qFIppS3nzyXnEM+Lo2IAhG4Mpjv9cCxMudhgV3YdNNJv6TNqXy97dfRVL2LmaQ=="], + "bcrypt-ts": ["bcrypt-ts@7.1.0", "", {}, "sha512-t/Dqr9YzYmn/+oPQBgotBPUuezpZD5CPBwapM5Ep1p3zsLmEycMdXOfZpWbztSBWJ41DlB7EluJBUDsAGSiUeQ=="], + "before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="], + "better-opn": ["better-opn@3.0.2", "", { "dependencies": { "open": "^8.0.4" } }, "sha512-aVNobHnJqLiUelTaHat9DZ1qM2w0C0Eym4LPI/3JxOnSokGVdsl1T1kN7TFvsEAD8G47A6VKQ0TVHqbBnYMJlQ=="], + "bignumber.js": ["bignumber.js@9.3.1", "", {}, "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ=="], "birpc": ["birpc@2.6.1", "", {}, "sha512-LPnFhlDpdSH6FJhJyn4M0kFO7vtQ5iPw24FnG0y21q09xC7e8+1LeR31S1MAIrDAHp4m7aas4bEkTDTvMAtebQ=="], "bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="], + "blake3-wasm": ["blake3-wasm@2.1.5", "", {}, "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g=="], + "blink": ["blink@workspace:packages/blink"], + "blink-server": ["blink-server@workspace:packages/server"], + + "bn.js": ["bn.js@5.2.2", "", {}, "sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw=="], + "body-parser": ["body-parser@2.2.0", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.0", "http-errors": "^2.0.0", "iconv-lite": "^0.6.3", "on-finished": "^2.4.1", "qs": "^6.14.0", "raw-body": "^3.0.0", "type-is": "^2.0.0" } }, "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg=="], "boolean": ["boolean@3.2.0", "", {}, "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw=="], "bowser": ["bowser@2.13.0", "", {}, "sha512-yHAbSRuT6LTeKi6k2aS40csueHqgAsFEgmrOsfRyFpJnFv5O2hl9FYmWEUZ97gZ/dG17U4IQQcTx4YAFYPuWRQ=="], - "boxen": ["boxen@7.1.1", "", { "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^7.0.1", "chalk": "^5.2.0", "cli-boxes": "^3.0.0", "string-width": "^5.1.2", "type-fest": "^2.13.0", "widest-line": "^4.0.1", "wrap-ansi": "^8.1.0" } }, "sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog=="], + "boxen": ["boxen@8.0.1", "", { "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^8.0.0", "chalk": "^5.3.0", "cli-boxes": "^3.0.0", "string-width": "^7.2.0", "type-fest": "^4.21.0", "widest-line": "^5.0.0", "wrap-ansi": "^9.0.0" } }, "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw=="], "brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], + "brorand": ["brorand@1.1.0", "", {}, "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w=="], + + "browser-assert": ["browser-assert@1.2.1", "", {}, "sha512-nfulgvOR6S4gt9UKCeGJOuSGBPGiFT6oQ/2UBnvTY/5aQ1PnksW72fhZkM30DzoRRv2WpwZf1vHHEr3mtuXIWQ=="], + + "browser-resolve": ["browser-resolve@2.0.0", "", { "dependencies": { "resolve": "^1.17.0" } }, "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ=="], + + "browserify-aes": ["browserify-aes@1.2.0", "", { "dependencies": { "buffer-xor": "^1.0.3", "cipher-base": "^1.0.0", "create-hash": "^1.1.0", "evp_bytestokey": "^1.0.3", "inherits": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA=="], + + "browserify-cipher": ["browserify-cipher@1.0.1", "", { "dependencies": { "browserify-aes": "^1.0.4", "browserify-des": "^1.0.0", "evp_bytestokey": "^1.0.0" } }, "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w=="], + + "browserify-des": ["browserify-des@1.0.2", "", { "dependencies": { "cipher-base": "^1.0.1", "des.js": "^1.0.0", "inherits": "^2.0.1", "safe-buffer": "^5.1.2" } }, "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A=="], + + "browserify-rsa": ["browserify-rsa@4.1.1", "", { "dependencies": { "bn.js": "^5.2.1", "randombytes": "^2.1.0", "safe-buffer": "^5.2.1" } }, "sha512-YBjSAiTqM04ZVei6sXighu679a3SqWORA3qZTEqZImnlkDIFtKc6pNutpjyZ8RJTjQtuYfeetkxM11GwoYXMIQ=="], + + "browserify-sign": ["browserify-sign@4.2.5", "", { "dependencies": { "bn.js": "^5.2.2", "browserify-rsa": "^4.1.1", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "elliptic": "^6.6.1", "inherits": "^2.0.4", "parse-asn1": "^5.1.9", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1" } }, "sha512-C2AUdAJg6rlM2W5QMp2Q4KGQMVBwR1lIimTsUnutJ8bMpW5B52pGpR2gEnNBNwijumDo5FojQ0L9JrXA8m4YEw=="], + + "browserify-zlib": ["browserify-zlib@0.2.0", "", { "dependencies": { "pako": "~1.0.5" } }, "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA=="], + "browserslist": ["browserslist@4.26.3", "", { "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", "electron-to-chromium": "^1.5.227", "node-releases": "^2.0.21", "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-lAUU+02RFBuCKQPj/P6NgjlbCnLBMp4UtgTx7vNHd3XSIJF87s9a5rA3aH2yw3GS9DqZAUbOtZdCCiZeVRqt0w=="], "buffer": ["buffer@5.6.0", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" } }, "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw=="], @@ -1352,10 +2038,14 @@ "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], + "buffer-xor": ["buffer-xor@1.0.3", "", {}, "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ=="], + "builder-util": ["builder-util@26.0.11", "", { "dependencies": { "7zip-bin": "~5.2.0", "@types/debug": "^4.1.6", "app-builder-bin": "5.0.0-alpha.12", "builder-util-runtime": "9.3.1", "chalk": "^4.1.2", "cross-spawn": "^7.0.6", "debug": "^4.3.4", "fs-extra": "^10.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0", "is-ci": "^3.0.0", "js-yaml": "^4.1.0", "sanitize-filename": "^1.6.3", "source-map-support": "^0.5.19", "stat-mode": "^1.0.0", "temp-file": "^3.4.0", "tiny-async-pool": "1.3.0" } }, "sha512-xNjXfsldUEe153h1DraD0XvDOpqGR0L5eKFkdReB7eFW5HqysDZFfly4rckda6y9dF39N3pkPlOblcfHKGw+uA=="], "builder-util-runtime": ["builder-util-runtime@9.3.1", "", { "dependencies": { "debug": "^4.3.4", "sax": "^1.2.4" } }, "sha512-2/egrNDDnRaxVwK3A+cJq6UOlqOdedGA7JPqCeJjN2Zjk1/QB/6QUi3b714ScIGS7HafFXTyzJEOr5b44I3kvQ=="], + "builtin-status-codes": ["builtin-status-codes@3.0.0", "", {}, "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ=="], + "bun-types": ["bun-types@1.2.23", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw=="], "bundle-name": ["bundle-name@4.1.0", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="], @@ -1380,12 +2070,14 @@ "call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="], - "camelcase": ["camelcase@7.0.1", "", {}, "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw=="], + "camelcase": ["camelcase@8.0.0", "", {}, "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA=="], "caniuse-lite": ["caniuse-lite@1.0.30001748", "", {}, "sha512-5P5UgAr0+aBmNiplks08JLw+AW/XG/SurlgZLgB1dDLfAw7EfRGxIwzPHxdSCGY/BTKDqIVyJL87cCN6s0ZR0w=="], "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], + "chai": ["chai@5.3.3", "", { "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", "deep-eql": "^5.0.1", "loupe": "^3.1.0", "pathval": "^2.0.0" } }, "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw=="], + "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], "char-regex": ["char-regex@1.0.2", "", {}, "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="], @@ -1400,6 +2092,12 @@ "chardet": ["chardet@2.1.0", "", {}, "sha512-bNFETTG/pM5ryzQ9Ad0lJOTa6HWD/YsScAR3EnCPZRPlQh77JocYktSHOUHelyhm8IARL+o4c4F1bP5KVOjiRA=="], + "check-error": ["check-error@2.1.1", "", {}, "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw=="], + + "chevrotain": ["chevrotain@11.0.3", "", { "dependencies": { "@chevrotain/cst-dts-gen": "11.0.3", "@chevrotain/gast": "11.0.3", "@chevrotain/regexp-to-ast": "11.0.3", "@chevrotain/types": "11.0.3", "@chevrotain/utils": "11.0.3", "lodash-es": "4.17.21" } }, "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw=="], + + "chevrotain-allstar": ["chevrotain-allstar@0.3.1", "", { "dependencies": { "lodash-es": "^4.17.21" }, "peerDependencies": { "chevrotain": "^11.0.0" } }, "sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw=="], + "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], "chownr": ["chownr@2.0.0", "", {}, "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ=="], @@ -1408,10 +2106,14 @@ "ci-info": ["ci-info@3.9.0", "", {}, "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ=="], + "cipher-base": ["cipher-base@1.0.7", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.2" } }, "sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA=="], + "cjs-module-lexer": ["cjs-module-lexer@1.4.3", "", {}, "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q=="], "class-variance-authority": ["class-variance-authority@0.7.1", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="], + "classnames": ["classnames@2.5.1", "", {}, "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="], + "clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="], "cli-boxes": ["cli-boxes@3.0.0", "", {}, "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g=="], @@ -1428,6 +2130,8 @@ "cli-width": ["cli-width@4.1.0", "", {}, "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ=="], + "client-only": ["client-only@0.0.1", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="], + "cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], "clone": ["clone@1.0.4", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="], @@ -1438,10 +2142,14 @@ "code-excerpt": ["code-excerpt@4.0.0", "", { "dependencies": { "convert-to-spaces": "^2.0.1" } }, "sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA=="], + "color": ["color@4.2.3", "", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="], + "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], + "color-string": ["color-string@1.9.1", "", { "dependencies": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" } }, "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg=="], + "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="], "comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="], @@ -1466,10 +2174,16 @@ "consola": ["consola@3.4.2", "", {}, "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA=="], + "console-browserify": ["console-browserify@1.2.0", "", {}, "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="], + + "constants-browserify": ["constants-browserify@1.0.0", "", {}, "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ=="], + "content-disposition": ["content-disposition@1.0.0", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg=="], "content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="], + "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], + "convert-to-spaces": ["convert-to-spaces@2.0.1", "", {}, "sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ=="], "cookie": ["cookie@1.0.2", "", {}, "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA=="], @@ -1478,32 +2192,128 @@ "copy-anything": ["copy-anything@2.0.6", "", { "dependencies": { "is-what": "^3.14.1" } }, "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw=="], + "core-js": ["core-js@3.47.0", "", {}, "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg=="], + "core-util-is": ["core-util-is@1.0.2", "", {}, "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="], "cors": ["cors@2.8.5", "", { "dependencies": { "object-assign": "^4", "vary": "^1" } }, "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g=="], + "cose-base": ["cose-base@1.0.3", "", { "dependencies": { "layout-base": "^1.0.0" } }, "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg=="], + "crc": ["crc@3.8.0", "", { "dependencies": { "buffer": "^5.1.0" } }, "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ=="], + "create-ecdh": ["create-ecdh@4.0.4", "", { "dependencies": { "bn.js": "^4.1.0", "elliptic": "^6.5.3" } }, "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A=="], + + "create-hash": ["create-hash@1.2.0", "", { "dependencies": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", "md5.js": "^1.3.4", "ripemd160": "^2.0.1", "sha.js": "^2.4.0" } }, "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg=="], + + "create-hmac": ["create-hmac@1.1.7", "", { "dependencies": { "cipher-base": "^1.0.3", "create-hash": "^1.1.0", "inherits": "^2.0.1", "ripemd160": "^2.0.0", "safe-buffer": "^5.0.1", "sha.js": "^2.4.8" } }, "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg=="], + + "create-require": ["create-require@1.1.1", "", {}, "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="], + "cross-dirname": ["cross-dirname@0.1.0", "", {}, "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q=="], "cross-fetch": ["cross-fetch@4.1.0", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw=="], "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], + "crypto-browserify": ["crypto-browserify@3.12.1", "", { "dependencies": { "browserify-cipher": "^1.0.1", "browserify-sign": "^4.2.3", "create-ecdh": "^4.0.4", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "diffie-hellman": "^5.0.3", "hash-base": "~3.0.4", "inherits": "^2.0.4", "pbkdf2": "^3.1.2", "public-encrypt": "^4.0.3", "randombytes": "^2.1.0", "randomfill": "^1.0.4" } }, "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ=="], + + "css.escape": ["css.escape@1.5.1", "", {}, "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg=="], + "cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="], "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], "cwd": ["cwd@0.10.0", "", { "dependencies": { "find-pkg": "^0.1.2", "fs-exists-sync": "^0.1.0" } }, "sha512-YGZxdTTL9lmLkCUTpg4j0zQ7IhRB5ZmqNBbGCl3Tg6MP/d5/6sY7L5mmTjzbc6JKgVZYiqTQTNhPFsbXNGlRaA=="], - "date-fns": ["date-fns@2.30.0", "", { "dependencies": { "@babel/runtime": "^7.21.0" } }, "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw=="], + "cytoscape": ["cytoscape@3.33.1", "", {}, "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ=="], + + "cytoscape-cose-bilkent": ["cytoscape-cose-bilkent@4.1.0", "", { "dependencies": { "cose-base": "^1.0.0" }, "peerDependencies": { "cytoscape": "^3.2.0" } }, "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ=="], + + "cytoscape-fcose": ["cytoscape-fcose@2.2.0", "", { "dependencies": { "cose-base": "^2.2.0" }, "peerDependencies": { "cytoscape": "^3.2.0" } }, "sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ=="], + + "d3": ["d3@7.9.0", "", { "dependencies": { "d3-array": "3", "d3-axis": "3", "d3-brush": "3", "d3-chord": "3", "d3-color": "3", "d3-contour": "4", "d3-delaunay": "6", "d3-dispatch": "3", "d3-drag": "3", "d3-dsv": "3", "d3-ease": "3", "d3-fetch": "3", "d3-force": "3", "d3-format": "3", "d3-geo": "3", "d3-hierarchy": "3", "d3-interpolate": "3", "d3-path": "3", "d3-polygon": "3", "d3-quadtree": "3", "d3-random": "3", "d3-scale": "4", "d3-scale-chromatic": "3", "d3-selection": "3", "d3-shape": "3", "d3-time": "3", "d3-time-format": "4", "d3-timer": "3", "d3-transition": "3", "d3-zoom": "3" } }, "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA=="], + + "d3-array": ["d3-array@3.2.4", "", { "dependencies": { "internmap": "1 - 2" } }, "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg=="], + + "d3-axis": ["d3-axis@3.0.0", "", {}, "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw=="], + + "d3-brush": ["d3-brush@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "3", "d3-transition": "3" } }, "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ=="], + + "d3-chord": ["d3-chord@3.0.1", "", { "dependencies": { "d3-path": "1 - 3" } }, "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g=="], + + "d3-color": ["d3-color@3.1.0", "", {}, "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA=="], + + "d3-contour": ["d3-contour@4.0.2", "", { "dependencies": { "d3-array": "^3.2.0" } }, "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA=="], + + "d3-delaunay": ["d3-delaunay@6.0.4", "", { "dependencies": { "delaunator": "5" } }, "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A=="], + + "d3-dispatch": ["d3-dispatch@3.0.1", "", {}, "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg=="], + + "d3-drag": ["d3-drag@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-selection": "3" } }, "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg=="], + + "d3-dsv": ["d3-dsv@3.0.1", "", { "dependencies": { "commander": "7", "iconv-lite": "0.6", "rw": "1" }, "bin": { "csv2json": "bin/dsv2json.js", "csv2tsv": "bin/dsv2dsv.js", "dsv2dsv": "bin/dsv2dsv.js", "dsv2json": "bin/dsv2json.js", "json2csv": "bin/json2dsv.js", "json2dsv": "bin/json2dsv.js", "json2tsv": "bin/json2dsv.js", "tsv2csv": "bin/dsv2dsv.js", "tsv2json": "bin/dsv2json.js" } }, "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q=="], + + "d3-ease": ["d3-ease@3.0.1", "", {}, "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w=="], + + "d3-fetch": ["d3-fetch@3.0.1", "", { "dependencies": { "d3-dsv": "1 - 3" } }, "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw=="], + + "d3-force": ["d3-force@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-quadtree": "1 - 3", "d3-timer": "1 - 3" } }, "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg=="], + + "d3-format": ["d3-format@3.1.0", "", {}, "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA=="], + + "d3-geo": ["d3-geo@3.1.1", "", { "dependencies": { "d3-array": "2.5.0 - 3" } }, "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q=="], + + "d3-hierarchy": ["d3-hierarchy@3.1.2", "", {}, "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA=="], + + "d3-interpolate": ["d3-interpolate@3.0.1", "", { "dependencies": { "d3-color": "1 - 3" } }, "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g=="], + + "d3-path": ["d3-path@3.1.0", "", {}, "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ=="], + + "d3-polygon": ["d3-polygon@3.0.1", "", {}, "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg=="], + + "d3-quadtree": ["d3-quadtree@3.0.1", "", {}, "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw=="], + + "d3-random": ["d3-random@3.0.1", "", {}, "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ=="], + + "d3-sankey": ["d3-sankey@0.12.3", "", { "dependencies": { "d3-array": "1 - 2", "d3-shape": "^1.2.0" } }, "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ=="], + + "d3-scale": ["d3-scale@4.0.2", "", { "dependencies": { "d3-array": "2.10.0 - 3", "d3-format": "1 - 3", "d3-interpolate": "1.2.0 - 3", "d3-time": "2.1.1 - 3", "d3-time-format": "2 - 4" } }, "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ=="], + + "d3-scale-chromatic": ["d3-scale-chromatic@3.1.0", "", { "dependencies": { "d3-color": "1 - 3", "d3-interpolate": "1 - 3" } }, "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ=="], + + "d3-selection": ["d3-selection@3.0.0", "", {}, "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ=="], + + "d3-shape": ["d3-shape@3.2.0", "", { "dependencies": { "d3-path": "^3.1.0" } }, "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA=="], + + "d3-time": ["d3-time@3.1.0", "", { "dependencies": { "d3-array": "2 - 3" } }, "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q=="], + + "d3-time-format": ["d3-time-format@4.1.0", "", { "dependencies": { "d3-time": "1 - 3" } }, "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg=="], + + "d3-timer": ["d3-timer@3.0.1", "", {}, "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA=="], + + "d3-transition": ["d3-transition@3.0.1", "", { "dependencies": { "d3-color": "1 - 3", "d3-dispatch": "1 - 3", "d3-ease": "1 - 3", "d3-interpolate": "1 - 3", "d3-timer": "1 - 3" }, "peerDependencies": { "d3-selection": "2 - 3" } }, "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w=="], + + "d3-zoom": ["d3-zoom@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "2 - 3", "d3-transition": "2 - 3" } }, "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw=="], + + "dagre-d3-es": ["dagre-d3-es@7.0.13", "", { "dependencies": { "d3": "^7.9.0", "lodash-es": "^4.17.21" } }, "sha512-efEhnxpSuwpYOKRm/L5KbqoZmNNukHa/Flty4Wp62JRvgH2ojwVgPgdYyr4twpieZnyRDdIH7PY2mopX26+j2Q=="], + + "date-fns": ["date-fns@4.1.0", "", {}, "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="], + + "dayjs": ["dayjs@1.11.19", "", {}, "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw=="], + + "debounce": ["debounce@1.2.1", "", {}, "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug=="], "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + "decimal.js-light": ["decimal.js-light@2.5.1", "", {}, "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg=="], + "decode-named-character-reference": ["decode-named-character-reference@1.2.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q=="], "decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="], + "deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="], + "deep-extend": ["deep-extend@0.6.0", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="], "deepmerge": ["deepmerge@4.3.1", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="], @@ -1524,12 +2334,16 @@ "defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="], + "delaunator": ["delaunator@5.0.1", "", { "dependencies": { "robust-predicates": "^3.0.2" } }, "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw=="], + "delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="], "depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="], "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], + "des.js": ["des.js@1.1.0", "", { "dependencies": { "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0" } }, "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg=="], + "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], "detect-node": ["detect-node@2.1.0", "", {}, "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g=="], @@ -1540,18 +2354,30 @@ "diff": ["diff@8.0.2", "", {}, "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg=="], + "diff-match-patch": ["diff-match-patch@1.0.5", "", {}, "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw=="], + + "diffie-hellman": ["diffie-hellman@5.0.3", "", { "dependencies": { "bn.js": "^4.1.0", "miller-rabin": "^4.0.0", "randombytes": "^2.0.0" } }, "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg=="], + "dir-compare": ["dir-compare@4.2.0", "", { "dependencies": { "minimatch": "^3.0.5", "p-limit": "^3.1.0 " } }, "sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ=="], "dmg-builder": ["dmg-builder@26.0.12", "", { "dependencies": { "app-builder-lib": "26.0.12", "builder-util": "26.0.11", "builder-util-runtime": "9.3.1", "fs-extra": "^10.1.0", "iconv-lite": "^0.6.2", "js-yaml": "^4.1.0" }, "optionalDependencies": { "dmg-license": "^1.0.11" } }, "sha512-59CAAjAhTaIMCN8y9kD573vDkxbs1uhDcrFLHSgutYdPcGOU35Rf95725snvzEOy4BFB7+eLJ8djCNPmGwG67w=="], "dmg-license": ["dmg-license@1.0.11", "", { "dependencies": { "@types/plist": "^3.0.1", "@types/verror": "^1.10.3", "ajv": "^6.10.0", "crc": "^3.8.0", "iconv-corefoundation": "^1.1.7", "plist": "^3.0.4", "smart-buffer": "^4.0.2", "verror": "^1.10.0" }, "os": "darwin", "bin": { "dmg-license": "bin/dmg-license.js" } }, "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q=="], + "doctrine": ["doctrine@3.0.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w=="], + + "dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="], + "dom-serializer": ["dom-serializer@2.0.0", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="], + "domain-browser": ["domain-browser@4.22.0", "", {}, "sha512-IGBwjF7tNk3cwypFNH/7bfzBcgSCbaMOD3GsaY1AU/JRrnHnYgEM0+9kQt52iZxjNsjBtJYtao146V+f8jFZNw=="], + "domelementtype": ["domelementtype@2.3.0", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="], "domhandler": ["domhandler@5.0.3", "", { "dependencies": { "domelementtype": "^2.3.0" } }, "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w=="], + "dompurify": ["dompurify@3.3.0", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-r+f6MYR1gGN1eJv0TVQbhA7if/U7P87cdPl3HN5rikqaBSBxLiCb/b9O+2eG0cxz0ghyU+mU1QkbsOwERMYlWQ=="], + "domutils": ["domutils@3.2.2", "", { "dependencies": { "dom-serializer": "^2.0.0", "domelementtype": "^2.3.0", "domhandler": "^5.0.3" } }, "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw=="], "dot-prop": ["dot-prop@9.0.0", "", { "dependencies": { "type-fest": "^4.18.2" } }, "sha512-1gxPBJpI/pcjQhKgIU91II6Wkay+dLcN3M6rf2uwP8hRur3HtQXjVrdAK3sjC0piaEuxzMwjXChcETiJl47lAQ=="], @@ -1560,10 +2386,16 @@ "dotenv-expand": ["dotenv-expand@11.0.7", "", { "dependencies": { "dotenv": "^16.4.5" } }, "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA=="], + "drizzle-kit": ["drizzle-kit@0.31.7", "", { "dependencies": { "@drizzle-team/brocli": "^0.10.2", "@esbuild-kit/esm-loader": "^2.5.5", "esbuild": "^0.25.4", "esbuild-register": "^3.5.0" }, "bin": { "drizzle-kit": "bin.cjs" } }, "sha512-hOzRGSdyKIU4FcTSFYGKdXEjFsncVwHZ43gY3WU5Bz9j5Iadp6Rh6hxLSQ1IWXpKLBKt/d5y1cpSPcV+FcoQ1A=="], + + "drizzle-orm": ["drizzle-orm@0.44.7", "", { "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1.13", "@prisma/client": "*", "@tidbcloud/serverless": "*", "@types/better-sqlite3": "*", "@types/pg": "*", "@types/sql.js": "*", "@upstash/redis": ">=1.34.7", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "better-sqlite3": ">=7", "bun-types": "*", "expo-sqlite": ">=14.0.0", "gel": ">=2", "knex": "*", "kysely": "*", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", "sqlite3": ">=5" }, "optionalPeers": ["@aws-sdk/client-rds-data", "@cloudflare/workers-types", "@electric-sql/pglite", "@libsql/client", "@libsql/client-wasm", "@neondatabase/serverless", "@op-engineering/op-sqlite", "@opentelemetry/api", "@planetscale/database", "@prisma/client", "@tidbcloud/serverless", "@types/better-sqlite3", "@types/pg", "@types/sql.js", "@upstash/redis", "@vercel/postgres", "@xata.io/client", "better-sqlite3", "bun-types", "expo-sqlite", "gel", "knex", "kysely", "mysql2", "pg", "postgres", "sql.js", "sqlite3"] }, "sha512-quIpnYznjU9lHshEOAYLoZ9s3jweleHlZIAWR/jX9gAWNg/JhQ1wj0KGRf7/Zm+obRrYd9GjPVJg790QY9N5AQ=="], + "dts-resolver": ["dts-resolver@2.1.2", "", { "peerDependencies": { "oxc-resolver": ">=11.0.0" }, "optionalPeers": ["oxc-resolver"] }, "sha512-xeXHBQkn2ISSXxbJWD828PFjtyg+/UrMDo7W4Ffcs7+YWCquxU8YjV1KoxuiL+eJ5pg3ll+bC6flVv61L3LKZg=="], "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], + "duplexer": ["duplexer@0.1.2", "", {}, "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg=="], + "eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="], "ecdsa-sig-formatter": ["ecdsa-sig-formatter@1.0.11", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ=="], @@ -1584,6 +2416,8 @@ "electron-winstaller": ["electron-winstaller@5.4.0", "", { "dependencies": { "@electron/asar": "^3.2.1", "debug": "^4.1.1", "fs-extra": "^7.0.1", "lodash": "^4.17.21", "temp": "^0.9.0" }, "optionalDependencies": { "@electron/windows-sign": "^1.1.2" } }, "sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg=="], + "elliptic": ["elliptic@6.6.1", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "hash.js": "^1.0.0", "hmac-drbg": "^1.0.1", "inherits": "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], + "emittery": ["emittery@1.2.0", "", {}, "sha512-KxdRyyFcS85pH3dnU8Y5yFUm2YJdaHwcBZWrfG8o89ZY9a13/f9itbN+YG3ELbBo9Pg5zvIozstmuV8bX13q6g=="], "emoji-regex": ["emoji-regex@10.5.0", "", {}, "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg=="], @@ -1600,7 +2434,7 @@ "enhanced-resolve": ["enhanced-resolve@5.18.3", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" } }, "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww=="], - "entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], + "entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="], "env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="], @@ -1610,6 +2444,8 @@ "errno": ["errno@0.1.8", "", { "dependencies": { "prr": "~1.0.1" }, "bin": { "errno": "cli.js" } }, "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A=="], + "error-stack-parser-es": ["error-stack-parser-es@1.0.5", "", {}, "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA=="], + "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="], "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="], @@ -1626,18 +2462,24 @@ "esbuild-plugin-postcss2": ["esbuild-plugin-postcss2@0.1.2", "", { "dependencies": { "autoprefixer": "^10.2.5", "fs-extra": "^9.1.0", "less": "^4.x", "postcss": "8.x", "postcss-modules": "^4.0.0", "resolve-file": "^0.3.0", "sass": "^1.x", "stylus": "^0.x", "tmp": "^0.2.1" } }, "sha512-c+024wQrSDGrNKEhK9lrhYUIssdmqnPfcQPwOxnBOi667wZOshoKbdQ7w2a4slRN86AqLZYOkPsNMIvFH1sB8Q=="], + "esbuild-register": ["esbuild-register@3.6.0", "", { "dependencies": { "debug": "^4.3.4" }, "peerDependencies": { "esbuild": ">=0.12 <1" } }, "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg=="], + "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], "escape-goat": ["escape-goat@4.0.0", "", {}, "sha512-2Sd4ShcWxbx6OY1IHyla/CVNwvg7XwZVoXZHcSu9w9SReNP1EzzD5T8NWKIR38fIqEns9kDWKUQTXXAmlDrdPg=="], "escape-html": ["escape-html@1.0.3", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="], - "escape-string-regexp": ["escape-string-regexp@2.0.0", "", {}, "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w=="], + "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], + + "esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="], "estree-util-is-identifier-name": ["estree-util-is-identifier-name@3.0.0", "", {}, "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg=="], "estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="], + "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], + "etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="], "eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], @@ -1650,10 +2492,14 @@ "eventsource-parser": ["eventsource-parser@3.0.6", "", {}, "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg=="], + "evp_bytestokey": ["evp_bytestokey@1.0.3", "", { "dependencies": { "md5.js": "^1.3.4", "safe-buffer": "^5.1.1" } }, "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA=="], + "exa-js": ["exa-js@2.0.3", "", { "dependencies": { "cross-fetch": "~4.1.0", "dotenv": "~16.4.7", "openai": "^5.0.1", "zod": "^3.22.0", "zod-to-json-schema": "^3.20.0" } }, "sha512-21eDeo0RPWk7sApMfxKY3p4+d+UHP+5rV+R1SeGiGTPXKflretCyFB227WEZ/YbW9eLohRYT6HXwR7Pe17OzOg=="], "execa": ["execa@9.6.0", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-jpWzZ1ZhwUmeWRhS7Qv3mhpOhLfwI+uAX4e5fOcXqwMR7EcJ0pj2kV1CVzHVMX/LphnKWD3LObjZCoJ71lKpHw=="], + "exit-hook": ["exit-hook@2.2.1", "", {}, "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw=="], + "expand-tilde": ["expand-tilde@2.0.2", "", { "dependencies": { "homedir-polyfill": "^1.0.1" } }, "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw=="], "exponential-backoff": ["exponential-backoff@3.1.2", "", {}, "sha512-8QxYTVXUkuy7fIIoitQkPwGonB8F3Zj8eEO8Sqg9Zv/bkI7RJAzowee4gr81Hak/dUTpA2Z7VfQgoijjPNlUZA=="], @@ -1690,11 +2536,15 @@ "fault": ["fault@1.0.4", "", { "dependencies": { "format": "^0.2.0" } }, "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA=="], + "fd-package-json": ["fd-package-json@2.0.0", "", { "dependencies": { "walk-up-path": "^4.0.0" } }, "sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ=="], + "fd-slicer": ["fd-slicer@1.1.0", "", { "dependencies": { "pend": "~1.2.0" } }, "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g=="], "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], - "fflate": ["fflate@0.8.2", "", {}, "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="], + "fetch-to-node": ["fetch-to-node@2.1.0", "", {}, "sha512-Wq05j6LE1GrWpT2t1YbCkyFY6xKRJq3hx/oRJdWEJpZlik3g25MmdJS6RFm49iiMJw6zpZuBOrgihOgy2jGyAA=="], + + "fflate": ["fflate@0.4.8", "", {}, "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA=="], "figures": ["figures@6.1.0", "", { "dependencies": { "is-unicode-supported": "^2.0.0" } }, "sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg=="], @@ -1714,10 +2564,14 @@ "find-pkg": ["find-pkg@0.1.2", "", { "dependencies": { "find-file-up": "^0.1.2" } }, "sha512-0rnQWcFwZr7eO0513HahrWafsc3CTFioEB7DRiEYCUM/70QXSY8f3mCST17HXLcPvEhzH/Ty/Bxd72ZZsr/yvw=="], + "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], + "find-up-simple": ["find-up-simple@1.0.1", "", {}, "sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ=="], "follow-redirects": ["follow-redirects@1.15.11", "", {}, "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="], + "for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="], + "foreground-child": ["foreground-child@3.3.1", "", { "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" } }, "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw=="], "form-data": ["form-data@4.0.4", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.2", "mime-types": "^2.1.12" } }, "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow=="], @@ -1726,12 +2580,16 @@ "format": ["format@0.2.2", "", {}, "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww=="], + "formatly": ["formatly@0.3.0", "", { "dependencies": { "fd-package-json": "^2.0.0" }, "bin": { "formatly": "bin/index.mjs" } }, "sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w=="], + "forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="], "forwarded-parse": ["forwarded-parse@2.1.2", "", {}, "sha512-alTFZZQDKMporBH77856pXgzhEzaUVmLCDk+egLgIgHst3Tpndzz8MnKe+GzRJRfvVdn69HhpW7cmXzvtLvJAw=="], "fraction.js": ["fraction.js@4.3.7", "", {}, "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew=="], + "framer-motion": ["framer-motion@12.23.25", "", { "dependencies": { "motion-dom": "^12.23.23", "motion-utils": "^12.23.6", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-gUHGl2e4VG66jOcH0JHhuJQr6ZNwrET9g31ZG0xdXzT0CznP7fHX4P8Bcvuc4MiUB90ysNnWX2ukHRIggkl6hQ=="], + "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="], "fs-exists-sync": ["fs-exists-sync@0.1.0", "", {}, "sha512-cR/vflFyPZtrN6b38ZyWxpWdhlXrzZEBawlpBQMq7033xVY7/kg0GDMBK5jg8lDYQckdJ5x/YC88lM3C7VMsLg=="], @@ -1752,8 +2610,12 @@ "gcp-metadata": ["gcp-metadata@6.1.1", "", { "dependencies": { "gaxios": "^6.1.1", "google-logging-utils": "^0.0.2", "json-bigint": "^1.0.0" } }, "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A=="], + "generator-function": ["generator-function@2.0.1", "", {}, "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g=="], + "generic-names": ["generic-names@4.0.0", "", { "dependencies": { "loader-utils": "^3.2.0" } }, "sha512-ySFolZQfw9FoDb3ed9d80Cm9f0+r7qj+HJkWjeD9RBfpxEVTlVhol+gvaQB/78WbwYfbnNh8nWHHBSlg072y6A=="], + "gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="], + "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], "get-east-asian-width": ["get-east-asian-width@1.4.0", "", {}, "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q=="], @@ -1768,10 +2630,14 @@ "get-tsconfig": ["get-tsconfig@4.10.1", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ=="], + "gitdiff-parser": ["gitdiff-parser@0.3.1", "", {}, "sha512-YQJnY8aew65id8okGxKCksH3efDCJ9HzV7M9rsvd65habf39Pkh4cgYJ27AaoDMqo1X98pgNJhNMrm/kpV7UVQ=="], + "glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="], "glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], + "glob-to-regexp": ["glob-to-regexp@0.4.1", "", {}, "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw=="], + "global-agent": ["global-agent@3.0.0", "", { "dependencies": { "boolean": "^3.0.1", "es6-error": "^4.1.1", "matcher": "^3.0.0", "roarr": "^2.15.3", "semver": "^7.3.2", "serialize-error": "^7.0.1" } }, "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q=="], "global-directory": ["global-directory@4.0.1", "", { "dependencies": { "ini": "4.1.1" } }, "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q=="], @@ -1798,8 +2664,14 @@ "gtoken": ["gtoken@7.1.0", "", { "dependencies": { "gaxios": "^6.0.0", "jws": "^4.0.0" } }, "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw=="], + "gzip-size": ["gzip-size@6.0.0", "", { "dependencies": { "duplexer": "^0.1.2" } }, "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q=="], + + "hachure-fill": ["hachure-fill@0.5.2", "", {}, "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg=="], + "handlebars": ["handlebars@4.7.8", "", { "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ=="], + "happy-dom": ["happy-dom@18.0.1", "", { "dependencies": { "@types/node": "^20.0.0", "@types/whatwg-mimetype": "^3.0.2", "whatwg-mimetype": "^3.0.0" } }, "sha512-qn+rKOW7KWpVTtgIUi6RVmTBZJSe2k0Db0vh1f7CWrWclkkc7/Q+FrOfkZIb2eiErLyqu5AXEzE7XthO9JVxRA=="], + "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], "has-property-descriptors": ["has-property-descriptors@1.0.2", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="], @@ -1808,14 +2680,26 @@ "has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="], + "hash-base": ["hash-base@3.0.5", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1" } }, "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg=="], + + "hash.js": ["hash.js@1.1.7", "", { "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" } }, "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA=="], + "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], + "hast-util-from-parse5": ["hast-util-from-parse5@8.0.3", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0", "property-information": "^7.0.0", "vfile": "^6.0.0", "vfile-location": "^5.0.0", "web-namespaces": "^2.0.0" } }, "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg=="], + "hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="], "hast-util-parse-selector": ["hast-util-parse-selector@2.2.5", "", {}, "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ=="], + "hast-util-raw": ["hast-util-raw@9.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-from-parse5": "^8.0.0", "hast-util-to-parse5": "^8.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "parse5": "^7.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw=="], + + "hast-util-sanitize": ["hast-util-sanitize@5.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "unist-util-position": "^5.0.0" } }, "sha512-3yTWghByc50aGS7JlGhk61SPenfE/p1oaFeNwkOOyrscaOkMGrcW9+Cy/QAIOBpZxP1yqDIzFMR0+Np0i0+usg=="], + "hast-util-to-jsx-runtime": ["hast-util-to-jsx-runtime@2.3.6", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "vfile-message": "^4.0.0" } }, "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg=="], + "hast-util-to-parse5": ["hast-util-to-parse5@8.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "property-information": "^6.0.0", "space-separated-tokens": "^2.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw=="], + "hast-util-to-text": ["hast-util-to-text@4.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-find-after": "^5.0.0" } }, "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A=="], "hast-util-whitespace": ["hast-util-whitespace@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="], @@ -1828,6 +2712,8 @@ "highlightjs-vue": ["highlightjs-vue@1.0.0", "", {}, "sha512-PDEfEF102G23vHmPhLyPboFCD+BkMGu+GuJe2d9/eH4FsCwvgBpnc9n0pGE+ffKdph38s6foEZiEjdgHdzp+IA=="], + "hmac-drbg": ["hmac-drbg@1.0.1", "", { "dependencies": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg=="], + "homedir-polyfill": ["homedir-polyfill@1.0.3", "", { "dependencies": { "parse-passwd": "^1.0.0" } }, "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA=="], "hono": ["hono@4.9.9", "", {}, "sha512-Hxw4wT6zjJGZJdkJzAx9PyBdf7ZpxaTSA0NfxqjLghwMrLBX8p33hJBzoETRakF3UJu6OdNQBZAlNSkGqKFukw=="], @@ -1836,10 +2722,14 @@ "hosted-git-info": ["hosted-git-info@4.1.0", "", { "dependencies": { "lru-cache": "^6.0.0" } }, "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA=="], + "html-escaper": ["html-escaper@2.0.2", "", {}, "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="], + "html-to-text": ["html-to-text@9.0.5", "", { "dependencies": { "@selderee/plugin-htmlparser2": "^0.11.0", "deepmerge": "^4.3.1", "dom-serializer": "^2.0.0", "htmlparser2": "^8.0.2", "selderee": "^0.11.0" } }, "sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg=="], "html-url-attributes": ["html-url-attributes@3.0.1", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="], + "html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="], + "htmlparser2": ["htmlparser2@8.0.2", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.0.1", "entities": "^4.4.0" } }, "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA=="], "http-cache-semantics": ["http-cache-semantics@4.2.0", "", {}, "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ=="], @@ -1850,6 +2740,8 @@ "http2-wrapper": ["http2-wrapper@1.0.3", "", { "dependencies": { "quick-lru": "^5.1.1", "resolve-alpn": "^1.0.0" } }, "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg=="], + "https-browserify": ["https-browserify@1.0.0", "", {}, "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg=="], + "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], "human-signals": ["human-signals@8.0.1", "", {}, "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ=="], @@ -1868,7 +2760,11 @@ "ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="], - "image-size": ["image-size@0.5.5", "", { "bin": { "image-size": "bin/image-size.js" } }, "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ=="], + "image-size": ["image-size@2.0.2", "", { "bin": { "image-size": "bin/image-size.js" } }, "sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w=="], + + "immediate": ["immediate@3.0.6", "", {}, "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="], + + "immer": ["immer@10.2.0", "", {}, "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw=="], "immutable": ["immutable@5.1.3", "", {}, "sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg=="], @@ -1900,6 +2796,8 @@ "inline-style-parser": ["inline-style-parser@0.2.4", "", {}, "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q=="], + "internmap": ["internmap@1.0.1", "", {}, "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw=="], + "ip-address": ["ip-address@10.0.1", "", {}, "sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA=="], "ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="], @@ -1908,8 +2806,14 @@ "is-alphanumerical": ["is-alphanumerical@1.0.4", "", { "dependencies": { "is-alphabetical": "^1.0.0", "is-decimal": "^1.0.0" } }, "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A=="], + "is-arguments": ["is-arguments@1.2.0", "", { "dependencies": { "call-bound": "^1.0.2", "has-tostringtag": "^1.0.2" } }, "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA=="], + + "is-arrayish": ["is-arrayish@0.3.4", "", {}, "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA=="], + "is-buffer": ["is-buffer@1.1.6", "", {}, "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="], + "is-callable": ["is-callable@1.2.7", "", {}, "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA=="], + "is-ci": ["is-ci@3.0.1", "", { "dependencies": { "ci-info": "^3.2.0" }, "bin": { "is-ci": "bin.js" } }, "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ=="], "is-core-module": ["is-core-module@2.16.1", "", { "dependencies": { "hasown": "^2.0.2" } }, "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w=="], @@ -1926,6 +2830,8 @@ "is-fullwidth-code-point": ["is-fullwidth-code-point@5.1.0", "", { "dependencies": { "get-east-asian-width": "^1.3.1" } }, "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ=="], + "is-generator-function": ["is-generator-function@1.1.2", "", { "dependencies": { "call-bound": "^1.0.4", "generator-function": "^2.0.0", "get-proto": "^1.0.1", "has-tostringtag": "^1.0.2", "safe-regex-test": "^1.1.0" } }, "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA=="], + "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], "is-hexadecimal": ["is-hexadecimal@1.0.4", "", {}, "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="], @@ -1940,6 +2846,8 @@ "is-lambda": ["is-lambda@1.0.1", "", {}, "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ=="], + "is-nan": ["is-nan@1.3.2", "", { "dependencies": { "call-bind": "^1.0.0", "define-properties": "^1.1.3" } }, "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w=="], + "is-node-process": ["is-node-process@1.2.0", "", {}, "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw=="], "is-npm": ["is-npm@6.1.0", "", {}, "sha512-O2z4/kNgyjhQwVR1Wpkbfc19JIhggF97NZNCpWTnjH7kVcZMUrnut9XSN7txI7VdyIYk5ZatOq3zvSuWpU8hoA=="], @@ -1950,10 +2858,16 @@ "is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="], + "is-plain-object": ["is-plain-object@5.0.0", "", {}, "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="], + "is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="], + "is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="], + "is-stream": ["is-stream@2.0.1", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="], + "is-typed-array": ["is-typed-array@1.1.15", "", { "dependencies": { "which-typed-array": "^1.1.16" } }, "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ=="], + "is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="], "is-what": ["is-what@3.14.1", "", {}, "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA=="], @@ -1968,17 +2882,25 @@ "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], + "isomorphic-timers-promises": ["isomorphic-timers-promises@1.0.1", "", {}, "sha512-u4sej9B1LPSxTGKB/HiuzvEQnXH0ECYkSVQU39koSwmFAxhlEAFl9RdTvLv4TOTQUgBS5O3O5fwUxk6byBZ+IQ=="], + "isomorphic-ws": ["isomorphic-ws@5.0.0", "", { "peerDependencies": { "ws": "*" } }, "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw=="], + "isomorphic.js": ["isomorphic.js@0.2.5", "", {}, "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw=="], + "jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="], "jake": ["jake@10.9.4", "", { "dependencies": { "async": "^3.2.6", "filelist": "^1.0.4", "picocolors": "^1.1.1" }, "bin": { "jake": "bin/cli.js" } }, "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA=="], "jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], + "jose": ["jose@6.1.3", "", {}, "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ=="], + "js-tokens": ["js-tokens@9.0.1", "", {}, "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ=="], - "js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], + "js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="], + + "jsdoc-type-pratt-parser": ["jsdoc-type-pratt-parser@4.8.0", "", {}, "sha512-iZ8Bdb84lWRuGHamRXFyML07r21pcwBrLkHEuHgEY5UbCouBwv7ECknDRKzsQIXMiqpPymqtIf8TC/shYKB5rw=="], "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], @@ -1988,7 +2910,7 @@ "json-schema": ["json-schema@0.4.0", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="], - "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + "json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], "json-stable-stringify": ["json-stable-stringify@1.3.0", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.4", "isarray": "^2.0.5", "jsonify": "^0.0.1", "object-keys": "^1.1.1" } }, "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg=="], @@ -2002,18 +2924,32 @@ "jsonwebtoken": ["jsonwebtoken@9.0.2", "", { "dependencies": { "jws": "^3.2.2", "lodash.includes": "^4.3.0", "lodash.isboolean": "^3.0.3", "lodash.isinteger": "^4.0.4", "lodash.isnumber": "^3.0.3", "lodash.isplainobject": "^4.0.6", "lodash.isstring": "^4.0.1", "lodash.once": "^4.0.0", "ms": "^2.1.1", "semver": "^7.5.4" } }, "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ=="], + "jszip": ["jszip@3.10.1", "", { "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", "setimmediate": "^1.0.5" } }, "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g=="], + "jwa": ["jwa@1.4.2", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw=="], "jws": ["jws@3.2.2", "", { "dependencies": { "jwa": "^1.4.1", "safe-buffer": "^5.0.1" } }, "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA=="], + "katex": ["katex@0.16.25", "", { "dependencies": { "commander": "^8.3.0" }, "bin": { "katex": "cli.js" } }, "sha512-woHRUZ/iF23GBP1dkDQMh1QBad9dmr8/PAwNA54VrSOVYgI12MAcE14TqnDdQOdzyEonGzMepYnqBMYdsoAr8Q=="], + "keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="], + "khroma": ["khroma@2.1.0", "", {}, "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw=="], + "kind-of": ["kind-of@3.2.2", "", { "dependencies": { "is-buffer": "^1.1.5" } }, "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ=="], + "kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], + + "knip": ["knip@5.71.0", "", { "dependencies": { "@nodelib/fs.walk": "^1.2.3", "fast-glob": "^3.3.3", "formatly": "^0.3.0", "jiti": "^2.6.0", "js-yaml": "^4.1.1", "minimist": "^1.2.8", "oxc-resolver": "^11.13.2", "picocolors": "^1.1.1", "picomatch": "^4.0.1", "smol-toml": "^1.5.2", "strip-json-comments": "5.0.3", "zod": "^4.1.11" }, "peerDependencies": { "@types/node": ">=18", "typescript": ">=5.0.4 <7" }, "bin": { "knip": "bin/knip.js", "knip-bun": "bin/knip-bun.js" } }, "sha512-hwgdqEJ+7DNJ5jE8BCPu7b57TY7vUwP6MzWYgCgPpg6iPCee/jKPShDNIlFER2koti4oz5xF88VJbKCb4Wl71g=="], + "ky": ["ky@1.11.0", "", {}, "sha512-NEyo0ICpS0cqSuyoJFMCnHOZJILqXsKhIZlHJGDYaH8OB5IFrGzuBpEwyoMZG6gUKMPrazH30Ax5XKaujvD8ag=="], + "langium": ["langium@3.3.1", "", { "dependencies": { "chevrotain": "~11.0.3", "chevrotain-allstar": "~0.3.0", "vscode-languageserver": "~9.0.1", "vscode-languageserver-textdocument": "~1.0.11", "vscode-uri": "~3.0.8" } }, "sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w=="], + "latest-version": ["latest-version@9.0.0", "", { "dependencies": { "package-json": "^10.0.0" } }, "sha512-7W0vV3rqv5tokqkBAFV1LbR7HPOWzXQDpDgEuib/aJ1jsZZx6x3c2mBI+TJhJzOhkGeaLbCKEHXEXLfirtG2JA=="], + "layout-base": ["layout-base@1.0.2", "", {}, "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg=="], + "lazy-cache": ["lazy-cache@2.0.2", "", { "dependencies": { "set-getter": "^0.1.0" } }, "sha512-7vp2Acd2+Kz4XkzxGxaB1FWOi8KjWIWsgdfD5MCb86DWvlLqhRPM+d6Pro3iNEL5VT9mstz5hKAlcd+QR6H3aA=="], "lazy-val": ["lazy-val@1.0.5", "", {}, "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q=="], @@ -2022,6 +2958,12 @@ "less": ["less@4.4.1", "", { "dependencies": { "copy-anything": "^2.0.1", "parse-node-version": "^1.0.1", "tslib": "^2.3.0" }, "optionalDependencies": { "errno": "^0.1.1", "graceful-fs": "^4.1.2", "image-size": "~0.5.0", "make-dir": "^2.1.0", "mime": "^1.4.1", "needle": "^3.1.0", "source-map": "~0.6.0" }, "bin": { "lessc": "bin/lessc" } }, "sha512-X9HKyiXPi0f/ed0XhgUlBeFfxrlDP3xR4M7768Zl+WXLUViuL9AOPPJP4nCV0tgRWvTYvpNmN0SFhZOQzy16PA=="], + "lexical": ["lexical@0.32.1", "", {}, "sha512-Rvr9p00zUwzjXIqElIjMDyl/24QHw68yaqmXUWIT3lSdSAr8OpjSJK3iWBLZwVZwwpVhwShZRckomc+3vSb/zw=="], + + "lib0": ["lib0@0.2.114", "", { "dependencies": { "isomorphic.js": "^0.2.4" }, "bin": { "0serve": "bin/0serve.js", "0gentesthtml": "bin/gentesthtml.js", "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js" } }, "sha512-gcxmNFzA4hv8UYi8j43uPlQ7CGcyMJ2KQb5kZASw6SnAKAf10hK12i2fjrS3Cl/ugZa5Ui6WwIu1/6MIXiHttQ=="], + + "lie": ["lie@3.3.0", "", { "dependencies": { "immediate": "~3.0.5" } }, "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ=="], + "lightningcss": ["lightningcss@1.30.1", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-darwin-arm64": "1.30.1", "lightningcss-darwin-x64": "1.30.1", "lightningcss-freebsd-x64": "1.30.1", "lightningcss-linux-arm-gnueabihf": "1.30.1", "lightningcss-linux-arm64-gnu": "1.30.1", "lightningcss-linux-arm64-musl": "1.30.1", "lightningcss-linux-x64-gnu": "1.30.1", "lightningcss-linux-x64-musl": "1.30.1", "lightningcss-win32-arm64-msvc": "1.30.1", "lightningcss-win32-x64-msvc": "1.30.1" } }, "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg=="], "lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.30.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ=="], @@ -2048,10 +2990,16 @@ "loader-utils": ["loader-utils@3.3.1", "", {}, "sha512-FMJTLMXfCLMLfJxcX9PFqX5qD88Z5MRGaZCVzfuqeZSPsyiBzs+pahDQjbIWz2QIzPZz0NX9Zy4FX3lmK6YHIg=="], + "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], + "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], + "lodash-es": ["lodash-es@4.17.21", "", {}, "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="], + "lodash.camelcase": ["lodash.camelcase@4.3.0", "", {}, "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="], + "lodash.debounce": ["lodash.debounce@4.0.8", "", {}, "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow=="], + "lodash.includes": ["lodash.includes@4.3.0", "", {}, "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="], "lodash.isboolean": ["lodash.isboolean@3.0.3", "", {}, "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="], @@ -2074,13 +3022,17 @@ "loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="], + "loupe": ["loupe@3.2.1", "", {}, "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ=="], + "lowercase-keys": ["lowercase-keys@2.0.0", "", {}, "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="], "lowlight": ["lowlight@1.20.0", "", { "dependencies": { "fault": "^1.0.0", "highlight.js": "~10.7.0" } }, "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw=="], "lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], - "lucide-react": ["lucide-react@0.544.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-t5tS44bqd825zAW45UQxpG2CvcC4urOwn2TrwSH8u+MjeE+1NnWl6QqeQ/6NdjMqdOygyiT9p3Ev0p1NJykxjw=="], + "lucide-react": ["lucide-react@0.507.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-XfgE6gvAHwAtnbUvWiTTHx4S3VGR+cUJHEc0vrh9Ogu672I1Tue2+Cp/8JJqpytgcBHAB1FVI297W4XGNwc2dQ=="], + + "lz-string": ["lz-string@1.5.0", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="], "magic-string": ["magic-string@0.30.19", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw=="], @@ -2088,6 +3040,8 @@ "make-fetch-happen": ["make-fetch-happen@10.2.1", "", { "dependencies": { "agentkeepalive": "^4.2.1", "cacache": "^16.1.0", "http-cache-semantics": "^4.1.0", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^7.7.1", "minipass": "^3.1.6", "minipass-collect": "^1.0.2", "minipass-fetch": "^2.0.3", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", "promise-retry": "^2.0.1", "socks-proxy-agent": "^7.0.0", "ssri": "^9.0.0" } }, "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w=="], + "markdown-table": ["markdown-table@3.0.4", "", {}, "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw=="], + "marked": ["marked@16.3.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-K3UxuKu6l6bmA5FUwYho8CfJBlsUWAooKtdGgMcERSpF7gcBUrCGsLH7wDaaNOzwq18JzSUDyoEb/YsrqMac3w=="], "marked-terminal": ["marked-terminal@7.3.0", "", { "dependencies": { "ansi-escapes": "^7.0.0", "ansi-regex": "^6.1.0", "chalk": "^5.4.1", "cli-highlight": "^2.1.11", "cli-table3": "^0.6.5", "node-emoji": "^2.2.0", "supports-hyperlinks": "^3.1.0" }, "peerDependencies": { "marked": ">=1 <16" } }, "sha512-t4rBvPsHc57uE/2nJOLmMbZCQ4tgAccAED3ngXQqW6g+TxA488JzJ+FK3lQkzBQOI1mRV/r/Kq+1ZlJ4D0owQw=="], @@ -2096,8 +3050,24 @@ "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], + "md5.js": ["md5.js@1.3.5", "", { "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", "safe-buffer": "^5.1.2" } }, "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg=="], + + "mdast-util-find-and-replace": ["mdast-util-find-and-replace@3.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "escape-string-regexp": "^5.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg=="], + "mdast-util-from-markdown": ["mdast-util-from-markdown@2.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "mdast-util-to-string": "^4.0.0", "micromark": "^4.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-decode-string": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA=="], + "mdast-util-gfm": ["mdast-util-gfm@3.1.0", "", { "dependencies": { "mdast-util-from-markdown": "^2.0.0", "mdast-util-gfm-autolink-literal": "^2.0.0", "mdast-util-gfm-footnote": "^2.0.0", "mdast-util-gfm-strikethrough": "^2.0.0", "mdast-util-gfm-table": "^2.0.0", "mdast-util-gfm-task-list-item": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ=="], + + "mdast-util-gfm-autolink-literal": ["mdast-util-gfm-autolink-literal@2.0.1", "", { "dependencies": { "@types/mdast": "^4.0.0", "ccount": "^2.0.0", "devlop": "^1.0.0", "mdast-util-find-and-replace": "^3.0.0", "micromark-util-character": "^2.0.0" } }, "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ=="], + + "mdast-util-gfm-footnote": ["mdast-util-gfm-footnote@2.1.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.1.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0" } }, "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ=="], + + "mdast-util-gfm-strikethrough": ["mdast-util-gfm-strikethrough@2.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg=="], + + "mdast-util-gfm-table": ["mdast-util-gfm-table@2.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "markdown-table": "^3.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg=="], + + "mdast-util-gfm-task-list-item": ["mdast-util-gfm-task-list-item@2.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ=="], + "mdast-util-mdx-expression": ["mdast-util-mdx-expression@2.0.1", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ=="], "mdast-util-mdx-jsx": ["mdast-util-mdx-jsx@3.2.0", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "devlop": "^1.1.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "parse-entities": "^4.0.0", "stringify-entities": "^4.0.0", "unist-util-stringify-position": "^4.0.0", "vfile-message": "^4.0.0" } }, "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q=="], @@ -2118,10 +3088,26 @@ "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], + "mermaid": ["mermaid@11.12.2", "", { "dependencies": { "@braintree/sanitize-url": "^7.1.1", "@iconify/utils": "^3.0.1", "@mermaid-js/parser": "^0.6.3", "@types/d3": "^7.4.3", "cytoscape": "^3.29.3", "cytoscape-cose-bilkent": "^4.1.0", "cytoscape-fcose": "^2.2.0", "d3": "^7.9.0", "d3-sankey": "^0.12.3", "dagre-d3-es": "7.0.13", "dayjs": "^1.11.18", "dompurify": "^3.2.5", "katex": "^0.16.22", "khroma": "^2.1.0", "lodash-es": "^4.17.21", "marked": "^16.2.1", "roughjs": "^4.6.6", "stylis": "^4.3.6", "ts-dedent": "^2.2.0", "uuid": "^11.1.0" } }, "sha512-n34QPDPEKmaeCG4WDMGy0OT6PSyxKCfy2pJgShP+Qow2KLrvWjclwbc3yXfSIf4BanqWEhQEpngWwNp/XhZt6w=="], + "micromark": ["micromark@4.0.2", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA=="], "micromark-core-commonmark": ["micromark-core-commonmark@2.0.3", "", { "dependencies": { "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-destination": "^2.0.0", "micromark-factory-label": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-factory-title": "^2.0.0", "micromark-factory-whitespace": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-html-tag-name": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg=="], + "micromark-extension-gfm": ["micromark-extension-gfm@3.0.0", "", { "dependencies": { "micromark-extension-gfm-autolink-literal": "^2.0.0", "micromark-extension-gfm-footnote": "^2.0.0", "micromark-extension-gfm-strikethrough": "^2.0.0", "micromark-extension-gfm-table": "^2.0.0", "micromark-extension-gfm-tagfilter": "^2.0.0", "micromark-extension-gfm-task-list-item": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w=="], + + "micromark-extension-gfm-autolink-literal": ["micromark-extension-gfm-autolink-literal@2.1.0", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw=="], + + "micromark-extension-gfm-footnote": ["micromark-extension-gfm-footnote@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw=="], + + "micromark-extension-gfm-strikethrough": ["micromark-extension-gfm-strikethrough@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw=="], + + "micromark-extension-gfm-table": ["micromark-extension-gfm-table@2.1.1", "", { "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg=="], + + "micromark-extension-gfm-tagfilter": ["micromark-extension-gfm-tagfilter@2.0.0", "", { "dependencies": { "micromark-util-types": "^2.0.0" } }, "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg=="], + + "micromark-extension-gfm-task-list-item": ["micromark-extension-gfm-task-list-item@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw=="], + "micromark-factory-destination": ["micromark-factory-destination@2.0.1", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA=="], "micromark-factory-label": ["micromark-factory-label@2.0.1", "", { "dependencies": { "devlop": "^1.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg=="], @@ -2162,16 +3148,28 @@ "micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="], - "mime": ["mime@1.6.0", "", { "bin": { "mime": "cli.js" } }, "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="], + "miller-rabin": ["miller-rabin@4.0.1", "", { "dependencies": { "bn.js": "^4.0.0", "brorand": "^1.0.1" }, "bin": { "miller-rabin": "bin/miller-rabin" } }, "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA=="], + + "mime": ["mime@3.0.0", "", { "bin": { "mime": "cli.js" } }, "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A=="], - "mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], + "mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], - "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], + "mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], "mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="], "mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="], + "min-indent": ["min-indent@1.0.1", "", {}, "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="], + + "mini-svg-data-uri": ["mini-svg-data-uri@1.4.4", "", { "bin": { "mini-svg-data-uri": "cli.js" } }, "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg=="], + + "miniflare": ["miniflare@4.20251125.0", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "acorn": "8.14.0", "acorn-walk": "8.3.2", "exit-hook": "2.2.1", "glob-to-regexp": "0.4.1", "sharp": "^0.33.5", "stoppable": "1.1.0", "undici": "7.14.0", "workerd": "1.20251125.0", "ws": "8.18.0", "youch": "4.1.0-beta.10", "zod": "3.22.3" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-xY6deLx0Drt8GfGG2Fv0fHUocHAIG/Iv62Kl36TPfDzgq7/+DQ5gYNisxnmyISQdA/sm7kOvn2XRBncxjWYrLg=="], + + "minimalistic-assert": ["minimalistic-assert@1.0.1", "", {}, "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="], + + "minimalistic-crypto-utils": ["minimalistic-crypto-utils@1.0.1", "", {}, "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg=="], + "minimatch": ["minimatch@10.0.3", "", { "dependencies": { "@isaacs/brace-expansion": "^5.0.0" } }, "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw=="], "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], @@ -2196,8 +3194,16 @@ "mnemonist": ["mnemonist@0.40.3", "", { "dependencies": { "obliterator": "^2.0.4" } }, "sha512-Vjyr90sJ23CKKH/qPAgUKicw/v6pRoamxIEDFOF8uSgFME7DqPRpHgRTejWVjkdGg5dXj0/NyxZHZ9bcjH+2uQ=="], + "module-alias": ["module-alias@2.2.3", "", {}, "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q=="], + "module-details-from-path": ["module-details-from-path@1.0.4", "", {}, "sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w=="], + "motion-dom": ["motion-dom@12.23.23", "", { "dependencies": { "motion-utils": "^12.23.6" } }, "sha512-n5yolOs0TQQBRUFImrRfs/+6X4p3Q4n1dUEqt/H58Vx7OW6RF+foWEgmTVDhIWJIMXOuNNL0apKH2S16en9eiA=="], + + "motion-utils": ["motion-utils@12.23.6", "", {}, "sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ=="], + + "mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="], + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], "msw": ["msw@2.12.2", "", { "dependencies": { "@inquirer/confirm": "^5.0.0", "@mswjs/interceptors": "^0.40.0", "@open-draft/deferred-promise": "^2.2.0", "@types/statuses": "^2.0.4", "cookie": "^1.0.2", "graphql": "^16.8.1", "headers-polyfill": "^4.0.2", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "path-to-regexp": "^6.3.0", "picocolors": "^1.1.1", "rettime": "^0.7.0", "statuses": "^2.0.2", "strict-event-emitter": "^0.5.1", "tough-cookie": "^6.0.0", "type-fest": "^4.26.1", "until-async": "^3.0.2", "yargs": "^17.7.2" }, "peerDependencies": { "typescript": ">= 4.8.x" }, "optionalPeers": ["typescript"], "bin": { "msw": "cli/index.js" } }, "sha512-Fsr8AR5Yu6C0thoWa1Z8qGBFQLDvLsWlAn/v3CNLiUizoRqBYArK3Ex3thXpMWRr1Li5/MKLOEZ5mLygUmWi1A=="], @@ -2216,6 +3222,12 @@ "neo-async": ["neo-async@2.6.2", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="], + "next": ["next@15.5.6", "", { "dependencies": { "@next/env": "15.5.6", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "15.5.6", "@next/swc-darwin-x64": "15.5.6", "@next/swc-linux-arm64-gnu": "15.5.6", "@next/swc-linux-arm64-musl": "15.5.6", "@next/swc-linux-x64-gnu": "15.5.6", "@next/swc-linux-x64-musl": "15.5.6", "@next/swc-win32-arm64-msvc": "15.5.6", "@next/swc-win32-x64-msvc": "15.5.6", "sharp": "^0.34.3" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-zTxsnI3LQo3c9HSdSf91O1jMNsEzIXDShXd4wVdg9y5shwLqBXi4ZtUUJyB86KGVSJLZx0PFONvO54aheGX8QQ=="], + + "next-auth": ["next-auth@5.0.0-beta.28", "", { "dependencies": { "@auth/core": "0.39.1" }, "peerDependencies": { "@simplewebauthn/browser": "^9.0.1", "@simplewebauthn/server": "^9.0.2", "next": "^14.0.0-0 || ^15.0.0-0", "nodemailer": "^6.6.5", "react": "^18.2.0 || ^19.0.0-0" }, "optionalPeers": ["@simplewebauthn/browser", "@simplewebauthn/server", "nodemailer"] }, "sha512-2RDR1h3DJb4nizcd5UBBwC2gtyP7j/jTvVLvEtDaFSKUWNfou3Gek2uTNHSga/Q4I/GF+OJobA4mFbRaWJgIDQ=="], + + "next-themes": ["next-themes@0.4.6", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="], + "node-abi": ["node-abi@3.78.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-E2wEyrgX/CqvicaQYU3Ze1PFGjc4QYPGsjUrlYkqAE0WjHEZwgOsGMPMzkMse4LjJbDmaEuDX3CM036j5K2DSQ=="], "node-addon-api": ["node-addon-api@7.1.1", "", {}, "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ=="], @@ -2230,6 +3242,8 @@ "node-releases": ["node-releases@2.0.23", "", {}, "sha512-cCmFDMSm26S6tQSDpBCg/NR8NENrVPhAJSf+XbxBG4rPFaaonlEoE9wHQmun+cls499TQGSb7ZyPBRlzgKfpeg=="], + "node-stdlib-browser": ["node-stdlib-browser@1.3.1", "", { "dependencies": { "assert": "^2.0.0", "browser-resolve": "^2.0.0", "browserify-zlib": "^0.2.0", "buffer": "^5.7.1", "console-browserify": "^1.1.0", "constants-browserify": "^1.0.0", "create-require": "^1.1.1", "crypto-browserify": "^3.12.1", "domain-browser": "4.22.0", "events": "^3.0.0", "https-browserify": "^1.0.0", "isomorphic-timers-promises": "^1.0.1", "os-browserify": "^0.3.0", "path-browserify": "^1.0.1", "pkg-dir": "^5.0.0", "process": "^0.11.10", "punycode": "^1.4.1", "querystring-es3": "^0.2.1", "readable-stream": "^3.6.0", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "string_decoder": "^1.0.0", "timers-browserify": "^2.0.4", "tty-browserify": "0.0.1", "url": "^0.11.4", "util": "^0.12.4", "vm-browserify": "^1.0.1" } }, "sha512-X75ZN8DCLftGM5iKwoYLA3rjnrAEs97MkzvSd4q2746Tgpg8b8XWiBGiBG4ZpgcAqBgtgPHTiAc8ZMCvZuikDw=="], + "nopt": ["nopt@6.0.0", "", { "dependencies": { "abbrev": "^1.0.0" }, "bin": { "nopt": "bin/nopt.js" } }, "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g=="], "normalize-package-data": ["normalize-package-data@6.0.2", "", { "dependencies": { "hosted-git-info": "^7.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4" } }, "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g=="], @@ -2240,14 +3254,22 @@ "npm-run-path": ["npm-run-path@6.0.0", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="], + "oauth4webapi": ["oauth4webapi@3.8.3", "", {}, "sha512-pQ5BsX3QRTgnt5HxgHwgunIRaDXBdkT23tf8dfzmtTIL2LTpdmxgbpbBm0VgFWAIDlezQvQCTgnVIUmHupXHxw=="], + "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="], "object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="], + "object-is": ["object-is@1.1.6", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1" } }, "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q=="], + "object-keys": ["object-keys@1.1.1", "", {}, "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="], + "object.assign": ["object.assign@4.1.7", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0", "has-symbols": "^1.1.0", "object-keys": "^1.1.1" } }, "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw=="], + "obliterator": ["obliterator@2.0.5", "", {}, "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw=="], + "ohash": ["ohash@2.0.11", "", {}, "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ=="], + "on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="], "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="], @@ -2258,8 +3280,12 @@ "openai": ["openai@5.23.2", "", { "peerDependencies": { "ws": "^8.18.0", "zod": "^3.23.8" }, "optionalPeers": ["ws", "zod"], "bin": { "openai": "bin/cli" } }, "sha512-MQBzmTulj+MM5O8SKEk/gL8a7s5mktS9zUtAkU257WjvobGc9nKcBuVwjyEEcb9SI8a8Y2G/mzn3vm9n1Jlleg=="], + "opener": ["opener@1.5.2", "", { "bin": { "opener": "bin/opener-bin.js" } }, "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A=="], + "ora": ["ora@5.4.1", "", { "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "is-unicode-supported": "^0.1.0", "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" } }, "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ=="], + "os-browserify": ["os-browserify@0.3.0", "", {}, "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A=="], + "os-homedir": ["os-homedir@1.0.2", "", {}, "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ=="], "os-paths": ["os-paths@7.4.0", "", { "optionalDependencies": { "fsevents": "*" } }, "sha512-Ux1J4NUqC6tZayBqLN1kUlDAEvLiQlli/53sSddU4IN+h+3xxnv2HmRSMpVSvr1hvJzotfMs3ERvETGK+f4OwA=="], @@ -2268,12 +3294,16 @@ "oxc-parser": ["oxc-parser@0.36.0", "", { "dependencies": { "@oxc-project/types": "^0.36.0" }, "optionalDependencies": { "@oxc-parser/binding-darwin-arm64": "0.36.0", "@oxc-parser/binding-darwin-x64": "0.36.0", "@oxc-parser/binding-linux-arm64-gnu": "0.36.0", "@oxc-parser/binding-linux-arm64-musl": "0.36.0", "@oxc-parser/binding-linux-x64-gnu": "0.36.0", "@oxc-parser/binding-linux-x64-musl": "0.36.0", "@oxc-parser/binding-win32-arm64-msvc": "0.36.0", "@oxc-parser/binding-win32-x64-msvc": "0.36.0" } }, "sha512-dcjn+8WvWVbIO0Bb0qAJcfq8JwdkbPflYyFBg3rcDb83awlXAQLnhZuheGUxuWEh18oQFAcxkgdUdObS6DvA7A=="], + "oxc-resolver": ["oxc-resolver@11.14.2", "", { "optionalDependencies": { "@oxc-resolver/binding-android-arm-eabi": "11.14.2", "@oxc-resolver/binding-android-arm64": "11.14.2", "@oxc-resolver/binding-darwin-arm64": "11.14.2", "@oxc-resolver/binding-darwin-x64": "11.14.2", "@oxc-resolver/binding-freebsd-x64": "11.14.2", "@oxc-resolver/binding-linux-arm-gnueabihf": "11.14.2", "@oxc-resolver/binding-linux-arm-musleabihf": "11.14.2", "@oxc-resolver/binding-linux-arm64-gnu": "11.14.2", "@oxc-resolver/binding-linux-arm64-musl": "11.14.2", "@oxc-resolver/binding-linux-ppc64-gnu": "11.14.2", "@oxc-resolver/binding-linux-riscv64-gnu": "11.14.2", "@oxc-resolver/binding-linux-riscv64-musl": "11.14.2", "@oxc-resolver/binding-linux-s390x-gnu": "11.14.2", "@oxc-resolver/binding-linux-x64-gnu": "11.14.2", "@oxc-resolver/binding-linux-x64-musl": "11.14.2", "@oxc-resolver/binding-openharmony-arm64": "11.14.2", "@oxc-resolver/binding-wasm32-wasi": "11.14.2", "@oxc-resolver/binding-win32-arm64-msvc": "11.14.2", "@oxc-resolver/binding-win32-ia32-msvc": "11.14.2", "@oxc-resolver/binding-win32-x64-msvc": "11.14.2" } }, "sha512-M5fERQKcrCngMZNnk1gRaBbYcqpqXLgMcoqAo7Wpty+KH0I18i03oiy2peUsGJwFaKAEbmo+CtAyhXh08RZ1RA=="], + "p-cancelable": ["p-cancelable@2.1.1", "", {}, "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="], "p-finally": ["p-finally@1.0.0", "", {}, "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow=="], "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], + "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], + "p-map": ["p-map@4.0.0", "", { "dependencies": { "aggregate-error": "^3.0.0" } }, "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ=="], "p-queue": ["p-queue@6.6.2", "", { "dependencies": { "eventemitter3": "^4.0.4", "p-timeout": "^3.2.0" } }, "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ=="], @@ -2286,6 +3316,12 @@ "package-json-from-dist": ["package-json-from-dist@1.0.1", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="], + "package-manager-detector": ["package-manager-detector@1.6.0", "", {}, "sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA=="], + + "pako": ["pako@1.0.11", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="], + + "parse-asn1": ["parse-asn1@5.1.9", "", { "dependencies": { "asn1.js": "^4.10.1", "browserify-aes": "^1.2.0", "evp_bytestokey": "^1.0.3", "pbkdf2": "^3.1.5", "safe-buffer": "^5.2.1" } }, "sha512-fIYNuZ/HastSb80baGOuPRo1O9cf4baWw5WsAp7dBuUzeTD/BoaG8sVTdlPFksBE2lF21dN+A1AnrpIjSWqHHg=="], + "parse-entities": ["parse-entities@2.0.0", "", { "dependencies": { "character-entities": "^1.0.0", "character-entities-legacy": "^1.0.0", "character-reference-invalid": "^1.0.0", "is-alphanumerical": "^1.0.0", "is-decimal": "^1.0.0", "is-hexadecimal": "^1.0.0" } }, "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ=="], "parse-json": ["parse-json@8.3.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "index-to-position": "^1.1.0", "type-fest": "^4.39.1" } }, "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ=="], @@ -2296,7 +3332,7 @@ "parse-passwd": ["parse-passwd@1.0.0", "", {}, "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q=="], - "parse5": ["parse5@5.1.1", "", {}, "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="], + "parse5": ["parse5@7.3.0", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="], "parse5-htmlparser2-tree-adapter": ["parse5-htmlparser2-tree-adapter@6.0.1", "", { "dependencies": { "parse5": "^6.0.1" } }, "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA=="], @@ -2306,7 +3342,11 @@ "patch-console": ["patch-console@2.0.0", "", {}, "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA=="], - "path-exists": ["path-exists@5.0.0", "", {}, "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ=="], + "path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="], + + "path-data-parser": ["path-data-parser@0.1.0", "", {}, "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w=="], + + "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], "path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="], @@ -2320,6 +3360,10 @@ "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], + "pathval": ["pathval@2.0.1", "", {}, "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ=="], + + "pbkdf2": ["pbkdf2@3.1.5", "", { "dependencies": { "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "ripemd160": "^2.0.3", "safe-buffer": "^5.2.1", "sha.js": "^2.4.12", "to-buffer": "^1.2.1" } }, "sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ=="], + "pe-library": ["pe-library@0.4.1", "", {}, "sha512-eRWB5LBz7PpDu4PUlwT0PhnQfTQJlDDdPa35urV4Osrm0t0AqQFGn+UIkU3klZvwJ8KPO3VbBFsXquA6p6kqZw=="], "peberminta": ["peberminta@0.9.0", "", {}, "sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ=="], @@ -2328,12 +3372,26 @@ "pend": ["pend@1.2.0", "", {}, "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="], + "perfect-debounce": ["perfect-debounce@2.0.0", "", {}, "sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow=="], + + "pg": ["pg@8.16.3", "", { "dependencies": { "pg-connection-string": "^2.9.1", "pg-pool": "^3.10.1", "pg-protocol": "^1.10.3", "pg-types": "2.2.0", "pgpass": "1.0.5" }, "optionalDependencies": { "pg-cloudflare": "^1.2.7" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw=="], + + "pg-cloudflare": ["pg-cloudflare@1.2.7", "", {}, "sha512-YgCtzMH0ptvZJslLM1ffsY4EuGaU0cx4XSdXLRFae8bPP4dS5xL1tNB3k2o/N64cHJpwU7dxKli/nZ2lUa5fLg=="], + + "pg-connection-string": ["pg-connection-string@2.9.1", "", {}, "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w=="], + + "pg-gateway": ["pg-gateway@0.3.0-beta.4", "", {}, "sha512-CTjsM7Z+0Nx2/dyZ6r8zRsc3f9FScoD5UAOlfUx1Fdv/JOIWvRbF7gou6l6vP+uypXQVoYPgw8xZDXgMGvBa4Q=="], + "pg-int8": ["pg-int8@1.0.1", "", {}, "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="], + "pg-pool": ["pg-pool@3.10.1", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg=="], + "pg-protocol": ["pg-protocol@1.10.3", "", {}, "sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ=="], "pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], + "pgpass": ["pgpass@1.0.5", "", { "dependencies": { "split2": "^4.1.0" } }, "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug=="], + "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], "picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], @@ -2342,10 +3400,18 @@ "pkce-challenge": ["pkce-challenge@5.0.0", "", {}, "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ=="], + "pkg-dir": ["pkg-dir@5.0.0", "", { "dependencies": { "find-up": "^5.0.0" } }, "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA=="], + "pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="], "plist": ["plist@3.1.0", "", { "dependencies": { "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", "xmlbuilder": "^15.1.1" } }, "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ=="], + "points-on-curve": ["points-on-curve@0.2.0", "", {}, "sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A=="], + + "points-on-path": ["points-on-path@0.2.1", "", { "dependencies": { "path-data-parser": "0.1.0", "points-on-curve": "0.2.0" } }, "sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g=="], + + "possible-typed-array-names": ["possible-typed-array-names@1.1.0", "", {}, "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg=="], + "postcss": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="], "postcss-modules": ["postcss-modules@4.3.1", "", { "dependencies": { "generic-names": "^4.0.0", "icss-replace-symbols": "^1.1.0", "lodash.camelcase": "^4.3.0", "postcss-modules-extract-imports": "^3.0.0", "postcss-modules-local-by-default": "^4.0.0", "postcss-modules-scope": "^3.0.0", "postcss-modules-values": "^4.0.0", "string-hash": "^1.1.1" }, "peerDependencies": { "postcss": "^8.0.0" } }, "sha512-ItUhSUxBBdNamkT3KzIZwYNNRFKmkJrofvC2nWab3CPKhYBQ1f27XXh1PAPE27Psx58jeelPsxWB/+og+KEH0Q=="], @@ -2358,10 +3424,12 @@ "postcss-modules-values": ["postcss-modules-values@4.0.0", "", { "dependencies": { "icss-utils": "^5.0.0" }, "peerDependencies": { "postcss": "^8.1.0" } }, "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ=="], - "postcss-selector-parser": ["postcss-selector-parser@7.1.0", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA=="], + "postcss-selector-parser": ["postcss-selector-parser@6.0.10", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w=="], "postcss-value-parser": ["postcss-value-parser@4.2.0", "", {}, "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="], + "postgres": ["postgres@3.4.7", "", {}, "sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw=="], + "postgres-array": ["postgres-array@2.0.0", "", {}, "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="], "postgres-bytea": ["postgres-bytea@1.0.0", "", {}, "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w=="], @@ -2370,16 +3438,30 @@ "postgres-interval": ["postgres-interval@1.2.0", "", { "dependencies": { "xtend": "^4.0.0" } }, "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ=="], + "posthog-js": ["posthog-js@1.299.0", "", { "dependencies": { "@posthog/core": "1.6.0", "core-js": "^3.38.1", "fflate": "^0.4.8", "preact": "^10.19.3", "web-vitals": "^4.2.4" } }, "sha512-euHXKcEqQpRJNWitudVl4/doTJsftgaBDRLNGczt/v3S9N6ppLMzEOmeoqvNhNDIlpxGVlTvSawfw9HeW1r5nA=="], + "postject": ["postject@1.0.0-alpha.6", "", { "dependencies": { "commander": "^9.4.0" }, "bin": { "postject": "dist/cli.js" } }, "sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A=="], + "preact": ["preact@10.24.3", "", {}, "sha512-Z2dPnBnMUfyQfSQ+GBdsGa16hz35YmLmtTLhM169uW944hYL6xzTYkJjC07j+Wosz733pMWx0fgON3JNw1jJQA=="], + + "preact-render-to-string": ["preact-render-to-string@6.5.11", "", { "peerDependencies": { "preact": ">=10" } }, "sha512-ubnauqoGczeGISiOh6RjX0/cdaF8v/oDXIjO85XALCQjwQP+SB4RDXXtvZ6yTYSjG+PC1QRP2AhPgCEsM2EvUw=="], + "prettier": ["prettier@3.6.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="], + "prettier-plugin-organize-imports": ["prettier-plugin-organize-imports@4.3.0", "", { "peerDependencies": { "prettier": ">=2.0", "typescript": ">=2.9", "vue-tsc": "^2.1.0 || 3" }, "optionalPeers": ["vue-tsc"] }, "sha512-FxFz0qFhyBsGdIsb697f/EkvHzi5SZOhWAjxcx2dLt+Q532bAlhswcXGYB1yzjZ69kW8UoadFBw7TyNwlq96Iw=="], + + "pretty-format": ["pretty-format@27.5.1", "", { "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" } }, "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ=="], + "pretty-ms": ["pretty-ms@9.3.0", "", { "dependencies": { "parse-ms": "^4.0.0" } }, "sha512-gjVS5hOP+M3wMm5nmNOucbIrqudzs9v/57bWRHQWLYklXqoXKrVfYW2W9+glfGsqtPgpiz5WwyEEB+ksXIx3gQ=="], "prismjs": ["prismjs@1.30.0", "", {}, "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw=="], "proc-log": ["proc-log@2.0.1", "", {}, "sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw=="], + "process": ["process@0.11.10", "", {}, "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="], + + "process-nextick-args": ["process-nextick-args@2.0.1", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="], + "progress": ["progress@2.0.3", "", {}, "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="], "promise-inflight": ["promise-inflight@1.0.1", "", {}, "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g=="], @@ -2400,9 +3482,11 @@ "prr": ["prr@1.0.1", "", {}, "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw=="], + "public-encrypt": ["public-encrypt@4.0.3", "", { "dependencies": { "bn.js": "^4.1.0", "browserify-rsa": "^4.0.0", "create-hash": "^1.1.0", "parse-asn1": "^5.0.0", "randombytes": "^2.0.1", "safe-buffer": "^5.1.2" } }, "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q=="], + "pump": ["pump@3.0.3", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA=="], - "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], + "punycode": ["punycode@1.4.1", "", {}, "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="], "pupa": ["pupa@3.3.0", "", { "dependencies": { "escape-goat": "^4.0.0" } }, "sha512-LjgDO2zPtoXP2wJpDjZrGdojii1uqO0cnwKoIoUzkfS98HDmbeiGmYiXo3lXeFlq2xvne1QFQhwYXSUCLKtEuA=="], @@ -2410,10 +3494,16 @@ "quansync": ["quansync@0.2.11", "", {}, "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA=="], + "querystring-es3": ["querystring-es3@0.2.1", "", {}, "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA=="], + "queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], "quick-lru": ["quick-lru@5.1.1", "", {}, "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="], + "randombytes": ["randombytes@2.1.0", "", { "dependencies": { "safe-buffer": "^5.1.0" } }, "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ=="], + + "randomfill": ["randomfill@1.0.4", "", { "dependencies": { "randombytes": "^2.0.5", "safe-buffer": "^5.1.0" } }, "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw=="], + "range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="], "raw-body": ["raw-body@3.0.1", "", { "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.7.0", "unpipe": "1.0.0" } }, "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA=="], @@ -2424,14 +3514,24 @@ "react-devtools-core": ["react-devtools-core@6.1.5", "", { "dependencies": { "shell-quote": "^1.6.1", "ws": "^7" } }, "sha512-ePrwPfxAnB+7hgnEr8vpKxL9cmnp7F322t8oqcPshbIQQhDKgFDW4tjhF2wjVbdXF9O/nyuy3sQWd9JGpiLPvA=="], + "react-diff-view": ["react-diff-view@3.3.2", "", { "dependencies": { "classnames": "^2.3.2", "diff-match-patch": "^1.0.5", "gitdiff-parser": "^0.3.1", "lodash": "^4.17.21", "shallow-equal": "^3.1.0", "warning": "^4.0.3" }, "peerDependencies": { "react": ">=16.14.0" } }, "sha512-wPVq4ktTcGOHbhnWKU/gHLtd3N2Xd+OZ/XQWcKA06dsxlSsESePAumQILwHtiak2nMCMiWcIfBpqZ5OiharUPA=="], + + "react-docgen": ["react-docgen@7.1.1", "", { "dependencies": { "@babel/core": "^7.18.9", "@babel/traverse": "^7.18.9", "@babel/types": "^7.18.9", "@types/babel__core": "^7.18.0", "@types/babel__traverse": "^7.18.0", "@types/doctrine": "^0.0.9", "@types/resolve": "^1.20.2", "doctrine": "^3.0.0", "resolve": "^1.22.1", "strip-indent": "^4.0.0" } }, "sha512-hlSJDQ2synMPKFZOsKo9Hi8WWZTC7POR8EmWvTSjow+VDgKzkmjQvFm2fk0tmRw+f0vTOIYKlarR0iL4996pdg=="], + + "react-docgen-typescript": ["react-docgen-typescript@2.4.0", "", { "peerDependencies": { "typescript": ">= 4.3.x" } }, "sha512-ZtAp5XTO5HRzQctjPU0ybY0RRCQO19X/8fxn3w7y2VVTUbGHDKULPTL4ky3vB05euSgG5NpALhEhDPvQ56wvXg=="], + "react-dom": ["react-dom@19.2.0", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.0" } }, "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ=="], - "react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], + "react-error-boundary": ["react-error-boundary@3.1.4", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "react": ">=16.13.1" } }, "sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA=="], + + "react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="], "react-markdown": ["react-markdown@10.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "html-url-attributes": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "unified": "^11.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" }, "peerDependencies": { "@types/react": ">=18", "react": ">=18" } }, "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ=="], "react-reconciler": ["react-reconciler@0.32.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-2NPMOzgTlG0ZWdIf3qG+dcbLSoAc/uLfOwckc3ofy5sSK0pLJqnQLpUFxvGcN2rlXSjnVtGeeFLNimCQEj5gOQ=="], + "react-redux": ["react-redux@9.2.0", "", { "dependencies": { "@types/use-sync-external-store": "^0.0.6", "use-sync-external-store": "^1.4.0" }, "peerDependencies": { "@types/react": "^18.2.25 || ^19", "react": "^18.0 || ^19", "redux": "^5.0.0" }, "optionalPeers": ["@types/react", "redux"] }, "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g=="], + "react-remove-scroll": ["react-remove-scroll@2.7.1", "", { "dependencies": { "react-remove-scroll-bar": "^2.3.7", "react-style-singleton": "^2.2.3", "tslib": "^2.1.0", "use-callback-ref": "^1.3.3", "use-sidecar": "^1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-HpMh8+oahmIdOuS5aFKKY6Pyog+FNaZV/XyJOq7b4YFwsFHe5yYfdbIalI4k3vU2nSDql7YskmUseHsRrJqIPA=="], "react-remove-scroll-bar": ["react-remove-scroll-bar@2.3.8", "", { "dependencies": { "react-style-singleton": "^2.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q=="], @@ -2446,10 +3546,20 @@ "read-pkg": ["read-pkg@9.0.1", "", { "dependencies": { "@types/normalize-package-data": "^2.4.3", "normalize-package-data": "^6.0.0", "parse-json": "^8.0.0", "type-fest": "^4.6.0", "unicorn-magic": "^0.1.0" } }, "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA=="], - "readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], + "readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], "readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="], + "recast": ["recast@0.23.11", "", { "dependencies": { "ast-types": "^0.16.1", "esprima": "~4.0.0", "source-map": "~0.6.1", "tiny-invariant": "^1.3.3", "tslib": "^2.0.1" } }, "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA=="], + + "recharts": ["recharts@3.5.1", "", { "dependencies": { "@reduxjs/toolkit": "1.x.x || 2.x.x", "clsx": "^2.1.1", "decimal.js-light": "^2.5.1", "es-toolkit": "^1.39.3", "eventemitter3": "^5.0.1", "immer": "^10.1.1", "react-redux": "8.x.x || 9.x.x", "reselect": "5.1.1", "tiny-invariant": "^1.3.3", "use-sync-external-store": "^1.2.2", "victory-vendor": "^37.0.2" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-+v+HJojK7gnEgG6h+b2u7k8HH7FhyFUzAc4+cPrsjL4Otdgqr/ecXzAnHciqlzV1ko064eNcsdzrYOM78kankA=="], + + "redent": ["redent@3.0.0", "", { "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" } }, "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg=="], + + "redux": ["redux@5.0.1", "", {}, "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="], + + "redux-thunk": ["redux-thunk@3.1.0", "", { "peerDependencies": { "redux": "^5.0.0" } }, "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw=="], + "refractor": ["refractor@3.6.0", "", { "dependencies": { "hastscript": "^6.0.0", "parse-entities": "^2.0.0", "prismjs": "~1.27.0" } }, "sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA=="], "registry-auth-token": ["registry-auth-token@5.1.0", "", { "dependencies": { "@pnpm/npm-conf": "^2.1.0" } }, "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw=="], @@ -2458,10 +3568,18 @@ "rehype-highlight": ["rehype-highlight@7.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-text": "^4.0.0", "lowlight": "^3.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-k158pK7wdC2qL3M5NcZROZ2tR/l7zOzjxXd5VGdcfIyoijjQqpHd3JKtYSBDpDZ38UI2WJWuFAtkMDxmx5kstA=="], + "rehype-raw": ["rehype-raw@7.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="], + + "rehype-sanitize": ["rehype-sanitize@6.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-sanitize": "^5.0.0" } }, "sha512-CsnhKNsyI8Tub6L4sm5ZFsme4puGfc6pYylvXo1AeqaGbjOYyzNv3qZPwvs0oMJ39eryyeOdmxwUIo94IpEhqg=="], + + "remark-gfm": ["remark-gfm@4.0.1", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", "micromark-extension-gfm": "^3.0.0", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", "unified": "^11.0.0" } }, "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg=="], + "remark-parse": ["remark-parse@11.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", "micromark-util-types": "^2.0.0", "unified": "^11.0.0" } }, "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA=="], "remark-rehype": ["remark-rehype@11.1.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "mdast-util-to-hast": "^13.0.0", "unified": "^11.0.0", "vfile": "^6.0.0" } }, "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw=="], + "remark-stringify": ["remark-stringify@11.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-to-markdown": "^2.0.0", "unified": "^11.0.0" } }, "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw=="], + "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="], "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], @@ -2470,6 +3588,8 @@ "resedit": ["resedit@1.7.2", "", { "dependencies": { "pe-library": "^0.4.1" } }, "sha512-vHjcY2MlAITJhC0eRD/Vv8Vlgmu9Sd3LX9zZvtGzU5ZImdTN3+d6e/4mnTyV8vEbyf1sgNIrWxhWlrys52OkEA=="], + "reselect": ["reselect@5.1.1", "", {}, "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w=="], + "resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], "resolve-alpn": ["resolve-alpn@1.2.1", "", {}, "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g=="], @@ -2492,21 +3612,33 @@ "rimraf": ["rimraf@2.6.3", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "./bin.js" } }, "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA=="], + "ripemd160": ["ripemd160@2.0.3", "", { "dependencies": { "hash-base": "^3.1.2", "inherits": "^2.0.4" } }, "sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA=="], + "roarr": ["roarr@2.15.4", "", { "dependencies": { "boolean": "^3.0.1", "detect-node": "^2.0.4", "globalthis": "^1.0.1", "json-stringify-safe": "^5.0.1", "semver-compare": "^1.0.0", "sprintf-js": "^1.1.2" } }, "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A=="], + "robust-predicates": ["robust-predicates@3.0.2", "", {}, "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg=="], + "rolldown": ["rolldown@1.0.0-beta.43", "", { "dependencies": { "@oxc-project/types": "=0.94.0", "@rolldown/pluginutils": "1.0.0-beta.43", "ansis": "=4.2.0" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-beta.43", "@rolldown/binding-darwin-arm64": "1.0.0-beta.43", "@rolldown/binding-darwin-x64": "1.0.0-beta.43", "@rolldown/binding-freebsd-x64": "1.0.0-beta.43", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.43", "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.43", "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.43", "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.43", "@rolldown/binding-linux-x64-musl": "1.0.0-beta.43", "@rolldown/binding-openharmony-arm64": "1.0.0-beta.43", "@rolldown/binding-wasm32-wasi": "1.0.0-beta.43", "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.43", "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.43", "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.43" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-6RcqyRx0tY1MlRLnjXPp/849Rl/CPFhzpGGwNPEPjKwqBMqPq/Rbbkxasa8s0x+IkUk46ty4jazb5skZ/Vgdhw=="], "rolldown-plugin-dts": ["rolldown-plugin-dts@0.16.11", "", { "dependencies": { "@babel/generator": "^7.28.3", "@babel/parser": "^7.28.4", "@babel/types": "^7.28.4", "ast-kit": "^2.1.2", "birpc": "^2.6.1", "debug": "^4.4.3", "dts-resolver": "^2.1.2", "get-tsconfig": "^4.10.1", "magic-string": "^0.30.19" }, "peerDependencies": { "@ts-macro/tsc": "^0.3.6", "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-beta.9", "typescript": "^5.0.0", "vue-tsc": "~3.1.0" }, "optionalPeers": ["@ts-macro/tsc", "@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-9IQDaPvPqTx3RjG2eQCK5GYZITo203BxKunGI80AGYicu1ySFTUyugicAaTZWRzFWh9DSnzkgNeMNbDWBbSs0w=="], + "rollup": ["rollup@4.53.3", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.53.3", "@rollup/rollup-android-arm64": "4.53.3", "@rollup/rollup-darwin-arm64": "4.53.3", "@rollup/rollup-darwin-x64": "4.53.3", "@rollup/rollup-freebsd-arm64": "4.53.3", "@rollup/rollup-freebsd-x64": "4.53.3", "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", "@rollup/rollup-linux-arm-musleabihf": "4.53.3", "@rollup/rollup-linux-arm64-gnu": "4.53.3", "@rollup/rollup-linux-arm64-musl": "4.53.3", "@rollup/rollup-linux-loong64-gnu": "4.53.3", "@rollup/rollup-linux-ppc64-gnu": "4.53.3", "@rollup/rollup-linux-riscv64-gnu": "4.53.3", "@rollup/rollup-linux-riscv64-musl": "4.53.3", "@rollup/rollup-linux-s390x-gnu": "4.53.3", "@rollup/rollup-linux-x64-gnu": "4.53.3", "@rollup/rollup-linux-x64-musl": "4.53.3", "@rollup/rollup-openharmony-arm64": "4.53.3", "@rollup/rollup-win32-arm64-msvc": "4.53.3", "@rollup/rollup-win32-ia32-msvc": "4.53.3", "@rollup/rollup-win32-x64-gnu": "4.53.3", "@rollup/rollup-win32-x64-msvc": "4.53.3", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA=="], + + "roughjs": ["roughjs@4.6.6", "", { "dependencies": { "hachure-fill": "^0.5.2", "path-data-parser": "^0.1.0", "points-on-curve": "^0.2.0", "points-on-path": "^0.2.1" } }, "sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ=="], + "router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="], "run-applescript": ["run-applescript@7.1.0", "", {}, "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q=="], "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], + "rw": ["rw@1.3.3", "", {}, "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="], + "rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="], - "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], + + "safe-regex-test": ["safe-regex-test@1.1.0", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-regex": "^1.2.1" } }, "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw=="], "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], @@ -2534,8 +3666,16 @@ "set-getter": ["set-getter@0.1.1", "", { "dependencies": { "to-object-path": "^0.3.0" } }, "sha512-9sVWOy+gthr+0G9DzqqLaYNA7+5OKkSmcqjL9cBpDEaZrr3ShQlyX2cZ/O/ozE41oxn/Tt0LGEM/w4Rub3A3gw=="], + "setimmediate": ["setimmediate@1.0.5", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="], + "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="], + "sha.js": ["sha.js@2.4.12", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.0" }, "bin": { "sha.js": "bin.js" } }, "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w=="], + + "shallow-equal": ["shallow-equal@3.1.0", "", {}, "sha512-pfVOw8QZIXpMbhBWvzBISicvToTiM5WBF1EeAUZDDSb5Dt29yl4AYbyywbJFSEsRUMr7gJaxqCdr4L3tQf9wVg=="], + + "sharp": ["sharp@0.33.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="], + "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], @@ -2554,8 +3694,12 @@ "simple-git": ["simple-git@3.28.0", "", { "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", "debug": "^4.4.0" } }, "sha512-Rs/vQRwsn1ILH1oBUy8NucJlXmnnLeLCfcvbSehkPzbv3wwoFWIdtfd6Ndo6ZPhlPsCZ60CPI4rxurnwAa+a2w=="], + "simple-swizzle": ["simple-swizzle@0.2.4", "", { "dependencies": { "is-arrayish": "^0.3.1" } }, "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw=="], + "simple-update-notifier": ["simple-update-notifier@2.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w=="], + "sirv": ["sirv@3.0.2", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g=="], + "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="], "skin-tone": ["skin-tone@2.0.0", "", { "dependencies": { "unicode-emoji-modifier-base": "^1.0.0" } }, "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA=="], @@ -2564,12 +3708,16 @@ "smart-buffer": ["smart-buffer@4.2.0", "", {}, "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="], + "smol-toml": ["smol-toml@1.5.2", "", {}, "sha512-QlaZEqcAH3/RtNyet1IPIYPsEWAaYyXXv1Krsi+1L/QHppjX4Ifm8MQsBISz9vE8cHicIq3clogsheili5vhaQ=="], + "socks": ["socks@2.8.7", "", { "dependencies": { "ip-address": "^10.0.1", "smart-buffer": "^4.2.0" } }, "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A=="], "socks-proxy-agent": ["socks-proxy-agent@7.0.0", "", { "dependencies": { "agent-base": "^6.0.2", "debug": "^4.3.3", "socks": "^2.6.2" } }, "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww=="], "sonda": ["sonda@0.9.0", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "open": "^10.1.2" }, "bin": { "sonda-angular": "bin/sonda-angular.js" } }, "sha512-abMPj/ki+FdVCKkC2tFahz3dMFQi5vlSyx5X8u9rUB6IMX7vWwBdv6rMj9XjE7iuWcf/OYn/jVOcXkIUmHzXUA=="], + "sonner": ["sonner@2.0.7", "", { "peerDependencies": { "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w=="], + "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="], @@ -2588,6 +3736,8 @@ "spdx-license-ids": ["spdx-license-ids@3.0.22", "", {}, "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ=="], + "split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="], + "sprintf-js": ["sprintf-js@1.1.3", "", {}, "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="], "ssri": ["ssri@9.0.1", "", { "dependencies": { "minipass": "^3.1.1" } }, "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q=="], @@ -2598,8 +3748,14 @@ "statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="], + "stoppable": ["stoppable@1.1.0", "", {}, "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw=="], + + "storybook": ["storybook@8.6.14", "", { "dependencies": { "@storybook/core": "8.6.14" }, "peerDependencies": { "prettier": "^2 || ^3" }, "optionalPeers": ["prettier"], "bin": { "sb": "./bin/index.cjs", "storybook": "./bin/index.cjs", "getstorybook": "./bin/index.cjs" } }, "sha512-sVKbCj/OTx67jhmauhxc2dcr1P+yOgz/x3h0krwjyMgdc5Oubvxyg4NYDZmzAw+ym36g/lzH8N0Ccp4dwtdfxw=="], + "stream-browserify": ["stream-browserify@3.0.0", "", { "dependencies": { "inherits": "~2.0.4", "readable-stream": "^3.5.0" } }, "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA=="], + "stream-http": ["stream-http@3.2.0", "", { "dependencies": { "builtin-status-codes": "^3.0.0", "inherits": "^2.0.4", "readable-stream": "^3.6.0", "xtend": "^4.0.2" } }, "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A=="], + "streamsearch": ["streamsearch@1.1.0", "", {}, "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="], "streamx": ["streamx@2.23.0", "", { "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" } }, "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg=="], @@ -2612,7 +3768,7 @@ "string-width-cjs": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], - "string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], + "string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="], "stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="], @@ -2620,9 +3776,15 @@ "strip-ansi-cjs": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "strip-bom": ["strip-bom@3.0.0", "", {}, "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA=="], + "strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="], - "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "strip-indent": ["strip-indent@4.1.1", "", {}, "sha512-SlyRoSkdh1dYP0PzclLE7r0M9sgbFKKMFXpFRUMNuKhQSbC6VQIGzq3E0qsfvGJaUFJPGv6Ws1NZ/haTAjfbMA=="], + + "strip-json-comments": ["strip-json-comments@5.0.3", "", {}, "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw=="], + + "stripe": ["stripe@18.5.0", "", { "dependencies": { "qs": "^6.11.0" }, "peerDependencies": { "@types/node": ">=12.x.x" }, "optionalPeers": ["@types/node"] }, "sha512-Hp+wFiEQtCB0LlNgcFh5uVyKznpDjzyUZ+CNVEf+I3fhlYvh7rZruIg+jOwzJRCpy0ZTPMjlzm7J2/M2N6d+DA=="], "strnum": ["strnum@2.1.1", "", {}, "sha512-7ZvoFTiCnGxBtDqJ//Cu6fWtZtc7Y3x+QOirG15wztbdngGSkht27o2pyGWrVy0b4WAy3jbKmnoK6g5VlVNUUw=="], @@ -2634,6 +3796,10 @@ "style-to-object": ["style-to-object@1.0.9", "", { "dependencies": { "inline-style-parser": "0.2.4" } }, "sha512-G4qppLgKu/k6FwRpHiGiKPaPTFcG3g4wNVX/Qsfu+RqQM30E7Tyu/TEgxcL9PNLF5pdRLwQdE3YKKf+KF2Dzlw=="], + "styled-jsx": ["styled-jsx@5.1.6", "", { "dependencies": { "client-only": "0.0.1" }, "peerDependencies": { "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" } }, "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA=="], + + "stylis": ["stylis@4.3.6", "", {}, "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ=="], + "stylus": ["stylus@0.64.0", "", { "dependencies": { "@adobe/css-tools": "~4.3.3", "debug": "^4.3.2", "glob": "^10.4.5", "sax": "~1.4.1", "source-map": "^0.7.3" }, "bin": { "stylus": "bin/stylus" } }, "sha512-ZIdT8eUv8tegmqy1tTIdJv9We2DumkNZFdCF5mz/Kpq3OcTaxSuCAYZge6HKK2CmNC02G1eJig2RV7XTw5hQrA=="], "sumchecker": ["sumchecker@3.0.1", "", { "dependencies": { "debug": "^4.1.0" } }, "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg=="], @@ -2646,6 +3812,8 @@ "swr": ["swr@2.3.6", "", { "dependencies": { "dequal": "^2.0.3", "use-sync-external-store": "^1.4.0" }, "peerDependencies": { "react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-wfHRmHWk/isGNMwlLGlZX5Gzz/uTgo0o2IRuTMcf4CPuPFJZlq0rDaKUx+ozB5nBOReNV1kiOyzMfj+MBMikLw=="], + "tabbable": ["tabbable@6.3.0", "", {}, "sha512-EIHvdY5bPLuWForiR/AN2Bxngzpuwn1is4asboytXtpTgsArc+WmSJKVLlhdh71u7jFcryDqB2A8lQvj78MkyQ=="], + "tailwind-merge": ["tailwind-merge@3.3.1", "", {}, "sha512-gBXpgUm/3rp1lMZZrM/w7D8GKqshif0zAymAhbCyIt8KMe+0v9DQ7cdYLR4FHH/cKpdTXb+A/tKKU3eolfsI+g=="], "tailwindcss": ["tailwindcss@4.1.14", "", {}, "sha512-b7pCxjGO98LnxVkKjaZSDeNuljC4ueKUddjENJOADtubtdo8llTaJy7HwBMeLNSSo2N5QIAgklslK1+Ir8r6CA=="], @@ -2670,8 +3838,12 @@ "throttleit": ["throttleit@2.1.0", "", {}, "sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw=="], + "timers-browserify": ["timers-browserify@2.0.12", "", { "dependencies": { "setimmediate": "^1.0.4" } }, "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ=="], + "tiny-async-pool": ["tiny-async-pool@1.3.0", "", { "dependencies": { "semver": "^5.5.0" } }, "sha512-01EAw5EDrcVrdgyCLgoSPvqznC0sVxDSVeiOz09FUpjh71G79VCqneOr+xvt7T1r76CF6ZZfPjHorN2+d+3mqA=="], + "tiny-invariant": ["tiny-invariant@1.3.3", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="], + "tinycolor2": ["tinycolor2@1.6.0", "", {}, "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="], "tinyexec": ["tinyexec@1.0.1", "", {}, "sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw=="], @@ -2680,6 +3852,10 @@ "tinygradient": ["tinygradient@1.1.5", "", { "dependencies": { "@types/tinycolor2": "^1.4.0", "tinycolor2": "^1.0.0" } }, "sha512-8nIfc2vgQ4TeLnk2lFj4tRLvvJwEfQuabdsmvDdQPT0xlk9TaNtpGd6nNRxXoK6vQhN6RSzj+Cnp5tTQmpxmbw=="], + "tinyrainbow": ["tinyrainbow@1.2.0", "", {}, "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ=="], + + "tinyspy": ["tinyspy@3.0.2", "", {}, "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q=="], + "tldts": ["tldts@7.0.17", "", { "dependencies": { "tldts-core": "^7.0.17" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-Y1KQBgDd/NUc+LfOtKS6mNsC9CCaH+m2P1RoIZy7RAPo3C3/t8X45+zgut31cRZtZ3xKPjfn3TkGTrctC2TQIQ=="], "tldts-core": ["tldts-core@7.0.17", "", {}, "sha512-DieYoGrP78PWKsrXr8MZwtQ7GLCUeLxihtjC1jZsW1DnvSMdKPitJSe8OSYDM2u5H6g3kWJZpePqkp43TfLh0g=="], @@ -2688,6 +3864,8 @@ "tmp-promise": ["tmp-promise@3.0.3", "", { "dependencies": { "tmp": "^0.2.0" } }, "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ=="], + "to-buffer": ["to-buffer@1.2.2", "", { "dependencies": { "isarray": "^2.0.5", "safe-buffer": "^5.2.1", "typed-array-buffer": "^1.0.3" } }, "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw=="], + "to-object-path": ["to-object-path@0.3.0", "", { "dependencies": { "kind-of": "^3.0.2" } }, "sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg=="], "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], @@ -2698,6 +3876,8 @@ "token-types": ["token-types@6.1.1", "", { "dependencies": { "@borewit/text-codec": "^0.1.0", "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-kh9LVIWH5CnL63Ipf0jhlBIy0UsrMj/NJDfpsy1SqOXlLKEVyXXYrnFxFT1yOOYVGBSApeVnjPw/sBz5BfEjAQ=="], + "totalist": ["totalist@3.0.1", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="], + "tough-cookie": ["tough-cookie@6.0.0", "", { "dependencies": { "tldts": "^7.0.5" } }, "sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w=="], "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], @@ -2710,6 +3890,10 @@ "truncate-utf8-bytes": ["truncate-utf8-bytes@1.0.2", "", { "dependencies": { "utf8-byte-length": "^1.0.1" } }, "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ=="], + "ts-dedent": ["ts-dedent@2.2.0", "", {}, "sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ=="], + + "tsconfig-paths": ["tsconfig-paths@4.2.0", "", { "dependencies": { "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg=="], + "tsdown": ["tsdown@0.15.7", "", { "dependencies": { "ansis": "^4.2.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "debug": "^4.4.3", "diff": "^8.0.2", "empathic": "^2.0.0", "hookable": "^5.5.3", "rolldown": "latest", "rolldown-plugin-dts": "^0.16.11", "semver": "^7.7.3", "tinyexec": "^1.0.1", "tinyglobby": "^0.2.15", "tree-kill": "^1.2.2", "unconfig": "^7.3.3" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "publint": "^0.3.0", "typescript": "^5.0.0", "unplugin-lightningcss": "^0.4.0", "unplugin-unused": "^0.5.0" }, "optionalPeers": ["@arethetypeswrong/core", "publint", "typescript", "unplugin-lightningcss", "unplugin-unused"], "bin": { "tsdown": "dist/run.mjs" } }, "sha512-uFaVgWAogjOMqjY+CQwrUt3C6wzy6ynt82CIoXymnbS17ipUZ8WDXUceJjkislUahF/BZc5+W44Ue3p2oWtqUg=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], @@ -2718,10 +3902,14 @@ "tsx": ["tsx@4.20.6", "", { "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg=="], + "tty-browserify": ["tty-browserify@0.0.1", "", {}, "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw=="], + "type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="], "type-is": ["type-is@2.0.1", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="], + "typed-array-buffer": ["typed-array-buffer@1.0.3", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "is-typed-array": "^1.1.14" } }, "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw=="], + "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], "ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="], @@ -2736,6 +3924,8 @@ "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], + "unenv": ["unenv@2.0.0-rc.24", "", { "dependencies": { "pathe": "^2.0.3" } }, "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw=="], + "unicode-emoji-modifier-base": ["unicode-emoji-modifier-base@1.0.0", "", {}, "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g=="], "unicorn-magic": ["unicorn-magic@0.1.0", "", {}, "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ=="], @@ -2772,6 +3962,8 @@ "unplugin-unused": ["unplugin-unused@0.2.3", "", { "dependencies": { "@rollup/pluginutils": "^5.1.0", "js-tokens": "^9.0.0", "picocolors": "^1.0.1", "pkg-types": "^1.2.0", "unplugin": "^1.14.0" } }, "sha512-qX708+nM4zi51RPMPgvOSqRs/73kUFKUO49oaBngg2t/VW5MhdbTkSQG/S1HEGsIvZcB/t32KzbISCF0n+UPSw=="], + "unplugin-utils": ["unplugin-utils@0.3.1", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-5lWVjgi6vuHhJ526bI4nlCOmkCIF3nnfXkCMDeMJrtdvxTs6ZFCM8oNufGTsDbKv/tJ/xj8RpvXjRuPBZJuJog=="], + "until-async": ["until-async@3.0.2", "", {}, "sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw=="], "update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="], @@ -2780,6 +3972,8 @@ "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + "url": ["url@0.11.4", "", { "dependencies": { "punycode": "^1.4.1", "qs": "^6.12.3" } }, "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg=="], + "urlpattern-polyfill": ["urlpattern-polyfill@10.1.0", "", {}, "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw=="], "use-callback-ref": ["use-callback-ref@1.3.3", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="], @@ -2788,8 +3982,12 @@ "use-sync-external-store": ["use-sync-external-store@1.6.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w=="], + "usehooks-ts": ["usehooks-ts@3.1.1", "", { "dependencies": { "lodash.debounce": "^4.0.8" }, "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-I4diPp9Cq6ieSUH2wu+fDAVQO43xwtulo+fKEidHUwZPnYImbtkTjzIJYcDcJqxgmX31GVqNFURodvcgHcW0pA=="], + "utf8-byte-length": ["utf8-byte-length@1.0.5", "", {}, "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA=="], + "util": ["util@0.12.5", "", { "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", "which-typed-array": "^1.1.2" } }, "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA=="], + "util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], "uuid": ["uuid@13.0.0", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w=="], @@ -2802,24 +4000,72 @@ "vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="], + "vfile-location": ["vfile-location@5.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="], + "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="], + "victory-vendor": ["victory-vendor@37.3.6", "", { "dependencies": { "@types/d3-array": "^3.0.3", "@types/d3-ease": "^3.0.0", "@types/d3-interpolate": "^3.0.1", "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/d3-time": "^3.0.0", "@types/d3-timer": "^3.0.0", "d3-array": "^3.1.6", "d3-ease": "^3.0.1", "d3-interpolate": "^3.0.1", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", "d3-time": "^3.0.0", "d3-timer": "^3.0.1" } }, "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ=="], + + "vite": ["vite@7.2.6", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ=="], + + "vite-dev-rpc": ["vite-dev-rpc@1.1.0", "", { "dependencies": { "birpc": "^2.4.0", "vite-hot-client": "^2.1.0" }, "peerDependencies": { "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.1 || ^7.0.0-0" } }, "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A=="], + + "vite-hot-client": ["vite-hot-client@2.1.0", "", { "peerDependencies": { "vite": "^2.6.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 || ^7.0.0-0" } }, "sha512-7SpgZmU7R+dDnSmvXE1mfDtnHLHQSisdySVR7lO8ceAXvM0otZeuQQ6C8LrS5d/aYyP/QZ0hI0L+dIPrm4YlFQ=="], + + "vite-plugin-inspect": ["vite-plugin-inspect@11.3.3", "", { "dependencies": { "ansis": "^4.1.0", "debug": "^4.4.1", "error-stack-parser-es": "^1.0.5", "ohash": "^2.0.11", "open": "^10.2.0", "perfect-debounce": "^2.0.0", "sirv": "^3.0.1", "unplugin-utils": "^0.3.0", "vite-dev-rpc": "^1.1.0" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0" } }, "sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA=="], + + "vite-plugin-node-polyfills": ["vite-plugin-node-polyfills@0.24.0", "", { "dependencies": { "@rollup/plugin-inject": "^5.0.5", "node-stdlib-browser": "^1.2.0" }, "peerDependencies": { "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-GA9QKLH+vIM8NPaGA+o2t8PDfFUl32J8rUp1zQfMKVJQiNkOX4unE51tR6ppl6iKw5yOrDAdSH7r/UIFLCVhLw=="], + + "vite-plugin-storybook-nextjs": ["vite-plugin-storybook-nextjs@1.1.5", "", { "dependencies": { "@next/env": "^15.0.3", "image-size": "^2.0.0", "magic-string": "^0.30.11", "module-alias": "^2.2.3", "ts-dedent": "^2.2.0" }, "peerDependencies": { "@storybook/test": "^8.3.0", "next": "^14.1.0 || ^15.0.0", "storybook": "^8.3.0", "vite": "^5.0.0 || ^6.0.0" } }, "sha512-doFAXLvfEtIgMbDA+0VzyanoWoAUAwMLMfTpFnv3rxaN/tGHtWAwyhK73OA3UJzyXrp6rDPTqbjWUYJ6noxNww=="], + + "vm-browserify": ["vm-browserify@1.1.2", "", {}, "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="], + + "vscode-jsonrpc": ["vscode-jsonrpc@8.2.0", "", {}, "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA=="], + + "vscode-languageserver": ["vscode-languageserver@9.0.1", "", { "dependencies": { "vscode-languageserver-protocol": "3.17.5" }, "bin": { "installServerIntoExtension": "bin/installServerIntoExtension" } }, "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g=="], + + "vscode-languageserver-protocol": ["vscode-languageserver-protocol@3.17.5", "", { "dependencies": { "vscode-jsonrpc": "8.2.0", "vscode-languageserver-types": "3.17.5" } }, "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg=="], + + "vscode-languageserver-textdocument": ["vscode-languageserver-textdocument@1.0.12", "", {}, "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA=="], + + "vscode-languageserver-types": ["vscode-languageserver-types@3.17.5", "", {}, "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg=="], + + "vscode-uri": ["vscode-uri@3.0.8", "", {}, "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw=="], + + "walk-up-path": ["walk-up-path@4.0.0", "", {}, "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A=="], + + "warning": ["warning@4.0.3", "", { "dependencies": { "loose-envify": "^1.0.0" } }, "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w=="], + "wcwidth": ["wcwidth@1.0.1", "", { "dependencies": { "defaults": "^1.0.3" } }, "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg=="], + "web-namespaces": ["web-namespaces@2.0.1", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="], + + "web-vitals": ["web-vitals@4.2.4", "", {}, "sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw=="], + "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], + "webpack-bundle-analyzer": ["webpack-bundle-analyzer@4.10.1", "", { "dependencies": { "@discoveryjs/json-ext": "0.5.7", "acorn": "^8.0.4", "acorn-walk": "^8.0.0", "commander": "^7.2.0", "debounce": "^1.2.1", "escape-string-regexp": "^4.0.0", "gzip-size": "^6.0.0", "html-escaper": "^2.0.2", "is-plain-object": "^5.0.0", "opener": "^1.5.2", "picocolors": "^1.0.0", "sirv": "^2.0.3", "ws": "^7.3.1" }, "bin": { "webpack-bundle-analyzer": "lib/bin/analyzer.js" } }, "sha512-s3P7pgexgT/HTUSYgxJyn28A+99mmLq4HsJepMPzu0R8ImJc52QNqaFYW1Z2z2uIb1/J3eYgaAWVpaC+v/1aAQ=="], + "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], + "whatwg-mimetype": ["whatwg-mimetype@3.0.0", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="], + "whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], "when-exit": ["when-exit@2.1.4", "", {}, "sha512-4rnvd3A1t16PWzrBUcSDZqcAmsUIy4minDXT/CZ8F2mVDgd65i4Aalimgz1aQkRGU0iH5eT5+6Rx2TK8o443Pg=="], "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + "which-typed-array": ["which-typed-array@1.1.19", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw=="], + "widest-line": ["widest-line@5.0.0", "", { "dependencies": { "string-width": "^7.0.0" } }, "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA=="], "wordwrap": ["wordwrap@1.0.0", "", {}, "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q=="], + "workerd": ["workerd@1.20251125.0", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20251125.0", "@cloudflare/workerd-darwin-arm64": "1.20251125.0", "@cloudflare/workerd-linux-64": "1.20251125.0", "@cloudflare/workerd-linux-arm64": "1.20251125.0", "@cloudflare/workerd-windows-64": "1.20251125.0" }, "bin": { "workerd": "bin/workerd" } }, "sha512-oQYfgu3UZ15HlMcEyilKD1RdielRnKSG5MA0xoi1theVs99Rop9AEFYicYCyK1R4YjYblLRYEiL1tMgEFqpReA=="], + + "wrangler": ["wrangler@4.51.0", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.4.1", "@cloudflare/unenv-preset": "2.7.11", "blake3-wasm": "2.1.5", "esbuild": "0.25.4", "miniflare": "4.20251125.0", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20251125.0" }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20251125.0" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js" } }, "sha512-JHv+58UxM2//e4kf9ASDwg016xd/OdDNDUKW6zLQyE7Uc9ayYKX1QJ9NsYtpo4dC1dfg6rT67pf1aNK1cTzUDg=="], + "wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], "wrap-ansi-cjs": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], @@ -2850,6 +4096,8 @@ "yauzl": ["yauzl@2.10.0", "", { "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } }, "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g=="], + "yjs": ["yjs@13.6.27", "", { "dependencies": { "lib0": "^0.2.99" } }, "sha512-OIDwaflOaq4wC6YlPBy2L6ceKeKuF7DeTxx+jPzv1FHn9tCZ0ZwSRnUBxD05E3yed46fv/FWJbvR+Ud7x0L7zw=="], + "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], "yoctocolors": ["yoctocolors@2.1.2", "", {}, "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug=="], @@ -2858,10 +4106,16 @@ "yoga-layout": ["yoga-layout@3.2.1", "", {}, "sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ=="], - "zod": ["zod@4.1.13", "", {}, "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig=="], + "youch": ["youch@4.1.0-beta.10", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@poppinss/dumper": "^0.6.4", "@speed-highlight/core": "^1.2.7", "cookie": "^1.0.2", "youch-core": "^0.3.3" } }, "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ=="], + + "youch-core": ["youch-core@0.3.3", "", { "dependencies": { "@poppinss/exception": "^1.2.2", "error-stack-parser-es": "^1.0.5" } }, "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA=="], + + "zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], "zod-to-json-schema": ["zod-to-json-schema@3.24.6", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg=="], + "zod-validation-error": ["zod-validation-error@4.0.2", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ=="], + "zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="], "@ai-sdk/anthropic/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@3.0.10", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-T1gZ76gEIwffep6MWI0QNy9jgoybUHE7TRaHB5k54K8mF91ciGFlbtCGxDYhMH3nCRergKwYFIDeFF0hJSIQHQ=="], @@ -2886,15 +4140,59 @@ "@babel/code-frame/js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], + "@babel/core/@babel/generator": ["@babel/generator@7.28.5", "", { "dependencies": { "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ=="], + + "@babel/core/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], + + "@babel/core/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], + + "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], + + "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], + + "@babel/helper-module-imports/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@babel/helper-module-transforms/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@babel/helpers/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@babel/template/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], + + "@babel/template/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@babel/traverse/@babel/generator": ["@babel/generator@7.28.5", "", { "dependencies": { "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ=="], + + "@babel/traverse/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], + + "@babel/traverse/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@blink-sdk/compute-protocol/zod": ["zod@4.1.13", "", {}, "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig=="], + "@blink-sdk/github/file-type": ["file-type@21.0.0", "", { "dependencies": { "@tokenizer/inflate": "^0.2.7", "strtok3": "^10.2.2", "token-types": "^6.0.0", "uint8array-extras": "^1.4.0" } }, "sha512-ek5xNX2YBYlXhiUXui3D/BXa3LdqPmoLJ7rqEx2bKJ7EAUEfmXgW0Das7Dc6Nr9MvqaOnIqiPV0mZk/r/UpNAg=="], + "@blink-sdk/scout-agent/ai": ["ai@5.0.106", "", { "dependencies": { "@ai-sdk/gateway": "2.0.18", "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.18", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-M5obwavxSJJ3tGlAFqI6eltYNJB0D20X6gIBCFx/KVorb/X1fxVVfiZZpZb+Gslu4340droSOjT0aKQFCarNVg=="], + "@blink-sdk/scout-agent/tsdown": ["tsdown@0.3.1", "", { "dependencies": { "cac": "^6.7.14", "chokidar": "^4.0.1", "consola": "^3.2.3", "debug": "^4.3.7", "picocolors": "^1.1.1", "pkg-types": "^1.2.1", "rolldown": "nightly", "tinyglobby": "^0.2.10", "unconfig": "^0.6.0", "unplugin-isolated-decl": "^0.7.2", "unplugin-unused": "^0.2.3" }, "bin": { "tsdown": "bin/tsdown.js" } }, "sha512-5WLFU7f2NRnsez0jxi7m2lEQNPvBOdos0W8vHvKDnS6tYTfOfmZ5D2z/G9pFTQSjeBhoi6BFRMybc4LzCOKR8A=="], + "@blink-sdk/scout-agent/zod": ["zod@4.1.13", "", {}, "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig=="], + + "@blink.so/api/zod": ["zod@4.1.13", "", {}, "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig=="], + + "@blink.so/site/dotenv": ["dotenv@16.6.1", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="], + + "@blink.so/site/next-auth": ["next-auth@5.0.0-beta.30", "", { "dependencies": { "@auth/core": "0.41.0" }, "peerDependencies": { "@simplewebauthn/browser": "^9.0.1", "@simplewebauthn/server": "^9.0.2", "next": "^14.0.0-0 || ^15.0.0 || ^16.0.0", "nodemailer": "^7.0.7", "react": "^18.2.0 || ^19.0.0" }, "optionalPeers": ["@simplewebauthn/browser", "@simplewebauthn/server", "nodemailer"] }, "sha512-+c51gquM3F6nMVmoAusRJ7RIoY0K4Ts9HCCwyy/BRoe4mp3msZpOzYMyb5LAYc1wSo74PMQkGDcaghIO7W6Xjg=="], + + "@blink/desktop/@blink.so/api": ["@blink.so/api@0.0.11", "", { "optionalDependencies": { "@blink-sdk/compute-protocol": ">= 0.0.2" }, "peerDependencies": { "ai": ">= 5", "react": ">= 18", "zod": ">= 4" }, "optionalPeers": ["react"] }, "sha512-4JW0fsGFn8IN5r+FpdbkqXkFqyCXQ8sDXoETdIBczLe3/+JP0Q2ItvN9XtR/eLNIshIL9Yz+gZtB6AVWQIcIWg=="], + "@blink/desktop/ai": ["ai@5.0.75", "", { "dependencies": { "@ai-sdk/gateway": "2.0.0", "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.12", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-CK1fAmwhaTnuA+Ms0LiQKeyuikASwUwDFdPccvAAo6w/zlPhwkv1zmis3RW26r+I3EoHppMHwEDamv3XcRLOuQ=="], "@blink/desktop/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], - "@develar/schema-utils/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + "@blink/desktop/lucide-react": ["lucide-react@0.544.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-t5tS44bqd825zAW45UQxpG2CvcC4urOwn2TrwSH8u+MjeE+1NnWl6QqeQ/6NdjMqdOygyiT9p3Ev0p1NJykxjw=="], + + "@cspotcode/source-map-support/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], "@electron/asar/commander": ["commander@5.1.0", "", {}, "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg=="], @@ -2928,12 +4226,16 @@ "@electron/windows-sign/fs-extra": ["fs-extra@11.3.2", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A=="], + "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], + "@google/gemini-cli-core/@opentelemetry/exporter-trace-otlp-http": ["@opentelemetry/exporter-trace-otlp-http@0.203.0", "", { "dependencies": { "@opentelemetry/core": "2.0.1", "@opentelemetry/otlp-exporter-base": "0.203.0", "@opentelemetry/otlp-transformer": "0.203.0", "@opentelemetry/resources": "2.0.1", "@opentelemetry/sdk-trace-base": "2.0.1" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-ZDiaswNYo0yq/cy1bBLJFe691izEJ6IgNmkjm4C6kE9ub/OMQqDXORx2D2j8fzTBTxONyzusbaZlqtfmyqURPw=="], "@google/gemini-cli-core/@opentelemetry/instrumentation-http": ["@opentelemetry/instrumentation-http@0.203.0", "", { "dependencies": { "@opentelemetry/core": "2.0.1", "@opentelemetry/instrumentation": "0.203.0", "@opentelemetry/semantic-conventions": "^1.29.0", "forwarded-parse": "2.1.2" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-y3uQAcCOAwnO6vEuNVocmpVzG3PER6/YZqbPbbffDdJ9te5NkHEkfSMNzlC3+v7KlE+WinPGc3N7MR30G1HY2g=="], "@google/gemini-cli-core/@opentelemetry/sdk-node": ["@opentelemetry/sdk-node@0.203.0", "", { "dependencies": { "@opentelemetry/api-logs": "0.203.0", "@opentelemetry/core": "2.0.1", "@opentelemetry/exporter-logs-otlp-grpc": "0.203.0", "@opentelemetry/exporter-logs-otlp-http": "0.203.0", "@opentelemetry/exporter-logs-otlp-proto": "0.203.0", "@opentelemetry/exporter-metrics-otlp-grpc": "0.203.0", "@opentelemetry/exporter-metrics-otlp-http": "0.203.0", "@opentelemetry/exporter-metrics-otlp-proto": "0.203.0", "@opentelemetry/exporter-prometheus": "0.203.0", "@opentelemetry/exporter-trace-otlp-grpc": "0.203.0", "@opentelemetry/exporter-trace-otlp-http": "0.203.0", "@opentelemetry/exporter-trace-otlp-proto": "0.203.0", "@opentelemetry/exporter-zipkin": "2.0.1", "@opentelemetry/instrumentation": "0.203.0", "@opentelemetry/propagator-b3": "2.0.1", "@opentelemetry/propagator-jaeger": "2.0.1", "@opentelemetry/resources": "2.0.1", "@opentelemetry/sdk-logs": "0.203.0", "@opentelemetry/sdk-metrics": "2.0.1", "@opentelemetry/sdk-trace-base": "2.0.1", "@opentelemetry/sdk-trace-node": "2.0.1", "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.3.0 <1.10.0" } }, "sha512-zRMvrZGhGVMvAbbjiNQW3eKzW/073dlrSiAKPVWmkoQzah9wfynpVPeL55f9fVIm0GaBxTLcPeukWGy0/Wj7KQ=="], + "@google/gemini-cli-core/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], + "@google/gemini-cli-core/diff": ["diff@7.0.0", "", {}, "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw=="], "@google/gemini-cli-core/marked": ["marked@15.0.12", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA=="], @@ -2956,17 +4258,21 @@ "@jaaydenh/gemini-cli/lowlight": ["lowlight@3.3.0", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.0.0", "highlight.js": "~11.11.0" } }, "sha512-0JNhgFoPvP6U6lE/UdVsSq99tn6DhjjpAj5MxG49ewd2mOBVtwWYIT8ClyABhq198aXXODMU6Ox8DrGy/CpTZQ=="], - "@jaaydenh/gemini-cli/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "@jaaydenh/gemini-cli/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], "@joshua.litt/get-ripgrep/fs-extra": ["fs-extra@11.3.2", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A=="], "@joshua.litt/get-ripgrep/got": ["got@14.4.9", "", { "dependencies": { "@sindresorhus/is": "^7.0.1", "@szmarczak/http-timer": "^5.0.1", "cacheable-lookup": "^7.0.0", "cacheable-request": "^12.0.1", "decompress-response": "^6.0.0", "form-data-encoder": "^4.0.2", "http2-wrapper": "^2.2.1", "lowercase-keys": "^3.0.0", "p-cancelable": "^4.0.1", "responselike": "^3.0.0", "type-fest": "^4.26.1" } }, "sha512-Dbu075Jwm3QwNCIoCenqkqY8l2gd7e/TanuhMbzZIEsb1mpAneImSusKhZ+XdqqC3S91SDV/1SdWpGXKAlm8tA=="], + "@joshua.litt/get-ripgrep/path-exists": ["path-exists@5.0.0", "", {}, "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ=="], + + "@joshwooding/vite-plugin-react-docgen-typescript/magic-string": ["magic-string@0.27.0", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.13" } }, "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA=="], + "@malept/flatpak-bundler/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], - "@modelcontextprotocol/sdk/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + "@napi-rs/wasm-runtime/@emnapi/runtime": ["@emnapi/runtime@1.7.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA=="], - "@modelcontextprotocol/sdk/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "@neondatabase/serverless/@types/node": ["@types/node@22.18.8", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-pAZSHMiagDR7cARo/cch1f3rXy0AEXwsVsVH09FcyeJVAzCnGgmYis7P3JidtTUjyadhTeSo8TgRPswstghDaw=="], "@npmcli/fs/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], @@ -3154,6 +4460,16 @@ "@pnpm/network.ca-file/graceful-fs": ["graceful-fs@4.2.10", "", {}, "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="], + "@poppinss/dumper/@sindresorhus/is": ["@sindresorhus/is@7.1.0", "", {}, "sha512-7F/yz2IphV39hiS2zB4QYVkivrptHHh0K8qJJd9HhuWSdvf8AN7NpebW3CcDZDBQsUPMoDKWsY2WWgW7bqOcfA=="], + + "@poppinss/dumper/supports-color": ["supports-color@10.2.2", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="], + + "@radix-ui/react-separator/@radix-ui/react-primitive": ["@radix-ui/react-primitive@2.1.4", "", { "dependencies": { "@radix-ui/react-slot": "1.2.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-9hQc4+GNVtJAIEPEqlYqW5RiYdrr8ea5XQ0ZOnD6fgru+83kqT15mq2OCcbe8KnjRZl5vF3ks69AKz3kh1jrhg=="], + + "@reduxjs/toolkit/immer": ["immer@11.0.1", "", {}, "sha512-naDCyggtcBWANtIrjQEajhhBEuL9b0Zg4zmlWK2CzS6xCWSE39/vvf4LqnMjUAWHBhot4m9MHCM/Z+mfWhUkiA=="], + + "@rolldown/binding-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.0.7", "", { "dependencies": { "@emnapi/core": "^1.5.0", "@emnapi/runtime": "^1.5.0", "@tybys/wasm-util": "^0.10.1" } }, "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw=="], + "@slack/bolt/path-to-regexp": ["path-to-regexp@8.3.0", "", {}, "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA=="], "@slack/logger/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], @@ -3164,6 +4480,8 @@ "@slack/web-api/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], + "@storybook/core/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + "@tailwindcss/oxide/tar": ["tar@7.5.1", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-nlGpxf+hv0v7GkWBK2V9spgactGOp0qvfWRxUMjqHyzrt3SgwE48DIv/FhqPHJYLHpgW1opq3nERbz5Anq7n1g=="], "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.5.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" }, "bundled": true }, "sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg=="], @@ -3178,6 +4496,22 @@ "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@testing-library/dom/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + + "@testing-library/jest-dom/chalk": ["chalk@3.0.0", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg=="], + + "@testing-library/jest-dom/dom-accessibility-api": ["dom-accessibility-api@0.6.3", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="], + + "@tokenizer/inflate/fflate": ["fflate@0.8.2", "", {}, "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="], + + "@types/babel__generator/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@types/babel__template/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], + + "@types/babel__template/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + + "@types/babel__traverse/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + "@types/body-parser/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], "@types/bunyan/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], @@ -3222,44 +4556,58 @@ "@types/tedious/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], + "@types/update-notifier/boxen": ["boxen@7.1.1", "", { "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^7.0.1", "chalk": "^5.2.0", "cli-boxes": "^3.0.0", "string-width": "^5.1.2", "type-fest": "^2.13.0", "widest-line": "^4.0.1", "wrap-ansi": "^8.1.0" } }, "sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog=="], + "@types/ws/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], "@types/yauzl/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], - "accepts/mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], + "@vitest/expect/@vitest/utils": ["@vitest/utils@2.0.5", "", { "dependencies": { "@vitest/pretty-format": "2.0.5", "estree-walker": "^3.0.3", "loupe": "^3.1.1", "tinyrainbow": "^1.2.0" } }, "sha512-d8HKbqIcya+GR67mkZbrzhS5kKhtp8dQLcmRZLGTscGVg7yImT82cIrhtn2L8+VujWcy6KZweApgNmPsTAO/UQ=="], "aggregate-error/indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], - "ai/@ai-sdk/gateway": ["@ai-sdk/gateway@2.0.15", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.17", "@vercel/oidc": "3.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-i1YVKzC1dg9LGvt+GthhD7NlRhz9J4+ZRj3KELU14IZ/MHPsOBiFeEoCCIDLR+3tqT8/+5nIsK3eZ7DFRfMfdw=="], - - "ajv-keywords/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + "ajv-formats/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], "ansi-align/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], "app-builder-lib/dotenv": ["dotenv@16.4.7", "", {}, "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ=="], + "app-builder-lib/js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], + "app-builder-lib/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], + "asn1.js/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], + + "better-opn/open": ["open@8.4.2", "", { "dependencies": { "define-lazy-prop": "^2.0.0", "is-docker": "^2.1.1", "is-wsl": "^2.2.0" } }, "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ=="], + "bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], + "bl/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], + "blink/@blink.so/api": ["@blink.so/api@1.0.0", "", { "optionalDependencies": { "@blink-sdk/compute-protocol": ">= 0.0.2" }, "peerDependencies": { "ai": ">= 5", "react": ">= 18", "zod": ">= 4" }, "optionalPeers": ["react"] }, "sha512-mBYfopecR+XaMw/W78H6aGgKyZMh99YwcGAU17LVAL+kk4uweJX3cul7958C3f8ovKSeXuXA33t64DbjY3Zi8w=="], "blink/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], "blink/tsdown": ["tsdown@0.14.2", "", { "dependencies": { "ansis": "^4.1.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "debug": "^4.4.1", "diff": "^8.0.2", "empathic": "^2.0.0", "hookable": "^5.5.3", "rolldown": "latest", "rolldown-plugin-dts": "^0.15.8", "semver": "^7.7.2", "tinyexec": "^1.0.1", "tinyglobby": "^0.2.14", "tree-kill": "^1.2.2", "unconfig": "^7.3.3" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "publint": "^0.3.0", "typescript": "^5.0.0", "unplugin-lightningcss": "^0.4.0", "unplugin-unused": "^0.5.0" }, "optionalPeers": ["@arethetypeswrong/core", "publint", "typescript", "unplugin-lightningcss", "unplugin-unused"], "bin": { "tsdown": "dist/run.mjs" } }, "sha512-6ThtxVZoTlR5YJov5rYvH8N1+/S/rD/pGfehdCLGznGgbxz+73EASV1tsIIZkLw2n+SXcERqHhcB/OkyxdKv3A=="], + "blink-server/@types/node": ["@types/node@22.18.8", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-pAZSHMiagDR7cARo/cch1f3rXy0AEXwsVsVH09FcyeJVAzCnGgmYis7P3JidtTUjyadhTeSo8TgRPswstghDaw=="], + + "blink-server/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], + "body-parser/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], - "boxen/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], + "browserify-aes/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "boxen/type-fest": ["type-fest@2.19.0", "", {}, "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA=="], + "browserify-des/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "boxen/widest-line": ["widest-line@4.0.1", "", { "dependencies": { "string-width": "^5.0.1" } }, "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig=="], + "browserify-rsa/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "boxen/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="], + "browserify-sign/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], "builder-util/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + "builder-util/js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], + "bun-types/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], "cacache/glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="], @@ -3272,8 +4620,12 @@ "cacheable-request/get-stream": ["get-stream@5.2.0", "", { "dependencies": { "pump": "^3.0.0" } }, "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA=="], + "cipher-base/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "cli-highlight/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + "cli-highlight/parse5": ["parse5@5.1.1", "", {}, "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="], + "cli-highlight/yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw=="], "cli-table3/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], @@ -3290,20 +4642,46 @@ "concurrently/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + "concurrently/date-fns": ["date-fns@2.30.0", "", { "dependencies": { "@babel/runtime": "^7.21.0" } }, "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw=="], + "config-chain/ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="], - "crc/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], + "content-disposition/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "crc/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], + + "create-ecdh/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], + + "create-hmac/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "cytoscape-fcose/cose-base": ["cose-base@2.2.0", "", { "dependencies": { "layout-base": "^2.0.0" } }, "sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g=="], + + "d3-dsv/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="], + + "d3-dsv/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], + + "d3-sankey/d3-array": ["d3-array@2.12.1", "", { "dependencies": { "internmap": "^1.0.0" } }, "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ=="], + + "d3-sankey/d3-shape": ["d3-shape@1.3.7", "", { "dependencies": { "d3-path": "1" } }, "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw=="], "decode-named-character-reference/character-entities": ["character-entities@2.0.2", "", {}, "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="], + "diffie-hellman/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], + "dir-compare/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], "dmg-builder/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], - "dmg-license/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + "dmg-builder/js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], + + "dom-serializer/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], "dotenv-expand/dotenv": ["dotenv@16.4.7", "", {}, "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ=="], + "drizzle-kit/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + + "ecdsa-sig-formatter/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "electron/@types/node": ["@types/node@22.18.8", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-pAZSHMiagDR7cARo/cch1f3rXy0AEXwsVsVH09FcyeJVAzCnGgmYis7P3JidtTUjyadhTeSo8TgRPswstghDaw=="], "electron-builder/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], @@ -3314,13 +4692,15 @@ "electron-winstaller/fs-extra": ["fs-extra@7.0.1", "", { "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw=="], + "elliptic/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], + "encoding/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], "esbuild-plugin-postcss2/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], - "exa-js/dotenv": ["dotenv@16.4.7", "", {}, "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ=="], + "evp_bytestokey/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "exa-js/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "exa-js/dotenv": ["dotenv@16.4.7", "", {}, "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ=="], "execa/is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="], @@ -3328,8 +4708,6 @@ "express/cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="], - "express/mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], - "extract-zip/get-stream": ["get-stream@5.2.0", "", { "dependencies": { "pump": "^3.0.0" } }, "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA=="], "figures/is-unicode-supported": ["is-unicode-supported@2.1.0", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="], @@ -3338,6 +4716,8 @@ "foreground-child/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], + "form-data/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], + "fs-minipass/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], "gaxios/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], @@ -3360,6 +4740,14 @@ "gtoken/jws": ["jws@4.0.0", "", { "dependencies": { "jwa": "^2.0.0", "safe-buffer": "^5.0.1" } }, "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg=="], + "happy-dom/@types/node": ["@types/node@20.19.25", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ=="], + + "hash-base/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "hast-util-from-parse5/hastscript": ["hastscript@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-parse-selector": "^4.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0" } }, "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w=="], + + "hast-util-to-parse5/property-information": ["property-information@6.5.0", "", {}, "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig=="], + "hastscript/@types/hast": ["@types/hast@2.3.10", "", { "dependencies": { "@types/unist": "^2" } }, "sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw=="], "hastscript/comma-separated-tokens": ["comma-separated-tokens@1.0.8", "", {}, "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw=="], @@ -3368,16 +4756,32 @@ "hastscript/space-separated-tokens": ["space-separated-tokens@1.1.5", "", {}, "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="], + "htmlparser2/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], + "http-errors/statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="], "iconv-corefoundation/cli-truncate": ["cli-truncate@2.1.0", "", { "dependencies": { "slice-ansi": "^3.0.0", "string-width": "^4.2.0" } }, "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg=="], "iconv-corefoundation/node-addon-api": ["node-addon-api@1.7.2", "", {}, "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg=="], + "import-in-the-middle/acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "importx/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], "jsonwebtoken/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], + "jwa/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "jws/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "katex/commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="], + + "knip/zod": ["zod@4.1.13", "", {}, "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig=="], + + "less/image-size": ["image-size@0.5.5", "", { "bin": { "image-size": "bin/image-size.js" } }, "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ=="], + + "less/mime": ["mime@1.6.0", "", { "bin": { "mime": "cli.js" } }, "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="], + "log-symbols/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], "loose-envify/js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], @@ -3396,12 +4800,26 @@ "marked-terminal/marked": ["marked@11.2.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw=="], - "matcher/escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], + "md5.js/hash-base": ["hash-base@3.1.2", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.1" } }, "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg=="], + + "md5.js/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "mdast-util-find-and-replace/escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="], "mdast-util-mdx-jsx/parse-entities": ["parse-entities@4.0.2", "", { "dependencies": { "@types/unist": "^2.0.0", "character-entities-legacy": "^3.0.0", "character-reference-invalid": "^2.0.0", "decode-named-character-reference": "^1.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0", "is-hexadecimal": "^2.0.0" } }, "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw=="], + "mermaid/uuid": ["uuid@11.1.0", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A=="], + "micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "miller-rabin/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], + + "miniflare/undici": ["undici@7.14.0", "", {}, "sha512-Vqs8HTzjpQXZeXdpsfChQTlafcMQaaIwnGwLam1wudSSjlJeQ3bw1j+TLPePgrCnCpUXx7Ba5Pdpf5OBih62NQ=="], + + "miniflare/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], + + "miniflare/zod": ["zod@3.22.3", "", {}, "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug=="], + "minipass-collect/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], "minipass-fetch/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], @@ -3414,12 +4832,24 @@ "minizlib/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], + "mlly/acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "needle/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], + "next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], + + "next/sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], + "node-abi/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], "node-api-version/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], + "node-stdlib-browser/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], + + "node-stdlib-browser/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], + + "node-stdlib-browser/string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], + "normalize-package-data/hosted-git-info": ["hosted-git-info@7.0.2", "", { "dependencies": { "lru-cache": "^10.0.1" } }, "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w=="], "normalize-package-data/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], @@ -3428,8 +4858,6 @@ "npm-run-path/unicorn-magic": ["unicorn-magic@0.3.0", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="], - "openai/zod": ["zod@4.1.12", "", {}, "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ=="], - "ora/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], "ora/cli-cursor": ["cli-cursor@3.1.0", "", { "dependencies": { "restore-cursor": "^3.1.0" } }, "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw=="], @@ -3442,18 +4870,40 @@ "package-json/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], + "parse-asn1/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "parse5-htmlparser2-tree-adapter/parse5": ["parse5@6.0.1", "", {}, "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="], "path-scurry/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], "path-scurry/minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="], + "pbkdf2/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "postcss-modules-local-by-default/postcss-selector-parser": ["postcss-selector-parser@7.1.0", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA=="], + + "postcss-modules-scope/postcss-selector-parser": ["postcss-selector-parser@7.1.0", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA=="], + "postject/commander": ["commander@9.5.0", "", {}, "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="], + "pretty-format/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + + "pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], + "promise-retry/retry": ["retry@0.12.0", "", {}, "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow=="], + "prop-types/react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], + "protobufjs/@types/node": ["@types/node@24.6.2", "", { "dependencies": { "undici-types": "~7.13.0" } }, "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang=="], + "public-encrypt/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], + + "public-encrypt/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "randombytes/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "randomfill/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "rc/ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="], "rc/strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="], @@ -3462,6 +4912,12 @@ "react-reconciler/scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="], + "readable-stream/isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], + + "redent/indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], + + "redent/strip-indent": ["strip-indent@3.0.0", "", { "dependencies": { "min-indent": "^1.0.0" } }, "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ=="], + "refractor/prismjs": ["prismjs@1.27.0", "", {}, "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA=="], "rehype-highlight/lowlight": ["lowlight@3.3.0", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.0.0", "highlight.js": "~11.11.0" } }, "sha512-0JNhgFoPvP6U6lE/UdVsSq99tn6DhjjpAj5MxG49ewd2mOBVtwWYIT8ClyABhq198aXXODMU6Ox8DrGy/CpTZQ=="], @@ -3470,18 +4926,26 @@ "rimraf/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], - "router/path-to-regexp": ["path-to-regexp@8.3.0", "", {}, "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA=="], + "ripemd160/hash-base": ["hash-base@3.1.2", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.1" } }, "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg=="], - "send/mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], + "router/path-to-regexp": ["path-to-regexp@8.3.0", "", {}, "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA=="], "serialize-error/type-fest": ["type-fest@0.13.1", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="], + "sha.js/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "simple-update-notifier/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], "socks-proxy-agent/agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], "ssri/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], + "stack-utils/escape-string-regexp": ["escape-string-regexp@2.0.0", "", {}, "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w=="], + + "stream-browserify/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], + + "stream-http/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], + "string-width-cjs/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], "string-width-cjs/is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], @@ -3492,6 +4956,8 @@ "strip-ansi-cjs/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + "stylus/@adobe/css-tools": ["@adobe/css-tools@4.3.3", "", {}, "sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ=="], + "stylus/source-map": ["source-map@0.7.6", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="], "supports-hyperlinks/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], @@ -3500,16 +4966,30 @@ "tiny-async-pool/semver": ["semver@5.7.2", "", { "bin": { "semver": "bin/semver" } }, "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g=="], - "tsx/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + "to-buffer/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "type-is/mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], + "tsx/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], - "update-notifier/boxen": ["boxen@8.0.1", "", { "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^8.0.0", "chalk": "^5.3.0", "cli-boxes": "^3.0.0", "string-width": "^7.2.0", "type-fest": "^4.21.0", "widest-line": "^5.0.0", "wrap-ansi": "^9.0.0" } }, "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw=="], + "unplugin/acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], "update-notifier/is-in-ci": ["is-in-ci@1.0.0", "", { "bin": { "is-in-ci": "cli.js" } }, "sha512-eUuAjybVTHMYWm/U+vBO1sY/JOCgoPCXRxzdju0K+K0BiGW0SChEL1MLC0PoCIR1OlPo5YAp8HuQoUlsWEICwg=="], "update-notifier/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], + "uri-js/punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], + + "vite/esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + + "webpack-bundle-analyzer/acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + + "webpack-bundle-analyzer/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="], + + "webpack-bundle-analyzer/sirv": ["sirv@2.0.4", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ=="], + + "webpack-bundle-analyzer/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + + "wrangler/esbuild": ["esbuild@0.25.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.4", "@esbuild/android-arm": "0.25.4", "@esbuild/android-arm64": "0.25.4", "@esbuild/android-x64": "0.25.4", "@esbuild/darwin-arm64": "0.25.4", "@esbuild/darwin-x64": "0.25.4", "@esbuild/freebsd-arm64": "0.25.4", "@esbuild/freebsd-x64": "0.25.4", "@esbuild/linux-arm": "0.25.4", "@esbuild/linux-arm64": "0.25.4", "@esbuild/linux-ia32": "0.25.4", "@esbuild/linux-loong64": "0.25.4", "@esbuild/linux-mips64el": "0.25.4", "@esbuild/linux-ppc64": "0.25.4", "@esbuild/linux-riscv64": "0.25.4", "@esbuild/linux-s390x": "0.25.4", "@esbuild/linux-x64": "0.25.4", "@esbuild/netbsd-arm64": "0.25.4", "@esbuild/netbsd-x64": "0.25.4", "@esbuild/openbsd-arm64": "0.25.4", "@esbuild/openbsd-x64": "0.25.4", "@esbuild/sunos-x64": "0.25.4", "@esbuild/win32-arm64": "0.25.4", "@esbuild/win32-ia32": "0.25.4", "@esbuild/win32-x64": "0.25.4" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q=="], + "wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "wrap-ansi-cjs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], @@ -3518,8 +4998,6 @@ "yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], - "zod-to-json-schema/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], - "@ai-sdk/react/ai/@ai-sdk/gateway": ["@ai-sdk/gateway@1.0.33", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.10", "@vercel/oidc": "^3.0.1" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-v9i3GPEo4t3fGcSkQkc07xM6KJN75VUv7C1Mqmmsu2xD8lQwnQfsrgAXyNuWe20yGY0eHuheSPDZhiqsGKtH1g=="], "@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], @@ -3528,12 +5006,30 @@ "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], + "@babel/core/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], + + "@babel/helper-module-imports/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@babel/helpers/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@babel/template/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@babel/traverse/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + "@blink-sdk/github/file-type/strtok3": ["strtok3@10.3.4", "", { "dependencies": { "@tokenizer/token": "^0.3.0" } }, "sha512-KIy5nylvC5le1OdaaoCJ07L+8iQzJHGH6pWDuzS+d07Cu7n1MZ2x26P8ZKIWfbK02+XIL8Mp4RkWeqdUCrDMfg=="], + "@blink-sdk/scout-agent/ai/@ai-sdk/gateway": ["@ai-sdk/gateway@2.0.18", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.18", "@vercel/oidc": "3.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-sDQcW+6ck2m0pTIHW6BPHD7S125WD3qNkx/B8sEzJp/hurocmJ5Cni0ybExg6sQMGo+fr/GWOwpHF1cmCdg5rQ=="], + + "@blink-sdk/scout-agent/ai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@3.0.18", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ypv1xXMsgGcNKUP+hglKqtdDuMg68nWHucPPAhIENrbFAI+xCHiqPVN8Zllxyv1TNZwGWUghPxJXU+Mqps0YRQ=="], + "@blink-sdk/scout-agent/tsdown/rolldown": ["rolldown@1.0.0-beta.13-commit.024b632", "", { "dependencies": { "@oxc-project/runtime": "=0.72.3", "@oxc-project/types": "=0.72.3", "@rolldown/pluginutils": "1.0.0-beta.13-commit.024b632", "ansis": "^4.0.0" }, "optionalDependencies": { "@rolldown/binding-darwin-arm64": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-darwin-x64": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-freebsd-x64": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-linux-x64-musl": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-wasm32-wasi": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.13-commit.024b632", "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.13-commit.024b632" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-sntAHxNJ22WdcXVHQDoRst4eOJZjuT3S1aqsNWsvK2aaFVPgpVPY3WGwvJ91SvH/oTdRCyJw5PwpzbaMdKdYqQ=="], "@blink-sdk/scout-agent/tsdown/unconfig": ["unconfig@0.6.1", "", { "dependencies": { "@antfu/utils": "^8.1.0", "defu": "^6.1.4", "importx": "^0.5.1" } }, "sha512-cVU+/sPloZqOyJEAfNwnQSFCzFrZm85vcVkryH7lnlB/PiTycUkAjt5Ds79cfIshGOZ+M5v3PBDnKgpmlE5DtA=="], + "@blink.so/site/next-auth/@auth/core": ["@auth/core@0.41.0", "", { "dependencies": { "@panva/hkdf": "^1.2.1", "jose": "^6.0.6", "oauth4webapi": "^3.3.0", "preact": "10.24.3", "preact-render-to-string": "6.5.11" }, "peerDependencies": { "@simplewebauthn/browser": "^9.0.1", "@simplewebauthn/server": "^9.0.2", "nodemailer": "^6.8.0" }, "optionalPeers": ["@simplewebauthn/browser", "@simplewebauthn/server", "nodemailer"] }, "sha512-Wd7mHPQ/8zy6Qj7f4T46vg3aoor8fskJm6g2Zyj064oQ3+p0xNZXAV60ww0hY+MbTesfu29kK14Zk5d5JTazXQ=="], + "@blink/desktop/ai/@ai-sdk/gateway": ["@ai-sdk/gateway@2.0.0", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.12", "@vercel/oidc": "3.0.3" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-Gj0PuawK7NkZuyYgO/h5kDK/l6hFOjhLdTq3/Lli1FTl47iGmwhH1IZQpAL3Z09BeFYWakcwUmn02ovIm2wy9g=="], "@blink/desktop/ai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@3.0.12", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ZtbdvYxdMoria+2SlNarEk6Hlgyf+zzcznlD55EAl+7VZvJaSg2sqPvwArY7L6TfDEDJsnCq0fdhBSkYo0Xqdg=="], @@ -3590,8 +5086,6 @@ "@blink/desktop/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], - "@develar/schema-utils/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], - "@electron/asar/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], "@electron/fuses/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], @@ -3608,6 +5102,50 @@ "@electron/rebuild/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.18.20", "", { "os": "android", "cpu": "arm" }, "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.18.20", "", { "os": "android", "cpu": "arm64" }, "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.18.20", "", { "os": "android", "cpu": "x64" }, "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.18.20", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.18.20", "", { "os": "darwin", "cpu": "x64" }, "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.18.20", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.18.20", "", { "os": "freebsd", "cpu": "x64" }, "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.18.20", "", { "os": "linux", "cpu": "arm" }, "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.18.20", "", { "os": "linux", "cpu": "arm64" }, "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.18.20", "", { "os": "linux", "cpu": "ia32" }, "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.18.20", "", { "os": "linux", "cpu": "none" }, "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.18.20", "", { "os": "linux", "cpu": "none" }, "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.18.20", "", { "os": "linux", "cpu": "ppc64" }, "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.18.20", "", { "os": "linux", "cpu": "none" }, "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.18.20", "", { "os": "linux", "cpu": "s390x" }, "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.18.20", "", { "os": "linux", "cpu": "x64" }, "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.18.20", "", { "os": "none", "cpu": "x64" }, "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.18.20", "", { "os": "openbsd", "cpu": "x64" }, "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.18.20", "", { "os": "sunos", "cpu": "x64" }, "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.18.20", "", { "os": "win32", "cpu": "arm64" }, "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.18.20", "", { "os": "win32", "cpu": "ia32" }, "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], + "@google/gemini-cli-core/@opentelemetry/exporter-trace-otlp-http/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], "@google/gemini-cli-core/@opentelemetry/exporter-trace-otlp-http/@opentelemetry/otlp-exporter-base": ["@opentelemetry/otlp-exporter-base@0.203.0", "", { "dependencies": { "@opentelemetry/core": "2.0.1", "@opentelemetry/otlp-transformer": "0.203.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-Wbxf7k+87KyvxFr5D7uOiSq/vHXWommvdnNE7vECO3tAhsA2GfOlpWINCMWUEPdHZ7tCXxw6Epp3vgx3jU7llQ=="], @@ -3652,6 +5190,8 @@ "@google/gemini-cli-core/@opentelemetry/sdk-node/@opentelemetry/sdk-trace-node": ["@opentelemetry/sdk-trace-node@2.0.1", "", { "dependencies": { "@opentelemetry/context-async-hooks": "2.0.1", "@opentelemetry/core": "2.0.1", "@opentelemetry/sdk-trace-base": "2.0.1" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-UhdbPF19pMpBtCWYP5lHbTogLWx9N0EBxtdagvkn5YtsAnCBZzL7SjktG+ZmupRgifsHMjwUaCCaVmqGfSADmA=="], + "@google/gemini-cli-core/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + "@inquirer/core/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "@inquirer/core/wrap-ansi/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], @@ -3676,7 +5216,7 @@ "@joshua.litt/get-ripgrep/got/responselike": ["responselike@3.0.0", "", { "dependencies": { "lowercase-keys": "^3.0.0" } }, "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg=="], - "@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], + "@neondatabase/serverless/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], "@npmcli/move-file/rimraf/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], @@ -3918,6 +5458,10 @@ "@opentelemetry/sdk-node/@opentelemetry/instrumentation/require-in-the-middle": ["require-in-the-middle@7.5.2", "", { "dependencies": { "debug": "^4.3.5", "module-details-from-path": "^1.0.3", "resolve": "^1.22.8" } }, "sha512-gAZ+kLqBdHarXB64XpAe2VCjB7rIRv+mU8tfRWziHRJ5umKsIHN2tLLv6EtMw7WCdP19S0ERVMldNvxYCHnhSQ=="], + "@radix-ui/react-separator/@radix-ui/react-primitive/@radix-ui/react-slot": ["@radix-ui/react-slot@1.2.4", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Jl+bCv8HxKnlTLVrcDE8zTMJ09R9/ukw4qBs/oZClOfoQk/cOTbDn+NceXfV7j09YPVQUryJPHurafcSg6EVKA=="], + + "@rolldown/binding-wasm32-wasi/@napi-rs/wasm-runtime/@emnapi/core": ["@emnapi/core@1.5.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg=="], + "@slack/logger/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], "@slack/oauth/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], @@ -3926,6 +5470,58 @@ "@slack/web-api/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], + "@storybook/core/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], + + "@storybook/core/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], + + "@storybook/core/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.10", "", { "os": "android", "cpu": "arm64" }, "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg=="], + + "@storybook/core/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.10", "", { "os": "android", "cpu": "x64" }, "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg=="], + + "@storybook/core/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA=="], + + "@storybook/core/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg=="], + + "@storybook/core/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.10", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg=="], + + "@storybook/core/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.10", "", { "os": "freebsd", "cpu": "x64" }, "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA=="], + + "@storybook/core/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.10", "", { "os": "linux", "cpu": "arm" }, "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg=="], + + "@storybook/core/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ=="], + + "@storybook/core/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.10", "", { "os": "linux", "cpu": "ia32" }, "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ=="], + + "@storybook/core/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg=="], + + "@storybook/core/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA=="], + + "@storybook/core/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA=="], + + "@storybook/core/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA=="], + + "@storybook/core/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew=="], + + "@storybook/core/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA=="], + + "@storybook/core/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A=="], + + "@storybook/core/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.10", "", { "os": "none", "cpu": "x64" }, "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig=="], + + "@storybook/core/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.10", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw=="], + + "@storybook/core/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.10", "", { "os": "openbsd", "cpu": "x64" }, "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw=="], + + "@storybook/core/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag=="], + + "@storybook/core/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.10", "", { "os": "sunos", "cpu": "x64" }, "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ=="], + + "@storybook/core/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw=="], + + "@storybook/core/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw=="], + + "@storybook/core/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], + "@tailwindcss/oxide/tar/chownr": ["chownr@3.0.0", "", {}, "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g=="], "@tailwindcss/oxide/tar/minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="], @@ -3934,6 +5530,20 @@ "@tailwindcss/oxide/tar/yallist": ["yallist@5.0.0", "", {}, "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw=="], + "@testing-library/dom/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + + "@testing-library/dom/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + + "@testing-library/jest-dom/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + + "@testing-library/jest-dom/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + + "@types/babel__generator/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@types/babel__template/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + + "@types/babel__traverse/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + "@types/body-parser/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], "@types/bunyan/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], @@ -3974,15 +5584,25 @@ "@types/tedious/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], + "@types/update-notifier/boxen/camelcase": ["camelcase@7.0.1", "", {}, "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw=="], + + "@types/update-notifier/boxen/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], + + "@types/update-notifier/boxen/type-fest": ["type-fest@2.19.0", "", {}, "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA=="], + + "@types/update-notifier/boxen/widest-line": ["widest-line@4.0.1", "", { "dependencies": { "string-width": "^5.0.1" } }, "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig=="], + + "@types/update-notifier/boxen/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="], + "@types/ws/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], "@types/yauzl/@types/node/undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="], - "accepts/mime-types/mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], + "@vitest/expect/@vitest/utils/@vitest/pretty-format": ["@vitest/pretty-format@2.0.5", "", { "dependencies": { "tinyrainbow": "^1.2.0" } }, "sha512-h8k+1oWHfwTkyTkb9egzwNMfJAEx4veaPSnMeKbVSjp4euqGSbQlm5+6VHwTr7u4FJslVVsUG5nopCaAYdOmSQ=="], - "ai/@ai-sdk/gateway/@vercel/oidc": ["@vercel/oidc@3.0.5", "", {}, "sha512-fnYhv671l+eTTp48gB4zEsTW/YtRgRPnkI2nT7x6qw5rkI1Lq2hTmQIpHPgyThI0znLK+vX2n9XxKdXZ7BUbbw=="], + "@vitest/expect/@vitest/utils/estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], - "ajv-keywords/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], + "ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], "ansi-align/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], @@ -3990,6 +5610,16 @@ "ansi-align/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "better-opn/open/define-lazy-prop": ["define-lazy-prop@2.0.0", "", {}, "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og=="], + + "better-opn/open/is-docker": ["is-docker@2.2.1", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="], + + "better-opn/open/is-wsl": ["is-wsl@2.2.0", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="], + + "bl/readable-stream/string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], + + "blink-server/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + "blink/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], "blink/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], @@ -4048,8 +5678,6 @@ "blink/tsdown/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], - "boxen/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], - "builder-util/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "builder-util/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], @@ -4090,9 +5718,63 @@ "concurrently/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "cytoscape-fcose/cose-base/layout-base": ["layout-base@2.0.1", "", {}, "sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg=="], + + "d3-sankey/d3-shape/d3-path": ["d3-path@1.0.9", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="], + "dir-compare/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], - "dmg-license/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], + "drizzle-kit/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], + + "drizzle-kit/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], + + "drizzle-kit/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.10", "", { "os": "android", "cpu": "arm64" }, "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg=="], + + "drizzle-kit/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.10", "", { "os": "android", "cpu": "x64" }, "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg=="], + + "drizzle-kit/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA=="], + + "drizzle-kit/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg=="], + + "drizzle-kit/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.10", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg=="], + + "drizzle-kit/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.10", "", { "os": "freebsd", "cpu": "x64" }, "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA=="], + + "drizzle-kit/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.10", "", { "os": "linux", "cpu": "arm" }, "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg=="], + + "drizzle-kit/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ=="], + + "drizzle-kit/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.10", "", { "os": "linux", "cpu": "ia32" }, "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ=="], + + "drizzle-kit/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg=="], + + "drizzle-kit/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA=="], + + "drizzle-kit/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA=="], + + "drizzle-kit/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA=="], + + "drizzle-kit/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew=="], + + "drizzle-kit/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA=="], + + "drizzle-kit/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A=="], + + "drizzle-kit/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.10", "", { "os": "none", "cpu": "x64" }, "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig=="], + + "drizzle-kit/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.10", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw=="], + + "drizzle-kit/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.10", "", { "os": "openbsd", "cpu": "x64" }, "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw=="], + + "drizzle-kit/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag=="], + + "drizzle-kit/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.10", "", { "os": "sunos", "cpu": "x64" }, "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ=="], + + "drizzle-kit/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw=="], + + "drizzle-kit/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw=="], + + "drizzle-kit/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], "electron-builder/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], @@ -4108,16 +5790,24 @@ "electron/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], - "express/mime-types/mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], + "form-data/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], "google-auth-library/jws/jwa": ["jwa@2.0.1", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="], + "google-auth-library/jws/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "gradient-string/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "gradient-string/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], "gtoken/jws/jwa": ["jwa@2.0.1", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="], + "gtoken/jws/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "happy-dom/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + + "hast-util-from-parse5/hastscript/hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="], + "hastscript/@types/hast/@types/unist": ["@types/unist@2.0.11", "", {}, "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="], "iconv-corefoundation/cli-truncate/slice-ansi": ["slice-ansi@3.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" } }, "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ=="], @@ -4196,6 +5886,46 @@ "mdast-util-mdx-jsx/parse-entities/is-hexadecimal": ["is-hexadecimal@2.0.1", "", {}, "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg=="], + "next/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], + + "next/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.2.4" }, "os": "darwin", "cpu": "x64" }, "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw=="], + + "next/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.2.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g=="], + + "next/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.2.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg=="], + + "next/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.2.4", "", { "os": "linux", "cpu": "arm" }, "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A=="], + + "next/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw=="], + + "next/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.2.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ=="], + + "next/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw=="], + + "next/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw=="], + + "next/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg=="], + + "next/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.2.4" }, "os": "linux", "cpu": "arm" }, "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw=="], + + "next/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg=="], + + "next/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.2.4" }, "os": "linux", "cpu": "s390x" }, "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg=="], + + "next/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ=="], + + "next/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg=="], + + "next/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q=="], + + "next/sharp/@img/sharp-wasm32": ["@img/sharp-wasm32@0.34.5", "", { "dependencies": { "@emnapi/runtime": "^1.7.0" }, "cpu": "none" }, "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw=="], + + "next/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.34.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg=="], + + "next/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], + + "node-stdlib-browser/string_decoder/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "normalize-package-data/hosted-git-info/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], "ora/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], @@ -4212,7 +5942,11 @@ "rimraf/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], - "send/mime-types/mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], + "ripemd160/hash-base/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "stream-browserify/readable-stream/string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], + + "stream-http/readable-stream/string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], "string-width-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], @@ -4268,9 +6002,107 @@ "tsx/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], - "type-is/mime-types/mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], + "vite/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], + + "vite/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], + + "vite/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.10", "", { "os": "android", "cpu": "arm64" }, "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg=="], + + "vite/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.10", "", { "os": "android", "cpu": "x64" }, "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg=="], + + "vite/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA=="], + + "vite/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg=="], + + "vite/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.10", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg=="], + + "vite/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.10", "", { "os": "freebsd", "cpu": "x64" }, "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA=="], + + "vite/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.10", "", { "os": "linux", "cpu": "arm" }, "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg=="], + + "vite/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ=="], + + "vite/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.10", "", { "os": "linux", "cpu": "ia32" }, "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ=="], + + "vite/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg=="], + + "vite/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA=="], + + "vite/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA=="], + + "vite/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA=="], + + "vite/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew=="], + + "vite/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA=="], + + "vite/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A=="], + + "vite/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.10", "", { "os": "none", "cpu": "x64" }, "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig=="], + + "vite/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.10", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw=="], + + "vite/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.10", "", { "os": "openbsd", "cpu": "x64" }, "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw=="], + + "vite/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag=="], + + "vite/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.10", "", { "os": "sunos", "cpu": "x64" }, "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ=="], + + "vite/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw=="], + + "vite/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw=="], + + "vite/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], - "update-notifier/boxen/camelcase": ["camelcase@8.0.0", "", {}, "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA=="], + "wrangler/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.4", "", { "os": "aix", "cpu": "ppc64" }, "sha512-1VCICWypeQKhVbE9oW/sJaAmjLxhVqacdkvPLEjwlttjfwENRSClS8EjBz0KzRyFSCPDIkuXW34Je/vk7zdB7Q=="], + + "wrangler/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.4", "", { "os": "android", "cpu": "arm" }, "sha512-QNdQEps7DfFwE3hXiU4BZeOV68HHzYwGd0Nthhd3uCkkEKK7/R6MTgM0P7H7FAs5pU/DIWsviMmEGxEoxIZ+ZQ=="], + + "wrangler/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.4", "", { "os": "android", "cpu": "arm64" }, "sha512-bBy69pgfhMGtCnwpC/x5QhfxAz/cBgQ9enbtwjf6V9lnPI/hMyT9iWpR1arm0l3kttTr4L0KSLpKmLp/ilKS9A=="], + + "wrangler/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.4", "", { "os": "android", "cpu": "x64" }, "sha512-TVhdVtQIFuVpIIR282btcGC2oGQoSfZfmBdTip2anCaVYcqWlZXGcdcKIUklfX2wj0JklNYgz39OBqh2cqXvcQ=="], + + "wrangler/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Y1giCfM4nlHDWEfSckMzeWNdQS31BQGs9/rouw6Ub91tkK79aIMTH3q9xHvzH8d0wDru5Ci0kWB8b3up/nl16g=="], + + "wrangler/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-CJsry8ZGM5VFVeyUYB3cdKpd/H69PYez4eJh1W/t38vzutdjEjtP7hB6eLKBoOdxcAlCtEYHzQ/PJ/oU9I4u0A=="], + + "wrangler/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-yYq+39NlTRzU2XmoPW4l5Ifpl9fqSk0nAJYM/V/WUGPEFfek1epLHJIkTQM6bBs1swApjO5nWgvr843g6TjxuQ=="], + + "wrangler/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-0FgvOJ6UUMflsHSPLzdfDnnBBVoCDtBTVyn/MrWloUNvq/5SFmh13l3dvgRPkDihRxb77Y17MbqbCAa2strMQQ=="], + + "wrangler/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.4", "", { "os": "linux", "cpu": "arm" }, "sha512-kro4c0P85GMfFYqW4TWOpvmF8rFShbWGnrLqlzp4X1TNWjRY3JMYUfDCtOxPKOIY8B0WC8HN51hGP4I4hz4AaQ=="], + + "wrangler/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-+89UsQTfXdmjIvZS6nUnOOLoXnkUTB9hR5QAeLrQdzOSWZvNSAXAtcRDHWtqAUtAmv7ZM1WPOOeSxDzzzMogiQ=="], + + "wrangler/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.4", "", { "os": "linux", "cpu": "ia32" }, "sha512-yTEjoapy8UP3rv8dB0ip3AfMpRbyhSN3+hY8mo/i4QXFeDxmiYbEKp3ZRjBKcOP862Ua4b1PDfwlvbuwY7hIGQ=="], + + "wrangler/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.4", "", { "os": "linux", "cpu": "none" }, "sha512-NeqqYkrcGzFwi6CGRGNMOjWGGSYOpqwCjS9fvaUlX5s3zwOtn1qwg1s2iE2svBe4Q/YOG1q6875lcAoQK/F4VA=="], + + "wrangler/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.4", "", { "os": "linux", "cpu": "none" }, "sha512-IcvTlF9dtLrfL/M8WgNI/qJYBENP3ekgsHbYUIzEzq5XJzzVEV/fXY9WFPfEEXmu3ck2qJP8LG/p3Q8f7Zc2Xg=="], + + "wrangler/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-HOy0aLTJTVtoTeGZh4HSXaO6M95qu4k5lJcH4gxv56iaycfz1S8GO/5Jh6X4Y1YiI0h7cRyLi+HixMR+88swag=="], + + "wrangler/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.4", "", { "os": "linux", "cpu": "none" }, "sha512-i8JUDAufpz9jOzo4yIShCTcXzS07vEgWzyX3NH2G7LEFVgrLEhjwL3ajFE4fZI3I4ZgiM7JH3GQ7ReObROvSUA=="], + + "wrangler/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-jFnu+6UbLlzIjPQpWCNh5QtrcNfMLjgIavnwPQAfoGx4q17ocOU9MsQ2QVvFxwQoWpZT8DvTLooTvmOQXkO51g=="], + + "wrangler/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.4", "", { "os": "linux", "cpu": "x64" }, "sha512-6e0cvXwzOnVWJHq+mskP8DNSrKBr1bULBvnFLpc1KY+d+irZSgZ02TGse5FsafKS5jg2e4pbvK6TPXaF/A6+CA=="], + + "wrangler/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.4", "", { "os": "none", "cpu": "arm64" }, "sha512-vUnkBYxZW4hL/ie91hSqaSNjulOnYXE1VSLusnvHg2u3jewJBz3YzB9+oCw8DABeVqZGg94t9tyZFoHma8gWZQ=="], + + "wrangler/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.4", "", { "os": "none", "cpu": "x64" }, "sha512-XAg8pIQn5CzhOB8odIcAm42QsOfa98SBeKUdo4xa8OvX8LbMZqEtgeWE9P/Wxt7MlG2QqvjGths+nq48TrUiKw=="], + + "wrangler/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.4", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-Ct2WcFEANlFDtp1nVAXSNBPDxyU+j7+tId//iHXU2f/lN5AmO4zLyhDcpR5Cz1r08mVxzt3Jpyt4PmXQ1O6+7A=="], + + "wrangler/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-xAGGhyOQ9Otm1Xu8NT1ifGLnA6M3sJxZ6ixylb+vIUVzvvd6GOALpwQrYrtlPouMqd/vSbgehz6HaVk4+7Afhw=="], + + "wrangler/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.4", "", { "os": "sunos", "cpu": "x64" }, "sha512-Mw+tzy4pp6wZEK0+Lwr76pWLjrtjmJyUB23tHKqEDP74R3q95luY/bXqXZeYl4NYlvwOqoRKlInQialgCKy67Q=="], + + "wrangler/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-AVUP428VQTSddguz9dO9ngb+E5aScyg7nOeJDrF1HPYu555gmza3bDGMPhmVXL8svDSoqPCsCPjb265yG/kLKQ=="], + + "wrangler/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-i1sW+1i+oWvQzSgfRcxxG2k4I9n3O9NRqy8U+uugaT2Dy7kLO9Y7wI72haOahxceMX8hZAzgGou1FhndRldxRg=="], + + "wrangler/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.4", "", { "os": "win32", "cpu": "x64" }, "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ=="], "wrap-ansi-cjs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], @@ -4320,6 +6152,8 @@ "@blink-sdk/scout-agent/tsdown/rolldown/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.13-commit.024b632", "", {}, "sha512-9/h9ID36/orsoJx8kd2E/wxQ+bif87Blg/7LAu3t9wqfXPPezu02MYR96NOH9G/Aiwr8YgdaKfDE97IZcg/MTw=="], + "@blink/desktop/ai/@ai-sdk/gateway/@vercel/oidc": ["@vercel/oidc@3.0.3", "", {}, "sha512-yNEQvPcVrK9sIe637+I0jD6leluPxzwJKx/Haw6F4H77CdDsszUn5V3o96LPziXkSNE2B83+Z3mjqGKBK/R6Gg=="], + "@google/gemini-cli-core/@opentelemetry/exporter-trace-otlp-http/@opentelemetry/otlp-transformer/@opentelemetry/api-logs": ["@opentelemetry/api-logs@0.203.0", "", { "dependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-9B9RU0H7Ya1Dx/Rkyc4stuBZSGVQF27WigitInx2QQoj6KUpEFYPKoWjdFTunJYxmXmh17HeBvbMa1EhGyPmqQ=="], "@google/gemini-cli-core/@opentelemetry/exporter-trace-otlp-http/@opentelemetry/otlp-transformer/@opentelemetry/sdk-logs": ["@opentelemetry/sdk-logs@0.203.0", "", { "dependencies": { "@opentelemetry/api-logs": "0.203.0", "@opentelemetry/core": "2.0.1", "@opentelemetry/resources": "2.0.1" }, "peerDependencies": { "@opentelemetry/api": ">=1.4.0 <1.10.0" } }, "sha512-vM2+rPq0Vi3nYA5akQD2f3QwossDnTDLvKbea6u/A2NZ3XDkPxMfo/PNrDoXhDUD/0pPo2CdH5ce/thn9K0kLw=="], @@ -4358,8 +6192,12 @@ "@npmcli/move-file/rimraf/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + "@types/update-notifier/boxen/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], + "ansi-align/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + "bl/readable-stream/string_decoder/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "blink/tsdown/rolldown/@oxc-project/types": ["@oxc-project/types@0.93.0", "", {}, "sha512-yNtwmWZIBtJsMr5TEfoZFDxIWV6OdScOpza/f5YxbqUMJk+j6QX3Cf3jgZShGEFYWQJ5j9mJ6jM0tZHu2J9Yrg=="], "blink/tsdown/rolldown/@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.0.0-beta.41", "", { "os": "android", "cpu": "arm64" }, "sha512-Edflndd9lU7JVhVIvJlZhdCj5DkhYDJPIRn4Dx0RUdfc8asP9xHOI5gMd8MesDDx+BJpdIT/uAmVTearteU/mQ=="], @@ -4418,8 +6256,14 @@ "mdast-util-mdx-jsx/parse-entities/is-alphanumerical/is-alphabetical": ["is-alphabetical@2.0.1", "", {}, "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ=="], + "next/sharp/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.7.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA=="], + "rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "stream-browserify/readable-stream/string_decoder/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "stream-http/readable-stream/string_decoder/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + "yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "@blink-sdk/scout-agent/tsdown/rolldown/@rolldown/binding-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@0.2.12", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.10.0" } }, "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ=="], @@ -4437,5 +6281,9 @@ "cli-highlight/yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "iconv-corefoundation/cli-truncate/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + + "@blink-sdk/scout-agent/tsdown/rolldown/@rolldown/binding-wasm32-wasi/@napi-rs/wasm-runtime/@emnapi/core": ["@emnapi/core@1.5.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg=="], + + "blink/tsdown/rolldown/@rolldown/binding-wasm32-wasi/@napi-rs/wasm-runtime/@emnapi/core": ["@emnapi/core@1.5.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg=="], } } diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..26a3d25 --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,7 @@ +[test] +root = "./packages" + +[install] +# Use hardlink backend instead of default symlink to prevent .bun directory in Next.js standalone builds +# This creates a more traditional node_modules structure compatible with Next.js tracing +backend = "hardlink" diff --git a/package.json b/package.json index 0b69b03..2b0e05c 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,43 @@ { "private": true, "name": "blink-repo", + "displayName": "Blink", "type": "module", "scripts": { + "dev:site": "cd packages/site && bun run dev", + "dev:db": "bun scripts/db.ts", + "build": "cd packages/site && bun run build && cd ../.. && cd packages/server && bun run build", + "typecheck": "bun run --filter='*' typecheck", "format": "prettier --write --cache .", + "format:check": "prettier --check --cache .", "test": "bun test", - "typecheck": "tsgo --noEmit" + "knip": "knip" }, "workspaces": [ "packages/*" ], "devDependencies": { - "@types/bun": "latest", - "@typescript/native-preview": "^7.0.0-dev.20250907.1", - "prettier": "^3.6.2", + "@ai-sdk/openai": "^2.0.27", + "@ai-sdk/provider-utils": "^3.0.8", + "@cloudflare/workers-types": "^4.20250509.0", + "@modelcontextprotocol/sdk": "^1.13.0", + "@neondatabase/serverless": "^1.0.0", + "@types/bun": "^1.2.12", + "@types/node": "^24.10.1", + "@typescript/native-preview": "^7.0.0-dev.20250701.1", + "@whatwg-node/server": "^0.10.12", + "ai": "^5.0.39", + "blink": "^1.0.3", + "knip": "^5.69.0", + "next-auth": "5.0.0-beta.28", + "prettier": "^3.4.2", + "prettier-plugin-organize-imports": "^4.3.0", "tsdown": "^0.15.7", - "tsx": "^4.20.5" + "tsx": "^4.20.5", + "wrangler": "^4.31.0", + "zod": "^3.25.28" }, "peerDependencies": { - "typescript": "^5" + "typescript": "^5.9.3" } } diff --git a/packages/api/.gitignore b/packages/api/.gitignore new file mode 100644 index 0000000..61c9b5a --- /dev/null +++ b/packages/api/.gitignore @@ -0,0 +1,2 @@ +# This is required for the package to be published. +!dist/package.json \ No newline at end of file diff --git a/packages/api/package.json b/packages/api/package.json new file mode 100644 index 0000000..197607d --- /dev/null +++ b/packages/api/package.json @@ -0,0 +1,55 @@ +{ + "name": "@blink.so/api", + "description": "The internal module for the Blink API.", + "private": true, + "type": "module", + "main": "./src/client.node.ts", + "browser": "./src/client.browser.ts", + "exports": { + ".": { + "browser": "./src/client.browser.ts", + "default": "./src/client.node.ts" + }, + "./react": { + "browser": "./src/react/index.ts", + "default": "./src/react/index.ts" + }, + "./server": "./src/server.ts", + "./test": "./src/test.ts", + "./agents/me": "./src/routes/agents/me/me.client.ts", + "./agents/me/server": "./src/routes/agents/me/me.server.ts", + "./util/chat": "./src/util/chat.ts" + }, + "scripts": { + "build": "tsdown", + "pack": "bun run build && cd dist && npm pack", + "typecheck": "tsgo --noEmit", + "publish": "bun run pack && cd dist && npm publish" + }, + "devDependencies": { + "@bufbuild/protobuf": "^2.9.0", + "eventsource-parser": "^3.0.6", + "hono": "^4.9.7", + "msw": "^2.12.1", + "tsdown": "^0.15.1", + "zod": "^4.1.9", + "zod-validation-error": "^4.0.1" + }, + "peerDependencies": { + "ai": ">= 5", + "zod": ">= 4", + "react": ">= 18" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + }, + "optionalDependencies": { + "@blink-sdk/compute-protocol": ">= 0.0.2" + }, + "dependencies": { + "bcrypt-ts": "^7.1.0", + "next-auth": "5.0.0-beta.28" + } +} diff --git a/packages/api/package.public.json b/packages/api/package.public.json new file mode 100644 index 0000000..4ba3c68 --- /dev/null +++ b/packages/api/package.public.json @@ -0,0 +1,41 @@ +{ + "name": "@blink.so/api", + "description": "The TypeScript SDK for the Blink API.", + "version": "1.0.0", + "author": "Coder", + "type": "module", + "license": "MIT", + "homepage": "https://blink.so", + "repository": { + "type": "git", + "url": "git+https://github.com/coder/blink.git" + }, + "publishConfig": { + "access": "public" + }, + "files": ["dist"], + "exports": { + ".": { + "browser": "./dist/client.browser.js", + "import": "./dist/client.node.js", + "require": "./dist/client.node.cjs", + "default": "./dist/client.node.js" + }, + "./react": { + "import": "./dist/react/index.js", + "require": "./dist/react/index.cjs" + }, + "./package.json": "./package.json" + }, + "peerDependencies": { + "ai": ">= 5", + "react": ">= 18", + "zod": ">= 4" + }, + "peerDependenciesMeta": { + "react": { "optional": true } + }, + "optionalDependencies": { + "@blink-sdk/compute-protocol": ">= 0.0.2" + } +} diff --git a/packages/api/scripts/no-server-imports.ts b/packages/api/scripts/no-server-imports.ts new file mode 100644 index 0000000..0958f6d --- /dev/null +++ b/packages/api/scripts/no-server-imports.ts @@ -0,0 +1,168 @@ +// This file detects any server imports from client files. +// Client files are distributed via the @blink.so/api package. + +import { readFileSync } from "fs"; +import { dirname, relative, resolve } from "path"; +import type { Plugin } from "rolldown"; + +interface NoServerImportsOptions { + /** + * Pattern to identify client files (default: files containing '.client.') + */ + clientFilePattern?: RegExp; + + /** + * Pattern to identify server files (default: files containing '.server.') + */ + serverFilePattern?: RegExp; + + /** + * Additional patterns that should be considered server-only + */ + serverPatterns?: RegExp[]; +} + +/** + * A Rollup/Rolldown plugin that prevents server code imports in client files + */ +export function noServerImports(options: NoServerImportsOptions = {}): Plugin { + const { + clientFilePattern = /\.client\./, + serverFilePattern = /\.server\./, + serverPatterns = [], + } = options; + + const allServerPatterns = [serverFilePattern, ...serverPatterns]; + + function checkImports(filePath: string, code: string) { + const violations: Array<{ + line: number; + statement: string; + importPath: string; + }> = []; + + const lines = code.split("\n"); + + // Match various import patterns + const importPatterns = [ + /^import\s+.*?\s+from\s+['"]([^'"]+)['"];?/, + /^import\s+['"]([^'"]+)['"];?/, + /^import\s*\(\s*['"]([^'"]+)['"]\s*\)/, + /^export\s+.*?\s+from\s+['"]([^'"]+)['"];?/, + /^export\s*\*\s+from\s+['"]([^'"]+)['"];?/, + ]; + + for (let i = 0; i < lines.length; i++) { + const line = lines[i].trim(); + + for (const pattern of importPatterns) { + const match = pattern.exec(line); + if (match) { + const importPath = match[1]; + + if (isServerImport(filePath, importPath)) { + violations.push({ + line: i + 1, + statement: line, + importPath, + }); + } + } + } + } + + return violations; + } + + function isServerImport(filePath: string, importPath: string): boolean { + // Check if the import path directly indicates a server file + for (const pattern of allServerPatterns) { + if (pattern.test(importPath)) { + console.log("server import", pattern, filePath, importPath); + return true; + } + } + + // For relative imports, resolve the path and check if it points to a server file + if (importPath.startsWith(".")) { + try { + const fileDir = dirname(filePath); + const resolvedPath = resolve(fileDir, importPath); + + // Check various possible extensions + const possiblePaths = [ + resolvedPath, + resolvedPath + ".ts", + resolvedPath + ".js", + resolvedPath + "/index.ts", + resolvedPath + "/index.js", + ]; + + for (const possiblePath of possiblePaths) { + for (const pattern of allServerPatterns) { + if (pattern.test(possiblePath)) { + return true; + } + } + } + } catch { + // If resolution fails, be conservative and don't flag it + return false; + } + } + + return false; + } + + return { + name: "no-server-imports", + + buildStart() { + // Initialize plugin + }, + + resolveId(id: string, importer?: string) { + // Let other plugins handle the resolution first + return null; + }, + + load(id: string) { + // Only process client files + if (!clientFilePattern.test(id)) { + return null; + } + + try { + const code = readFileSync(id, "utf-8"); + const violations = checkImports(id, code); + + if (violations.length > 0) { + const relativePath = relative(process.cwd(), id); + let errorMessage = `❌ Server imports detected in client file: ${relativePath}\n\n`; + + for (const violation of violations) { + errorMessage += ` Line ${violation.line}: ${violation.statement}\n`; + errorMessage += ` ↳ "${violation.importPath}" appears to be a server import\n\n`; + } + + errorMessage += + "Client files must not import server-only code to maintain proper separation of concerns."; + + // Throw an error to stop the build + throw new Error(errorMessage); + } + } catch (error) { + if ( + error instanceof Error && + error.message.includes("Server imports detected") + ) { + throw error; + } + // If it's a file reading error, let it pass through + return null; + } + + return null; + }, + }; +} diff --git a/packages/api/src/client-helper.test.ts b/packages/api/src/client-helper.test.ts new file mode 100644 index 0000000..8b449d3 --- /dev/null +++ b/packages/api/src/client-helper.test.ts @@ -0,0 +1,60 @@ +import { describe, expect, it } from "bun:test"; +import { assertResponseStatus } from "./client-helper"; + +describe("assertResponseStatus", () => { + it("should not throw when status matches", async () => { + const response = new Response("", { status: 200 }); + await expect(assertResponseStatus(response, 200)).resolves.toBeUndefined(); + }); + + it("should throw clean error message when response has message field", async () => { + const response = new Response( + JSON.stringify({ message: "That name is already taken!" }), + { status: 400 } + ); + + await expect(assertResponseStatus(response, 201)).rejects.toThrow( + "That name is already taken!" + ); + }); + + it("should include details in error cause when present", async () => { + const response = new Response( + JSON.stringify({ + message: "Validation failed", + details: { field: "name", issue: "too short" }, + }), + { status: 400 } + ); + + try { + await assertResponseStatus(response, 201); + expect(true).toBe(false); // Should not reach here + } catch (err) { + expect(err).toBeInstanceOf(Error); + expect((err as Error).message).toBe("Validation failed"); + expect((err as Error).cause).toEqual({ + field: "name", + issue: "too short", + }); + } + }); + + it("should throw full error when response is not valid JSON", async () => { + const response = new Response("Not JSON", { status: 500 }); + + await expect(assertResponseStatus(response, 200)).rejects.toThrow( + "Expected status 200, got 500: Not JSON" + ); + }); + + it("should throw full error when JSON has no message field", async () => { + const response = new Response(JSON.stringify({ error: "Something" }), { + status: 400, + }); + + await expect(assertResponseStatus(response, 200)).rejects.toThrow( + 'Expected status 200, got 400: {"error":"Something"}' + ); + }); +}); diff --git a/packages/api/src/client-helper.ts b/packages/api/src/client-helper.ts new file mode 100644 index 0000000..c682d7c --- /dev/null +++ b/packages/api/src/client-helper.ts @@ -0,0 +1,120 @@ +import { safeParseJSON } from "@ai-sdk/provider-utils"; +import { + EventSourceParserStream, + type EventSourceMessage, +} from "eventsource-parser/stream"; +import { z } from "zod"; +import { + createAsyncIterableStream, + type AsyncIterableStream, +} from "./util/async-iterable-stream"; + +export const assertResponseStatus = async ( + res: Response, + status: T +): Promise => { + if (res.status !== status) { + // Read the body. + const body = await res.text(); + let parsed; + try { + parsed = JSON.parse(body); + } catch (err) { + // If JSON parsing failed, throw the full error. + throw new Error(`Expected status ${status}, got ${res.status}: ${body}`); + } + + // If we have a message field, use only that. + if (parsed.message) { + throw new Error(parsed.message, { + cause: parsed.details, + }); + } + + // Otherwise, throw the full error with body. + throw new Error(`Expected status ${status}, got ${res.status}: ${body}`); + } +}; + +export const schemaPaginatedRequest = z.object({ + per_page: z.number().int().positive().max(100).default(10).optional(), + page: z.number().int().nonnegative().default(0).optional(), +}); + +export const schemaPaginatedResponse = (schema: T) => + z.object({ + has_more: z.boolean(), + items: z.array(schema), + }); + +export const schemaCursorPaginatedRequest = z.object({ + limit: z.number().int().positive().max(100).default(10).optional(), + cursor: z.string().optional(), +}); + +export const schemaCursorPaginatedResponse = (schema: T) => + z.object({ + next_cursor: z.string().nullable(), + items: z.array(schema), + }); + +export const schemaMetadata = z + .any() + .nullable() + .refine( + (data) => { + return data ? Object.keys(data).length <= 16 : true; + }, + { + message: "Metadata must contain at most 16 keys", + } + ); + +export const nameFormat = /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$/i; + +export const streamSSE = ( + resp: Response, + schema: T +): AsyncIterableStream> => { + const parser = new EventSourceParserStream(); + if (!resp.body) { + throw new Error("The stream endpoint did not return a body!"); + } + resp.body + .pipeThrough(new TextDecoderStream()) + .pipeTo(parser.writable) + .catch((err) => { + // It's all chill - the stream is just going to end. + }); + return createEventStreamFromReadable(parser.readable, schema); +}; + +export const createEventStreamFromReadable = ( + readable: ReadableStream, + schema: T +): AsyncIterableStream> => { + const transformedStream = readable.pipeThrough( + new TransformStream>({ + async transform(chunk, controller) { + const result = await safeParseJSON({ + text: chunk.data, + }); + if (!result.success) { + controller.error(result.error); + return; + } + const parsed = schema.safeParse({ + event: chunk.event, + data: result.value, + }); + if (!parsed.success) { + controller.error(parsed.error); + return; + } + controller.enqueue(parsed.data); + }, + }) + ); + + return createAsyncIterableStream>(transformedStream); +}; diff --git a/packages/api/src/client.browser.ts b/packages/api/src/client.browser.ts new file mode 100644 index 0000000..103e44a --- /dev/null +++ b/packages/api/src/client.browser.ts @@ -0,0 +1,105 @@ +import Agents from "./routes/agents/agents.client"; +import Auth from "./routes/auth/auth.client"; +import Chats from "./routes/chats/chats.client"; +import ChatRuns from "./routes/chats/runs.client"; +import Files from "./routes/files.client"; +import Invites from "./routes/invites.client"; +import Messages from "./routes/messages.client"; +import Organizations from "./routes/organizations/organizations.client"; +import Users from "./routes/users.client"; + +export interface ClientOptions { + baseURL?: string; + authToken?: string; + fetch?: typeof globalThis.fetch; +} + +export default class Client { + public authToken?: string; + + private readonly baseURL: URL; + private readonly fetch?: typeof globalThis.fetch; + + public readonly auth: Auth; + public readonly chats = new Chats(this); + + /** + * Runs are the execution history of chats. + * Use this to + */ + public readonly runs = new ChatRuns(this); + public readonly agents = new Agents(this); + public readonly files = new Files(this); + public readonly organizations = new Organizations(this); + public readonly invites = new Invites(this); + public readonly users = new Users(this); + public readonly messages = new Messages(this); + + public constructor(options?: ClientOptions) { + this.baseURL = new URL( + options?.baseURL ?? + (typeof globalThis.window !== "undefined" + ? window.location.origin + : "https://blink.so") + ); + this.fetch = options?.fetch; + this.authToken = options?.authToken; + this.auth = new Auth(this, this.baseURL); + } + + public request( + method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", + path: string, + body?: BodyInit, + options?: { + headers?: Record; + abortSignal?: AbortSignal; + timeout?: number; + } + ) { + const url = new URL(path, this.baseURL); + const headers = new Headers(); + if (this.authToken) { + headers.set("Authorization", `Bearer ${this.authToken}`); + } + if (typeof body === "string") { + // Assume JSON. The user can always override this below. + headers.set("Content-Type", "application/json"); + } + if (options?.headers) { + for (const [key, value] of Object.entries(options.headers)) { + headers.set(key, value); + } + } + let signal: AbortSignal | undefined; + if (options?.abortSignal && options?.timeout) { + throw new Error("Cannot specify both abortSignal and timeout"); + } + if (options?.abortSignal) { + signal = options.abortSignal; + } + if (options?.timeout) { + signal = AbortSignal.timeout(options.timeout); + } + return (this.fetch ?? fetch)(url.toString(), { + method, + headers, + body, + signal, + }); + } + + public websocket(path: string): WebSocket { + const url = new URL(path, this.baseURL); + url.protocol = url.protocol === "https:" ? "wss:" : "ws:"; + return new WebSocket(url.toString()); + } +} + +export * from "./routes/agents/agents.client"; +export * from "./routes/agents/traces.client"; +export * from "./routes/chats/chats.client"; +export * from "./routes/invites.client"; +export * from "./routes/messages.client"; +export * from "./routes/organizations/organizations.client"; +export * from "./routes/users.client"; diff --git a/packages/api/src/client.node.ts b/packages/api/src/client.node.ts new file mode 100644 index 0000000..7e0ac1b --- /dev/null +++ b/packages/api/src/client.node.ts @@ -0,0 +1,19 @@ +import BrowserClient, { type ClientOptions } from "./client.browser"; +import Devhook from "./routes/devhook.client"; +import Tools from "./routes/tools/tools.client.node"; + +// Devhook is only available in the Node runtime. +// It could work in the browser, but it might not be worth the effort. +export default class Client extends BrowserClient { + public readonly devhook = new Devhook(this); + public readonly tools = new Tools(this); + + public constructor(options?: ClientOptions) { + super({ + ...options, + baseURL: options?.baseURL ?? process.env.BLINK_API_URL, + }); + } +} + +export * from "./client.browser"; diff --git a/packages/api/src/constants.ts b/packages/api/src/constants.ts new file mode 100644 index 0000000..d2d821b --- /dev/null +++ b/packages/api/src/constants.ts @@ -0,0 +1,15 @@ +// Size limits for message parts and uploads +export const MESSAGE_LIMITS = { + // Maximum size for a single message part (including data URLs) + // 10MB limit to prevent abuse while allowing reasonable file attachments + MAX_PART_SIZE_BYTES: 10 * 1024 * 1024, // 10MB + + // Maximum total size for all parts in a single message + MAX_MESSAGE_SIZE_BYTES: 50 * 1024 * 1024, // 50MB + + // Maximum number of parts in a single message (prevents pathological cases) + MAX_PARTS_PER_MESSAGE: 1000, + + // Maximum file upload size (for POST /api/files) + MAX_FILE_UPLOAD_SIZE_BYTES: 100 * 1024 * 1024, // 100MB +} as const; diff --git a/packages/api/src/middleware.test.ts b/packages/api/src/middleware.test.ts new file mode 100644 index 0000000..63c6ddf --- /dev/null +++ b/packages/api/src/middleware.test.ts @@ -0,0 +1,684 @@ +import { describe, expect, test } from "bun:test"; +import type { MiddlewareHandler } from "hono"; +import { Hono } from "hono"; +import { HTTPException } from "hono/http-exception"; +import { encode } from "next-auth/jwt"; +import { createAuthMiddleware } from "./middleware"; +import { generateAgentInvocationToken } from "./routes/agents/me/me.server"; +import { parseApiKey } from "./routes/api-keys.server"; +import { serve } from "./test"; + +const createTestApp = (middleware: MiddlewareHandler): Hono => { + const app = new Hono(); + app.onError((err, c) => { + if (err instanceof HTTPException) { + return c.json( + { + message: err.message, + details: err.cause, + }, + err.status + ); + } + return c.json({ message: "Internal Server Error" }, 500); + }); + app.get("/test", middleware, (c) => { + return c.json({ + user_id: (c as any).get("user_id"), + auth_type: (c as any).get("auth_type"), + agent_id: (c as any).get("agent_id"), + has_api_key: !!(c as any).get("api_key"), + }); + }); + + return app; +}; + +describe("createAuthMiddleware - API Key Authentication", () => { + test("should authenticate with valid API key", async () => { + const { bindings, helpers } = await serve(); + const { user, client } = await helpers.createUser(); + + // Create API key + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + }); + const fullKey = apiKeyData.key; + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fullKey}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + expect(body.user_id).toBe(user.id); + expect(body.auth_type).toBe("api_key"); + expect(body.has_api_key).toBe(true); + }); + + test("should reject invalid API key format", async () => { + const { bindings } = await serve(); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: "Bearer invalid_key", + }, + }, + bindings + ); + + expect(response.status).toBe(401); + }); + + test("should reject API key with wrong prefix", async () => { + const { bindings } = await serve(); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: "Bearer wrong_abc123xyz789_secret123", + }, + }, + bindings + ); + + expect(response.status).toBe(401); + }); + + test("should reject API key not found in database", async () => { + const { bindings } = await serve(); + + const app = createTestApp(createAuthMiddleware()); + + const fakeKey = "bk_abc123xyz789_12345678901234567890123456789012"; + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fakeKey}`, + }, + }, + bindings + ); + + expect(response.status).toBe(401); + const body = await response.json(); + expect(body.message).toBe("API key not found"); + }); + + test("should reject API key with wrong secret", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create API key + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + }); + const parsed = parseApiKey(apiKeyData.key); + + if ("error" in parsed) { + throw new Error("Failed to parse API key"); + } + + const wrongKey = `${parsed.prefix}_${parsed.lookup}_wrongsecret123456789012345678`; + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${wrongKey}`, + }, + }, + bindings + ); + + expect(response.status).toBe(401); + const body = await response.json(); + expect(body.message).toBe("API key failed verification"); + }); + + test("should reject revoked API key", async () => { + const { bindings, helpers } = await serve(); + const { user, client } = await helpers.createUser(); + + // Create API key + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + }); + const fullKey = apiKeyData.key; + + // Revoke the key + const db = await bindings.database(); + const parsed = parseApiKey(fullKey); + if ("error" in parsed) { + throw new Error("Failed to parse API key"); + } + const apiKey = await db.selectApiKeyByLookup(parsed.lookup); + if (!apiKey) { + throw new Error("API key not found"); + } + await db.updateApiKey(apiKey.id, { + revoked_at: new Date(), + revoked_by: user.id, + }); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fullKey}`, + }, + }, + bindings + ); + + expect(response.status).toBe(401); + const body = await response.json(); + expect(body.message).toBe("API key not found"); + }); + + test("should reject expired API key", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create API key + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + expires_at: new Date(Date.now() - 1000), + }); + const fullKey = apiKeyData.key; + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fullKey}`, + }, + }, + bindings + ); + + expect(response.status).toBe(401); + const body = await response.json(); + expect(body.message).toBe("API key has expired"); + }); + + test("should update last_used_at on successful API key auth", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create API key + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + }); + const fullKey = apiKeyData.key; + + const db = await bindings.database(); + const parsed = parseApiKey(fullKey); + if ("error" in parsed) { + throw new Error("Failed to parse API key"); + } + + // Verify initial state + const apiKeyBefore = await db.selectApiKeyByLookup(parsed.lookup); + expect(apiKeyBefore?.last_used_at).toBeNull(); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fullKey}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + + // Verify last_used_at was updated + const apiKeyAfter = await db.selectApiKeyByLookup(parsed.lookup); + expect(apiKeyAfter?.last_used_at).not.toBeNull(); + expect(apiKeyAfter?.last_used_at).toBeInstanceOf(Date); + }); +}); + +describe("createAuthMiddleware - Session Authentication", () => { + test("should authenticate with valid session token in cookie", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + + const sessionToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "blink_session_token", + token: { + sub: user.id, + }, + }); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Cookie: `blink_session_token=${encodeURIComponent(sessionToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + expect(body.user_id).toBe(user.id); + expect(body.auth_type).toBe("session"); + }); + + test("should authenticate with valid session token in Authorization header", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + + const sessionToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "blink_session_token", + token: { + sub: user.id, + }, + }); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${encodeURIComponent(sessionToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + expect(body.user_id).toBe(user.id); + expect(body.auth_type).toBe("session"); + }); + + test("should reject invalid session token", async () => { + const { bindings } = await serve(); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: "Bearer invalid-token", + }, + }, + bindings + ); + + expect(response.status).toBe(401); + }); + + test("should reject missing authentication", async () => { + const { bindings } = await serve(); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request("/test", {}, bindings); + + expect(response.status).toBe(401); + const body = await response.json(); + expect(body.message).toBe("Unauthorized"); + }); +}); + +describe("createAuthMiddleware - Agent Authentication", () => { + test("should authenticate with valid agent token when allowAgentAuth is true", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + const db = await bindings.database(); + + // Create organization and agent + const org = await db.insertOrganizationWithMembership({ + name: "Test Org", + created_by: user.id, + }); + const agent = await db.insertAgent({ + id: crypto.randomUUID(), + name: "test-agent", + organization_id: org.id, + created_by: user.id, + avatar_file_id: null, + }); + + const agentToken = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + { + agent_id: agent.id, + agent_deployment_id: crypto.randomUUID(), + agent_deployment_target_id: crypto.randomUUID(), + run_id: crypto.randomUUID(), + step_id: crypto.randomUUID(), + chat_id: crypto.randomUUID(), + } + ); + + const app = createTestApp(createAuthMiddleware({ allowAgentAuth: true })); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${encodeURIComponent(agentToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + expect(body.agent_id).toBe(agent.id); + expect(body.user_id).toBeUndefined(); + expect(body.auth_type).toBe("agent"); + }); + + test("should not authenticate with agent token when allowAgentAuth is false", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + const db = await bindings.database(); + + const org = await db.insertOrganizationWithMembership({ + name: "Test Org", + created_by: user.id, + }); + const agent = await db.insertAgent({ + id: crypto.randomUUID(), + name: "test-agent", + organization_id: org.id, + created_by: user.id, + avatar_file_id: null, + }); + + const agentToken = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + { + agent_id: agent.id, + agent_deployment_id: crypto.randomUUID(), + agent_deployment_target_id: crypto.randomUUID(), + } + ); + + // allowAgentAuth defaults to false + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${encodeURIComponent(agentToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(401); + }); + + test("should use custom findAgentToken function", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + const db = await bindings.database(); + + const org = await db.insertOrganizationWithMembership({ + name: "Test Org", + created_by: user.id, + }); + const agent = await db.insertAgent({ + id: crypto.randomUUID(), + name: "test-agent", + organization_id: org.id, + created_by: user.id, + avatar_file_id: null, + }); + + const agentToken = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + { + agent_id: agent.id, + agent_deployment_id: crypto.randomUUID(), + agent_deployment_target_id: crypto.randomUUID(), + } + ); + + const app = createTestApp( + createAuthMiddleware({ + allowAgentAuth: true, + findAgentToken: (req) => { + return new URL(req.url).searchParams.get("token"); + }, + }) + ); + + const response = await app.request( + `/test?token=${encodeURIComponent(agentToken)}`, + {}, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + expect(body.agent_id).toBe(agent.id); + expect(body.auth_type).toBe("agent"); + }); + + test("should fall back to session auth when agent token is invalid", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + + const sessionToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "blink_session_token", + token: { + sub: user.id, + }, + }); + + const app = createTestApp(createAuthMiddleware({ allowAgentAuth: true })); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${encodeURIComponent(sessionToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + expect(body.user_id).toBe(user.id); + expect(body.agent_id).toBeUndefined(); + expect(body.auth_type).toBe("session"); + }); +}); + +describe("createAuthMiddleware - Authentication Priority", () => { + test("should prioritize API key over session token", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + const { user: user2 } = await helpers.createUser(); + + // Create API key for user1 + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + }); + const fullKey = apiKeyData.key; + + // Create session token for user2 + const sessionToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "blink_session_token", + token: { + sub: user2.id, + }, + }); + + const app = createTestApp(createAuthMiddleware()); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fullKey}`, + Cookie: `blink_session_token=${encodeURIComponent(sessionToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + // Should authenticate as API key user, not session user + expect(body.user_id).toBe(apiKeyData.user_id); + expect(body.auth_type).toBe("api_key"); + }); + + test("should prioritize API key over agent token", async () => { + const { bindings, helpers } = await serve(); + const { user, client } = await helpers.createUser(); + const db = await bindings.database(); + + // Create API key + const apiKeyData = await client.users.createApiKey({ + name: "Test Key", + }); + const fullKey = apiKeyData.key; + + // Create agent token + const org = await db.insertOrganizationWithMembership({ + name: "Test Org", + created_by: user.id, + }); + const agent = await db.insertAgent({ + id: crypto.randomUUID(), + name: "test-agent", + organization_id: org.id, + created_by: user.id, + avatar_file_id: null, + }); + + const agentToken = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + { + agent_id: agent.id, + agent_deployment_id: crypto.randomUUID(), + agent_deployment_target_id: crypto.randomUUID(), + } + ); + + const app = createTestApp(createAuthMiddleware({ allowAgentAuth: true })); + + const response = await app.request( + "/test", + { + headers: { + Authorization: `Bearer ${fullKey}`, + Cookie: `blink_session_token=${encodeURIComponent(agentToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + // Should use API key, not agent token + expect(body.user_id).toBe(user.id); + expect(body.agent_id).toBeUndefined(); + expect(body.auth_type).toBe("api_key"); + }); + + test("should prioritize agent token over session token", async () => { + const { bindings, helpers } = await serve(); + const { user } = await helpers.createUser(); + const { user: user2 } = await helpers.createUser(); + const db = await bindings.database(); + + // Create agent for user1 + const org = await db.insertOrganizationWithMembership({ + name: "Test Org", + created_by: user.id, + }); + const agent = await db.insertAgent({ + id: crypto.randomUUID(), + name: "test-agent", + organization_id: org.id, + created_by: user.id, + avatar_file_id: null, + }); + + const agentToken = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + { + agent_id: agent.id, + agent_deployment_id: crypto.randomUUID(), + agent_deployment_target_id: crypto.randomUUID(), + } + ); + + // Create session token for user2 + const sessionToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "blink_session_token", + token: { + sub: user2.id, + }, + }); + + const app = createTestApp(createAuthMiddleware({ allowAgentAuth: true })); + + const response = await app.request( + "/test", + { + headers: { + Cookie: `blink_session_token=${encodeURIComponent(agentToken)}`, + Authorization: `Bearer ${encodeURIComponent(sessionToken)}`, + }, + }, + bindings + ); + + expect(response.status).toBe(200); + const body = await response.json(); + // Should use agent token from cookie, not session from Authorization + expect(body.agent_id).toBe(agent.id); + expect(body.user_id).toBeUndefined(); + expect(body.auth_type).toBe("agent"); + }); +}); diff --git a/packages/api/src/middleware.ts b/packages/api/src/middleware.ts new file mode 100644 index 0000000..141f1ee --- /dev/null +++ b/packages/api/src/middleware.ts @@ -0,0 +1,457 @@ +import type { + Agent, + ApiKey, + OrganizationWithMembership, +} from "@blink.so/database/schema"; +import type { Context, MiddlewareHandler } from "hono"; +import { HTTPException } from "hono/http-exception"; +import { decode } from "next-auth/jwt"; +import { validate } from "uuid"; +import { z } from "zod"; +import { parseApiKey, verifyApiKeyString } from "./routes/api-keys.server"; +import { SESSION_COOKIE_NAME } from "./routes/auth/auth.client"; +import type { Bindings } from "./server"; + +/** + * Helper to parse cookies from a Cookie header string. + */ +function parseCookies(rawCookie: string): Record { + const cookies: Record = {}; + rawCookie.split(";").forEach((cookie) => { + const [name, value] = cookie.split("="); + if (!name || !value) { + return; + } + cookies[name.trim()] = decodeURIComponent(value.trim()); + }); + return cookies; +} + +/** + * Centralized authentication middleware generator. + * Supports API keys, agent tokens, and session authentication. + */ +export function createAuthMiddleware(options: { + allowAgentAuth: true; + /** + * Custom function to extract agent invocation tokens from requests. + * Used by tools endpoints to support alternative token locations (e.g., URL parameters). + */ + findAgentToken?: (req: Request) => string | undefined | null; +}): MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + agent_id?: string; + user_id?: string; + api_key?: ApiKey; + auth_type: "session" | "api_key" | "agent"; + }; +}>; +export function createAuthMiddleware(options?: { + allowAgentAuth?: false; + /** + * Custom function to extract agent invocation tokens from requests. + * Used by tools endpoints to support alternative token locations (e.g., URL parameters). + */ + findAgentToken?: (req: Request) => string | undefined | null; +}): MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + api_key?: ApiKey; + auth_type: "session" | "api_key"; + }; +}>; +export function createAuthMiddleware( + options: { + allowAgentAuth?: boolean; + findAgentToken?: (req: Request) => string | undefined | null; + } = {} +): MiddlewareHandler<{ + Bindings: Bindings; + Variables: any; +}> { + return async (c, next) => { + const authHeader = c.req.header("Authorization"); + + // Priority 1: Check for API key authentication + if (authHeader && authHeader.startsWith("Bearer bk_")) { + const apiKeyValue = authHeader.substring(7); + const parsed = parseApiKey(apiKeyValue); + if (parsed.error !== undefined) { + throw new HTTPException(401, { message: parsed.error }); + } + const db = await c.env.database(); + const apiKey = await db.selectApiKeyByLookup(parsed.lookup); + if (!apiKey) { + throw new HTTPException(401, { message: "API key not found" }); + } + const keyValid = await verifyApiKeyString({ + rootSecret: c.env.AUTH_SECRET, + keySecret: parsed.secret, + hash: apiKey.key_hash, + }); + if (!keyValid) { + throw new HTTPException(401, { + message: "API key failed verification", + }); + } + if (apiKey.revoked_at) { + throw new HTTPException(401, { message: "API key has been revoked" }); + } + if ( + apiKey.expires_at && + apiKey.expires_at.getTime() < new Date().getTime() + ) { + throw new HTTPException(401, { message: "API key has expired" }); + } + await db.updateApiKey(apiKey.id, { last_used_at: new Date() }); + + c.set("user_id", apiKey.user_id); + c.set("api_key", apiKey); + c.set("auth_type", "api_key"); + await next(); + return; + } + + // Priority 2: Check for agent token (if enabled) + if (options.allowAgentAuth) { + let rawToken: string | undefined | null; + if (options.findAgentToken) { + rawToken = options.findAgentToken(c.req.raw); + } + if (!rawToken) { + rawToken = readAuthTokenFromRequest(c.req.raw, SESSION_COOKIE_NAME); + } + + if (rawToken) { + // Try to decode as agent invocation token + try { + const token = await decode({ + token: rawToken, + salt: "agent-invocation", + secret: c.env.AUTH_SECRET, + }); + if (token && token.agent_id) { + c.set("agent_id", token.agent_id as string); + c.set("auth_type", "agent"); + await next(); + return; + } + } catch (err) { + // Not an agent token, continue to session auth + } + } + } + + // Priority 3: Fall back to session-based authentication + const rawToken = readAuthTokenFromRequest(c.req.raw, SESSION_COOKIE_NAME); + + if (!rawToken) { + throw new HTTPException(401, { message: "Unauthorized" }); + } + + let token; + try { + token = await decode({ + token: rawToken, + secret: c.env.AUTH_SECRET, + salt: SESSION_COOKIE_NAME, + }); + } catch { + // Token decoding failed - invalid token + throw new HTTPException(401, { message: "Unauthorized" }); + } + + if (!token || !token.sub) { + throw new HTTPException(401, { message: "Unauthorized" }); + } + + c.set("user_id", token.sub); + c.set("auth_type", "session"); + await next(); + }; +} + +/** + * Reads authentication token from request cookies or Authorization header. + * This helper is based on next-auth/jwt logic. + */ +function readAuthTokenFromRequest( + req: Request, + cookieName: string +): string | undefined { + const headers = + req.headers instanceof Headers ? req.headers : new Headers(req.headers); + + const rawCookie = headers.get("cookie") ?? ""; + if (rawCookie) { + const cookies = parseCookies(rawCookie); + if (cookies[cookieName]) { + return cookies[cookieName]; + } + } + + const authorizationHeader = headers.get("authorization"); + + if (authorizationHeader?.split(" ")[0] === "Bearer") { + const urlEncodedToken = authorizationHeader.split(" ")[1]; + if (!urlEncodedToken) { + return undefined; + } + return decodeURIComponent(urlEncodedToken); + } +} + +export const withAuth = createAuthMiddleware(); + +export const withOrganizationIDQueryParam: MiddlewareHandler< + { + Bindings: Bindings; + Variables: { + user_id: string; + organization: OrganizationWithMembership; + }; + }, + string, + { + in: { + user_id: string; + }; + } +> = async (c, next) => { + const organizationID = c.req.query("organization_id"); + if (!organizationID) { + return c.json( + { message: `The "organization_id" query param is required` }, + 400 + ); + } + const org = await authorizeOrganization(c, organizationID); + c.set("organization", org); + await next(); +}; + +export const withPagination: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + page?: number; + per_page?: number; + }; +}> = async (c, next) => { + const rawPage = c.req.query("page"); + const rawPerPage = c.req.query("per_page"); + const page = rawPage ? parseInt(rawPage) : undefined; + if (page !== undefined && isNaN(page)) { + return c.json({ message: `The "page" query param must be a number` }, 400); + } + const per_page = rawPerPage ? parseInt(rawPerPage) : undefined; + if (per_page !== undefined && isNaN(per_page)) { + return c.json( + { message: `The "per_page" query param must be a number` }, + 400 + ); + } + c.set("page", page); + c.set("per_page", per_page); + await next(); +}; + +export const withCursorPagination: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + cursor?: string; + limit?: number; + }; +}> = async (c, next) => { + const cursor = c.req.query("cursor"); + let limit: number | undefined; + if (cursor && typeof cursor !== "string") { + return c.json({ message: "Cursor must only be specified once" }, 400); + } + const rawLimit = c.req.query("limit"); + if (rawLimit) { + if (typeof rawLimit !== "string") { + throw new HTTPException(400, { + message: "Limit must only be specified once", + }); + } + limit = parseInt(rawLimit); + if (isNaN(limit)) { + throw new HTTPException(400, { + message: "Limit must be a number", + }); + } + } + c.set("cursor", cursor); + c.set("limit", limit); + await next(); +}; + +export const withAgentURLParam: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + agent: Agent; + organization: OrganizationWithMembership; + }; +}> = async (c, next) => { + const id = c.req.param("agent_id"); + if (!id) { + return c.json({ message: "Agent ID is required" }, 400); + } + const parsed = await z.uuid().safeParseAsync(id); + if (!parsed.success) { + return c.json({ message: "Invalid agent ID" }, 400); + } + const db = await c.env.database(); + const agent = await db.selectAgentByID(id); + if (!agent) { + return c.json({ message: "Agent not found" }, 404); + } + const org = await authorizeOrganization(c, agent.organization_id); + c.set("agent", agent); + c.set("organization", org); + await next(); +}; + +export const withOrganizationURLParam: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + organization: OrganizationWithMembership; + }; +}> = async (c, next) => { + const id = c.req.param("organization_id"); + if (!id) { + return c.json({ message: "Organization ID is required" }, 400); + } + const org = await authorizeOrganization(c, id); + c.set("organization", org); + await next(); +}; + +export const authorizeOrganization = async < + V extends { + user_id: string; + }, +>( + c: Context<{ + Bindings: Bindings; + Variables: V; + }>, + id: string +): Promise => { + const db = await c.env.database(); + + let organization: OrganizationWithMembership | undefined; + if (validate(id)) { + organization = await db.selectOrganizationForUser({ + organizationID: id, + userID: c.get("user_id"), + }); + } else { + // Allow getting organizations by name for simplicity. + organization = await db.selectOrganizationForUser({ + organizationName: id, + userID: c.get("user_id"), + }); + } + if (!organization) { + throw new HTTPException(404, { + message: "Organization not found", + }); + } + return organization; +}; + +// Alias for consistency with organization middleware +export const withAgent = withAgentURLParam; + +/** + * Middleware to ensure the organization is not personal. + * Must be used after withAgent or withOrganization. + */ +export const withTeamOrganization: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + organization: OrganizationWithMembership; + }; +}> = async (c, next) => { + const organization = c.get("organization"); + if (organization.kind === "personal") { + throw new HTTPException(403, { + message: "This feature is not available for personal organizations", + }); + } + await next(); +}; + +/** + * Middleware to check agent permissions. + * Must be used after withAgent. + */ +export const withAgentPermission = ( + requiredPermission: "read" | "write" | "admin" +): MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + agent: Agent; + organization: OrganizationWithMembership; + agent_permission: "read" | "write" | "admin"; + }; +}> => { + return async (c, next) => { + const agent = c.get("agent"); + const userId = c.get("user_id"); + const org = c.get("organization"); + const db = await c.env.database(); + + // Org owners and admins bypass permission checks + if ( + org.membership && + (org.membership.role === "owner" || org.membership.role === "admin") + ) { + c.set("agent_permission", "admin"); + await next(); + return; + } + + const permission = await db.getAgentPermissionForUser({ + agentId: agent.id, + userId, + orgRole: org.membership?.role, + agentVisibility: agent.visibility, + }); + + // If permission is undefined, user doesn't have access + if (permission === undefined) { + throw new HTTPException(403, { + message: "Access denied: private agent requires explicit permission", + }); + } + + c.set("agent_permission", permission); + + if (!hasPermission(permission, requiredPermission)) { + throw new HTTPException(403, { + message: `This action requires ${requiredPermission} permission. You have ${permission} permission.`, + }); + } + + await next(); + }; +}; + +/** + * Check if current permission level satisfies required level. + * admin > write > read + */ +function hasPermission( + current: "read" | "write" | "admin", + required: "read" | "write" | "admin" +): boolean { + const levels = { read: 1, write: 2, admin: 3 }; + return levels[current] >= levels[required]; +} diff --git a/packages/api/src/react/index.ts b/packages/api/src/react/index.ts new file mode 100644 index 0000000..ad9cf80 --- /dev/null +++ b/packages/api/src/react/index.ts @@ -0,0 +1 @@ +export * from "./use-chat"; diff --git a/packages/api/src/react/use-chat.test.tsx b/packages/api/src/react/use-chat.test.tsx new file mode 100644 index 0000000..25028de --- /dev/null +++ b/packages/api/src/react/use-chat.test.tsx @@ -0,0 +1,456 @@ +import { renderHook, waitFor } from "@testing-library/react"; +import type { UIMessage, UIMessageChunk } from "ai"; +import { beforeAll, describe, expect, it, mock } from "bun:test"; +import { Window } from "happy-dom"; +import type Client from "../client.browser"; +import type { StreamChatEvent } from "../client.browser"; +import { useChat } from "./use-chat"; + +beforeAll(() => { + if (!globalThis.window) { + globalThis.window = new Window() as any; + globalThis.document = window.document; + } +}); + +// Note: Not cleaning up window/document in afterAll to avoid +// potential issues with hanging cleanup in CI + +// Mock client factory +function createMockClient() { + const mockClient = { + chats: { + create: mock(), + stream: mock(), + stop: mock(), + }, + messages: { + send: mock(), + }, + } as unknown as Client; + + return mockClient; +} + +// Helper to create async iterable stream +function createMockStream( + events: StreamChatEvent[] +): AsyncIterable { + return { + async *[Symbol.asyncIterator]() { + for (const event of events) { + yield event; + } + }, + cancel: async () => {}, + } as any; +} + +describe("useChat", () => { + it("initializes with empty messages", () => { + const client = createMockClient(); + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + }) + ); + + expect(result.current.messages).toEqual([]); + expect(result.current.status).toBe("ready"); + expect(result.current.error).toBeUndefined(); + }); + + it("initializes with provided messages", () => { + const client = createMockClient(); + const initialMessages: UIMessage[] = [ + { + id: "msg-1", + role: "user", + parts: [{ type: "text", text: "Hello" }], + }, + ]; + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + messages: initialMessages, + }) + ); + + expect(result.current.messages).toEqual(initialMessages); + }); + + it("sends a message and creates a chat", async () => { + const client = createMockClient(); + const mockStream = createMockStream([]); + + client.chats.create.mockResolvedValue({ + id: "chat-1", + messages: [ + { + id: "msg-1", + role: "user", + parts: [{ type: "text", text: "Hello" }], + }, + ], + stream: mockStream, + }); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + }) + ); + + await result.current.sendMessage({ text: "Hello" }); + + await waitFor(() => { + expect(result.current.id).toBe("chat-1"); + expect(result.current.messages.length).toBe(1); + expect(result.current.messages[0].parts[0]).toEqual({ + type: "text", + text: "Hello", + }); + }); + }); + + it("handles message.created events", async () => { + const client = createMockClient(); + const mockStream = createMockStream([ + { + event: "message.created", + data: { + id: "msg-2", + role: "assistant", + parts: [{ type: "text", text: "Hi there!" }], + }, + }, + ]); + + client.chats.stream.mockResolvedValue(mockStream); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + id: "chat-1", + }) + ); + + await waitFor( + () => { + expect(result.current.messages.length).toBe(1); + }, + { timeout: 1000 } + ); + + expect(result.current.messages[0].id).toBe("msg-2"); + expect(result.current.messages[0].role).toBe("assistant"); + }); + + // Race condition test 1: Concurrent message chunks + it("handles concurrent message chunks without corruption", async () => { + const client = createMockClient(); + const chunks: StreamChatEvent[] = []; + + // Create 10 messages with 5 chunks each, interleaved + for (let i = 0; i < 5; i++) { + for (let msgIdx = 0; msgIdx < 10; msgIdx++) { + chunks.push({ + event: "message.chunk.added", + data: { + id: `msg-${msgIdx}`, + chunk: { + type: "text-delta", + textDelta: `chunk${i}-`, + } as UIMessageChunk, + }, + }); + } + } + + // Add message.created events to close streams + for (let msgIdx = 0; msgIdx < 10; msgIdx++) { + chunks.push({ + event: "message.created", + data: { + id: `msg-${msgIdx}`, + role: "assistant", + parts: [{ type: "text", text: `Message ${msgIdx}` }], + }, + }); + } + + const mockStream = createMockStream(chunks); + client.chats.stream.mockResolvedValue(mockStream); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + id: "chat-1", + }) + ); + + await waitFor( + () => { + expect(result.current.messages.length).toBe(10); + }, + { timeout: 2000 } + ); + + // Verify all messages are present with correct IDs + const messageIds = result.current.messages.map((m) => m.id).sort(); + expect(messageIds).toEqual([ + "msg-0", + "msg-1", + "msg-2", + "msg-3", + "msg-4", + "msg-5", + "msg-6", + "msg-7", + "msg-8", + "msg-9", + ]); + }); + + // Race condition test 2: Submit while streaming + it("handles submit while streaming without losing messages", async () => { + const client = createMockClient(); + + // Initial stream with ongoing chunks + const initialStream = createMockStream([ + { + event: "message.chunk.added", + data: { + id: "msg-1", + chunk: { type: "text-delta", textDelta: "Hello" } as UIMessageChunk, + }, + }, + ]); + + client.chats.create.mockResolvedValueOnce({ + id: "chat-1", + messages: [ + { + id: "user-1", + role: "user", + parts: [{ type: "text", text: "First" }], + }, + ], + stream: initialStream, + }); + + client.messages.send.mockResolvedValueOnce({ + messages: [ + { + id: "user-2", + role: "user", + parts: [{ type: "text", text: "Second" }], + }, + ], + }); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + }) + ); + + // Send first message + await result.current.sendMessage({ text: "First" }); + + await waitFor(() => { + expect(result.current.id).toBe("chat-1"); + }); + + // Send second message while first is streaming + await result.current.sendMessage({ text: "Second" }); + + await waitFor(() => { + // Should have both user messages + const userMessages = result.current.messages.filter( + (m) => m.role === "user" + ); + expect(userMessages.length).toBeGreaterThanOrEqual(2); + }); + }); + + // Race condition test 3: Rapid status changes + it("handles rapid status changes correctly", async () => { + const client = createMockClient(); + const mockStream = createMockStream([ + { event: "chat.updated", data: { status: "streaming" } }, + { event: "chat.updated", data: { status: "idle" } }, + { event: "chat.updated", data: { status: "streaming" } }, + { event: "chat.updated", data: { status: "idle" } }, + ]); + + client.chats.stream.mockResolvedValue(mockStream); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + id: "chat-1", + }) + ); + + await waitFor( + () => { + expect(result.current.status).toBe("ready"); + }, + { timeout: 1000 } + ); + + expect(result.current.error).toBeUndefined(); + }); + + // Race condition test 4: Message deduplication during submit + it("deduplicates messages when response arrives before stream", async () => { + const client = createMockClient(); + + // Response contains a message that will also come via stream + client.chats.create.mockResolvedValueOnce({ + id: "chat-1", + messages: [ + { + id: "user-1", + role: "user", + parts: [{ type: "text", text: "Hello" }], + }, + { + id: "assistant-1", + role: "assistant", + parts: [{ type: "text", text: "Response" }], + }, + ], + stream: createMockStream([ + { + event: "message.created", + data: { + id: "assistant-1", + role: "assistant", + parts: [{ type: "text", text: "Response" }], + }, + }, + ]), + }); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + }) + ); + + await result.current.sendMessage({ text: "Hello" }); + + await waitFor( + () => { + expect(result.current.messages.length).toBe(2); + }, + { timeout: 1000 } + ); + + // Should have exactly 2 messages, no duplicates + const assistantMessages = result.current.messages.filter( + (m) => m.id === "assistant-1" + ); + expect(assistantMessages.length).toBe(1); + }); + + // Race condition test 5: Multiple message.created for same ID + it("handles multiple message.created events for same ID", async () => { + const client = createMockClient(); + const mockStream = createMockStream([ + { + event: "message.created", + data: { + id: "msg-1", + role: "assistant", + parts: [{ type: "text", text: "First version" }], + }, + }, + { + event: "message.created", + data: { + id: "msg-1", + role: "assistant", + parts: [{ type: "text", text: "Second version" }], + }, + }, + ]); + + client.chats.stream.mockResolvedValue(mockStream); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + id: "chat-1", + }) + ); + + await waitFor( + () => { + expect(result.current.messages.length).toBe(1); + }, + { timeout: 1000 } + ); + + // Should only have one message (no duplicates) + expect(result.current.messages.length).toBe(1); + expect(result.current.messages[0].id).toBe("msg-1"); + }); + + it("stops chat correctly", async () => { + const client = createMockClient(); + client.chats.stop.mockResolvedValue(undefined); + + const { result } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + id: "chat-1", + }) + ); + + await result.current.stop(); + + expect(client.chats.stop).toHaveBeenCalledWith("chat-1"); + expect(result.current.status).toBe("ready"); + }); + + it("clears error", () => { + const client = createMockClient(); + const { result, rerender } = renderHook(() => + useChat({ + organization: "org-1", + agent: "agent-1", + client, + }) + ); + + // Manually set error for testing + result.current.clearError(); + rerender(); + + expect(result.current.error).toBeUndefined(); + }); +}); diff --git a/packages/api/src/react/use-chat.ts b/packages/api/src/react/use-chat.ts new file mode 100644 index 0000000..ab33d52 --- /dev/null +++ b/packages/api/src/react/use-chat.ts @@ -0,0 +1,638 @@ +import { + AbstractChat, + convertFileListToFileUIParts, + readUIMessageStream, + type AsyncIterableStream, + type ChatOnDataCallback, + type ChatOnErrorCallback, + type ChatOnFinishCallback, + type ChatOnToolCallCallback, + type CreateUIMessage, + type UIMessage, + type UIMessageChunk, +} from "ai"; +import { useCallback, useEffect, useRef, useState } from "react"; +import Client, { + type ChatMessage, + type SendMessagesRequest, + type SendMessagesResponse, + type StreamChatEvent, +} from "../client.browser"; + +export type UseChatUIHelpers = { + /** + * The id of the chat. If not provided, a chat will be created + * when messages are sent. + */ + readonly id?: string; + + /** + * The error object of the chat. + */ + readonly error: Error | undefined; + + readonly setMessages: ( + messagesParam: UI_MESSAGE[] | ((messages: UI_MESSAGE[]) => UI_MESSAGE[]) + ) => void; +} & Pick< + AbstractChat, + | "sendMessage" + | "stop" + | "addToolResult" + | "status" + | "messages" + | "clearError" +>; + +type SendMessageArg = Parameters< + AbstractChat["sendMessage"] +>[0]; + +export interface UseChatOptions { + /** + * A unique identifier for the chat. If not provided, + * a new chat will be created. + */ + id?: string; + + /** + * The id of the organization to use. + */ + organization: string; + + /** + * The id of the agent to use. + */ + agent?: string; + + /** + * The id of the agent deployment to use. + */ + agentDeployment?: string; + + /** + * The messages to initialize the chat with. + * If not provided, chat history will be inaccurate. + * + * Fetch chat history yourself. + */ + messages?: UI_MESSAGE[]; + + /** + * Initial error message to display (e.g., from persisted chat state). + */ + initialError?: string; + + client?: Client; + + onError?: ChatOnErrorCallback; + onToolCall?: ChatOnToolCallCallback; + onFinish?: ChatOnFinishCallback; + onData?: ChatOnDataCallback; +} + +export function useChat( + options: UseChatOptions +): UseChatUIHelpers { + const clientRef = useRef(options.client!); + if (!clientRef.current) { + clientRef.current = new Client(); + } + const agentIDRef = useRef(options.agent); + if (agentIDRef.current !== options.agent) { + agentIDRef.current = options.agent; + } + const organizationIDRef = useRef(options.organization); + if (organizationIDRef.current !== options.organization) { + organizationIDRef.current = options.organization; + } + const agentDeploymentIDRef = useRef( + options.agentDeployment + ); + if (agentDeploymentIDRef.current !== options.agentDeployment) { + agentDeploymentIDRef.current = options.agentDeployment; + } + + const [chatID, setChatID] = useState(options.id); + const [messages, setMessages] = useState( + options.messages ?? [] + ); + const messagesRef = useRef(messages); + const messagesByIDRef = useRef>(new Map()); + // Initialize map + messages.forEach((m) => messagesByIDRef.current.set(m.id, m)); + + const [status, setStatus] = + useState["status"]>("ready"); + const statusRef = useRef["status"]>(status); + const [error, setError] = useState( + options.initialError ? new Error(options.initialError) : undefined + ); + + const activeMessageChunkStreamsRef = useRef< + Map> + >(new Map()); + + const chatIDRef = useRef(chatID); + + // Wrap setChatID to sync chatIDRef immediately (race-free) + const setChatIDAndSyncRef = useCallback((newChatID: string | undefined) => { + chatIDRef.current = newChatID; + setChatID(newChatID); + }, []); + + // Wrap setMessages to sync refs immediately (race-free) + const setMessagesAndSyncRefs = useCallback( + ( + messagesParam: UI_MESSAGE[] | ((messages: UI_MESSAGE[]) => UI_MESSAGE[]) + ) => { + setMessages((prevMessages) => { + const nextMessages = + typeof messagesParam === "function" + ? messagesParam(prevMessages) + : messagesParam; + + // Sync refs immediately before render + messagesRef.current = nextMessages; + messagesByIDRef.current.clear(); + nextMessages.forEach((m) => messagesByIDRef.current.set(m.id, m)); + + return nextMessages; + }); + }, + [] + ); + + // Wrap setStatus to sync statusRef immediately (race-free) + const setStatusAndSyncRef = useCallback( + (newStatus: UseChatUIHelpers["status"]) => { + statusRef.current = newStatus; + setStatus(newStatus); + }, + [] + ); + + const streamRef = useRef | undefined>( + undefined + ); + const streamAbortRef = useRef(null); + const reconnectAttemptRef = useRef(0); + const reconnectTimeoutRef = useRef(null); + const shouldReconnectRef = useRef(true); + const connectingRef = useRef(false); + const manualStopRef = useRef(false); + + const clearActiveChunkWriters = useCallback(() => { + activeMessageChunkStreamsRef.current.forEach((writer) => { + writer.close().catch(() => {}); + }); + activeMessageChunkStreamsRef.current.clear(); + }, []); + + const scheduleReconnect = useCallback(() => { + if ( + !shouldReconnectRef.current || + !chatIDRef.current || + manualStopRef.current + ) { + return; + } + const attempt = ++reconnectAttemptRef.current; + const base = Math.min(10000, 500 * Math.pow(2, attempt - 1)); + const jitter = Math.floor(Math.random() * 200); + const delay = base + jitter; + if (reconnectTimeoutRef.current) { + clearTimeout(reconnectTimeoutRef.current); + } + reconnectTimeoutRef.current = window.setTimeout(() => { + reconnectTimeoutRef.current = null; + if ( + !streamRef.current && + !connectingRef.current && + !manualStopRef.current + ) { + connect(); + } + }, delay); + }, []); + + const disconnect = useCallback( + (cancelStream: boolean) => { + if (reconnectTimeoutRef.current) { + clearTimeout(reconnectTimeoutRef.current); + reconnectTimeoutRef.current = null; + } + if (streamAbortRef.current) { + try { + streamAbortRef.current.abort(); + } catch {} + streamAbortRef.current = null; + } + const current = streamRef.current; + if (current) { + if (cancelStream) { + current.cancel().catch(() => {}); + } + streamRef.current = undefined; + } + clearActiveChunkWriters(); + }, + [clearActiveChunkWriters] + ); + + const handleMessageChunk = useCallback( + async (id: string, message: UIMessageChunk) => { + if (statusRef.current !== "streaming") { + setStatusAndSyncRef("streaming"); + } + let writer = activeMessageChunkStreamsRef.current.get(id); + if (writer) { + await writer.write(message); + return; + } + const transform = new TransformStream(); + writer = transform.writable.getWriter(); + activeMessageChunkStreamsRef.current.set(id, writer); + const existing = messagesByIDRef.current.get(id); + readUIMessageStream({ + message: existing, + stream: transform.readable, + }) + .pipeTo( + new WritableStream({ + write: (message) => { + setMessagesAndSyncRefs((messages) => { + message.id = id; + + const index = messages.findIndex((m) => m.id === id); + if (index === -1) { + return [...messages, message]; + } + return [ + ...messages.slice(0, index), + message, + ...messages.slice(index + 1), + ]; + }); + }, + }) + ) + .catch(() => {}) + .finally(() => { + if (writer) { + writer.close().catch(() => {}); + activeMessageChunkStreamsRef.current.delete(id); + } + }); + await writer.write(message); + }, + [setStatusAndSyncRef, setMessagesAndSyncRefs] + ); + + const convertMessage = useCallback((message: ChatMessage): UI_MESSAGE => { + return { + id: message.id, + parts: message.parts, + role: message.role, + metadata: message.metadata, + } as UI_MESSAGE; + }, []); + + const readStream = useCallback( + async (stream: AsyncIterableStream) => { + streamRef.current = stream; + try { + for await (const message of stream) { + switch (message.event) { + case "message.chunk.added": + await handleMessageChunk(message.data.id, message.data.chunk); + break; + case "message.created": + setMessagesAndSyncRefs((messages) => { + const index = messages.findIndex( + (m) => m.id === message.data.id + ); + if (index === -1) { + return [...messages, convertMessage(message.data)]; + } + return [ + ...messages.slice(0, index), + convertMessage(message.data), + ...messages.slice(index + 1), + ]; + }); + + const writer = activeMessageChunkStreamsRef.current.get( + message.data.id + ); + if (writer) { + writer.close().catch(() => {}); + activeMessageChunkStreamsRef.current.delete(message.data.id); + } + break; + case "message.updated": + setMessagesAndSyncRefs((messages) => { + const index = messages.findIndex( + (m) => m.id === message.data.id + ); + if (index === -1) { + return messages; + } + return [ + ...messages.slice(0, index), + convertMessage(message.data), + ...messages.slice(index + 1), + ]; + }); + break; + case "message.deleted": + setMessagesAndSyncRefs((messages) => + messages.filter((m) => m.id !== message.data.id) + ); + break; + case "chat.updated": { + switch (message.data.status) { + case "streaming": + setStatusAndSyncRef("streaming"); + break; + case "error": + setStatusAndSyncRef("error"); + setError(new Error(message.data.error ?? "Unknown error")); + break; + case "idle": + setStatusAndSyncRef("ready"); + break; + case "interrupted": + setStatusAndSyncRef("ready"); + break; + default: + setStatusAndSyncRef("error"); + setError( + new Error(`Unknown chat status: ${message.data.status}`) + ); + break; + } + } + } + } + } catch (err) { + if (shouldReconnectRef.current) { + setError(err as Error); + } + } finally { + const isCurrent = streamRef.current === stream; + if (isCurrent) { + streamRef.current = undefined; + clearActiveChunkWriters(); + setStatusAndSyncRef("ready"); + if ( + shouldReconnectRef.current && + chatIDRef.current && + !manualStopRef.current + ) { + scheduleReconnect(); + } + } + } + }, + [ + handleMessageChunk, + convertMessage, + clearActiveChunkWriters, + scheduleReconnect, + setMessagesAndSyncRefs, + setStatusAndSyncRef, + ] + ); + + const attachToStream = useCallback( + (stream: AsyncIterableStream) => { + if (reconnectTimeoutRef.current) { + clearTimeout(reconnectTimeoutRef.current); + reconnectTimeoutRef.current = null; + } + if (streamRef.current) { + streamRef.current.cancel().catch(() => {}); + } + reconnectAttemptRef.current = 0; + readStream(stream).catch((err) => { + setError(err); + }); + }, + [readStream] + ); + + const connect = useCallback(async () => { + // Check-then-act race fix: set connectingRef immediately + if (!chatIDRef.current || connectingRef.current || streamRef.current) { + return; + } + connectingRef.current = true; + + // Double-check after setting flag (race-free) + if (!chatIDRef.current || streamRef.current) { + connectingRef.current = false; + return; + } + + if (reconnectTimeoutRef.current) { + clearTimeout(reconnectTimeoutRef.current); + reconnectTimeoutRef.current = null; + } + const controller = new AbortController(); + streamAbortRef.current = controller; + try { + const stream = await clientRef.current.chats.stream(chatIDRef.current, { + transport: "websocket", + signal: controller.signal, + }); + attachToStream(stream); + reconnectAttemptRef.current = 0; + } catch (err) { + setError(err as Error); + scheduleReconnect(); + } finally { + connectingRef.current = false; + } + }, [attachToStream, scheduleReconnect]); + + useEffect(() => { + if (!chatID) { + return; + } + if (streamRef.current || connectingRef.current) { + return; + } + connect(); + }, [chatID, connect]); + + useEffect(() => { + return () => { + shouldReconnectRef.current = false; + disconnect(true); + }; + }, [disconnect]); + + useEffect(() => { + const onOnline = () => { + if (!chatIDRef.current) return; + reconnectAttemptRef.current = 0; + if (!streamRef.current && !connectingRef.current) { + connect(); + } + }; + const onVisibilityChange = () => { + if (document.visibilityState === "visible") { + onOnline(); + } + }; + window.addEventListener("online", onOnline); + document.addEventListener("visibilitychange", onVisibilityChange); + return () => { + window.removeEventListener("online", onOnline); + document.removeEventListener("visibilitychange", onVisibilityChange); + }; + }, [connect]); + + const submit = useCallback( + async (message?: CreateUIMessage) => { + setStatusAndSyncRef("submitted"); + + if (!agentIDRef.current) { + setError(new Error("No agent selected")); + return; + } + + if (!message) { + return; + } + + const preInsertedIDs: string[] = []; + const requestMessages: SendMessagesRequest["messages"] = []; + if (message) { + requestMessages.push({ + role: message.role ?? "user", + parts: message.parts, + metadata: message.metadata as + | Record + | null + | undefined, + format: "ai-sdk", + }); + + const preInsertedID = crypto.randomUUID(); + preInsertedIDs.push(preInsertedID); + setMessagesAndSyncRefs((messages) => [ + ...messages, + { + id: preInsertedID, + role: message.role ?? "user", + parts: message.parts, + metadata: message.metadata as + | Record + | null + | undefined, + format: "ai-sdk", + } as unknown as UI_MESSAGE, + ]); + } + + let responseMessages: SendMessagesResponse["messages"] = []; + if (chatID) { + const resp = await clientRef.current.messages.send({ + chat_id: chatID, + messages: requestMessages, + behavior: "interrupt", + }); + responseMessages = resp.messages; + } else { + const resp = await clientRef.current.chats.create({ + agent_deployment_id: agentDeploymentIDRef.current, + agent_id: agentIDRef.current, + organization_id: organizationIDRef.current, + messages: requestMessages, + stream: true, + }); + setChatIDAndSyncRef(resp.id); + attachToStream(resp.stream); + responseMessages = resp.messages; + } + + // Race-free deduplication: remove only pre-inserted messages, + // keep messages that came from streaming, and add new responses + setMessagesAndSyncRefs((messages) => { + // Keep messages that aren't pre-inserted + // (this includes messages that came from streaming) + const kept = messages.filter((m) => !preInsertedIDs.includes(m.id)); + // Add responses that don't already exist (from streaming or kept) + const newResponses = responseMessages + .filter((rm) => !messagesByIDRef.current.has(rm.id)) + .map((message) => convertMessage(message)); + return [...kept, ...newResponses]; + }); + }, + [ + chatID, + setChatIDAndSyncRef, + attachToStream, + convertMessage, + setStatusAndSyncRef, + setMessagesAndSyncRefs, + ] + ); + + return { + id: chatID, + error, + addToolResult: async () => {}, + stop: async () => { + if (!chatID) { + return; + } + manualStopRef.current = true; + disconnect(true); + await clientRef.current.chats.stop(chatID); + setStatusAndSyncRef("ready"); + // Re-enable reconnection for future user actions + manualStopRef.current = false; + }, + clearError: () => { + setError(undefined); + }, + messages, + sendMessage: async (message: SendMessageArg) => { + if (!message) { + return; + } + + let uiMessage: CreateUIMessage; + + if ("text" in message || "files" in message) { + const fileParts = Array.isArray(message.files) + ? message.files + : await convertFileListToFileUIParts(message.files); + + uiMessage = { + parts: [ + ...fileParts, + ...("text" in message && message.text != null + ? [{ type: "text" as const, text: message.text }] + : []), + ], + } as UI_MESSAGE; + } else { + uiMessage = message; + } + + try { + await submit(uiMessage); + } catch (err) { + console.error(err); + setError(err as Error); + } + setStatusAndSyncRef("streaming"); + }, + status, + setMessages: setMessagesAndSyncRefs, + }; +} diff --git a/packages/api/src/routes/agent-request.server.ts b/packages/api/src/routes/agent-request.server.ts new file mode 100644 index 0000000..cd8a659 --- /dev/null +++ b/packages/api/src/routes/agent-request.server.ts @@ -0,0 +1,352 @@ +import { BlinkInvocationTokenHeader } from "@blink.so/runtime/types"; +import type { Context } from "hono"; +import type { Bindings } from "../server"; +import { detectRequestLocation } from "../server-helper"; +import { generateAgentInvocationToken } from "./agents/me/me.server"; + +export default async function handleAgentRequest( + c: Context<{ Bindings: Bindings }>, + id: string, + legacy?: boolean +) { + const db = await c.env.database(); + const query = await db.selectAgentDeploymentByRequestID(id); + if (!query) { + // There is no agent for this request, check if it's a dev request. + const response = await c.env.devhook?.handleRequest(id, c.req.raw); + if (response) { + return response; + } + return c.json({ message: "No agent exists for this webook" }, 404); + } + if (!query.agent_deployment) { + return c.json( + { + message: `No deployment exists for this agent. Be sure to deploy your agent to receive webhook events`, + }, + 404 + ); + } + const directAccessURL = query.agent_deployment.direct_access_url; + if (!directAccessURL) { + return c.json( + { message: "The deployment isn't ready to receive webhook events" }, + 404 + ); + } + const incomingUrl = new URL(c.req.raw.url); + + let url: URL; + if (legacy) { + url = new URL("/webhook" + incomingUrl.search, directAccessURL); + } else { + url = new URL(incomingUrl.pathname, directAccessURL); + } + // Ensure we preserve the search params. + url.search = incomingUrl.search; + + let contentLength: number | undefined; + const contentLengthRaw = c.req.raw.headers.get("content-length"); + if (contentLengthRaw) { + contentLength = Number(contentLengthRaw); + if (isNaN(contentLength)) { + contentLength = undefined; + } + } + + // Nobody should ever need to send more than 50MB to an agent. + // This is even probably way too much. + if (contentLength && contentLength > 50 * 1024 * 1024) { + return c.json({ message: "Webhook payload is too large" }, 413); + } + + const receivedAt = new Date(); + const startTime = performance.now(); + const signal = AbortSignal.any([ + c.req.raw.signal, + // 10s timeout for the request. + AbortSignal.timeout(10 * 1000), + ]); + + // Fire-and-forget platform log for webhook request received (must not block) + const reqId = crypto.randomUUID(); + const pathWithQuery = incomingUrl.pathname + incomingUrl.search; + const truncatedPath = + pathWithQuery.length > 80 + ? pathWithQuery.slice(0, 80) + "..." + : pathWithQuery; + + // Extract useful headers for logging (not sensitive ones) + const interestingHeaders = [ + "origin", + "referer", + "user-agent", + "content-type", + "x-forwarded-for", + "x-real-ip", + "cf-connecting-ip", + "x-github-event", + "x-github-delivery", + "x-hub-signature", + "x-slack-signature", + ]; + const logHeaders: Record = {}; + for (const header of interestingHeaders) { + const value = c.req.raw.headers.get(header); + if (value) { + logHeaders[header] = value; + } + } + + c.executionCtx.waitUntil( + c.env.logs.write({ + agent_id: query.agent_deployment.agent_id, + event: { + type: "blink.request.webhook", + level: "info", + ts: receivedAt.toISOString(), + source: "platform", + message: `↩ Webhook: ${c.req.raw.method} ${truncatedPath}`, + agent: { + id: query.agent_deployment.agent_id, + deployment_id: query.agent_deployment.id, + }, + correlation: { + webhook_id: id, + request_id: reqId, + }, + request: { + method: c.req.raw.method, + url: c.req.raw.url, + handler_location: detectRequestLocation(c.req.raw), + headers: logHeaders, + }, + }, + }) + ); + + let requestBodyPromise: Promise | undefined; + let upstreamBody: ReadableStream | undefined; + if (c.req.raw.body) { + let downstreamBody: ReadableStream; + [upstreamBody, downstreamBody] = c.req.raw.body.tee(); + requestBodyPromise = readBody(c.req.raw.headers, downstreamBody, 64 * 1024); + } + + const headers = new Headers(); + c.req.raw.headers.forEach((value, key) => { + headers.set(key, value); + }); + headers.set( + BlinkInvocationTokenHeader, + await generateAgentInvocationToken(c.env.AUTH_SECRET, { + agent_id: query.agent_deployment.agent_id, + agent_deployment_id: query.agent_deployment.id, + agent_deployment_target_id: query.agent_deployment.target_id, + }) + ); + + let response: Response | undefined; + let error: string | undefined; + try { + response = await fetch(url, { + body: upstreamBody, + method: c.req.raw.method, + signal, + headers, + }); + } catch (err) { + error = err instanceof Error ? err.message : JSON.stringify(err); + } + + const agentID = query.agent_deployment.agent_id; + const deploymentID = query.agent_deployment.id; + + let responseBodyPromise: Promise | undefined; + if (response && response.body) { + const [toClient, toLog] = response.body.tee(); + responseBodyPromise = readBody(response.headers, toLog, 64 * 1024); + response = new Response(toClient, { + status: response.status, + statusText: response.statusText, + headers: response.headers, + }); + } + + const durationMs = Math.round(performance.now() - startTime); + + if (response) { + // Fire-and-forget platform log for successful webhook response (must not block) + c.executionCtx.waitUntil( + c.env.logs.write({ + agent_id: agentID, + event: { + type: "blink.request.webhook", + level: "info", + ts: new Date().toISOString(), + source: "platform", + message: `↩ Webhook: ${c.req.raw.method} ${truncatedPath} → ${response.status} (${durationMs}ms)`, + agent: { + id: agentID, + deployment_id: deploymentID, + }, + correlation: { + webhook_id: id, + request_id: reqId, + }, + request: { + method: c.req.raw.method, + url: c.req.raw.url, + handler_location: detectRequestLocation(c.req.raw), + headers: logHeaders, + }, + response: { + status: response.status, + duration_ms: durationMs, + }, + }, + }) + ); + return response; + } else { + // Fire-and-forget platform log for webhook request error (must not block) + c.executionCtx.waitUntil( + c.env.logs.write({ + agent_id: agentID, + event: { + type: "blink.request.webhook", + level: "error", + ts: new Date().toISOString(), + source: "platform", + message: `↩ Webhook: ${c.req.raw.method} ${truncatedPath} → ${error || "Unknown error"} (${durationMs}ms)`, + agent: { + id: agentID, + deployment_id: deploymentID, + }, + correlation: { + webhook_id: id, + request_id: reqId, + }, + request: { + method: c.req.raw.method, + url: c.req.raw.url, + handler_location: detectRequestLocation(c.req.raw), + headers: logHeaders, + }, + error: error || "Unknown error occurred", + response: { + duration_ms: durationMs, + }, + }, + }) + ); + return c.json( + { + message: + "Error handling webhook. Check the Blink dashboard for more details", + }, + 500 + ); + } +} + +interface RedactHeadersResult { + headers: Record; + redacted: boolean; +} + +// redactHeaders replaces sensitive headers with "REDACTED" and +// limits the number of headers to 100. +function redactHeaders(incoming: Headers): RedactHeadersResult { + const headers: Record = {}; + let headerCount = 0; + let redacted = false; + const sensitiveHeaders = ["authorization", "cookie", "set-cookie"]; + incoming.forEach((value, key) => { + if (headerCount >= 60) { + redacted = true; + return; + } + if (key.length > 128) { + redacted = true; + key = key.slice(0, 128); + } + if (value.length > 2048) { + redacted = true; + value = value.slice(0, 2048) + " ... [truncated]"; + } + headerCount++; + if (sensitiveHeaders.includes(key.toLowerCase())) { + headers[key] = "REDACTED"; + } else { + headers[key] = value; + } + }); + return { + headers: headers, + redacted, + }; +} + +interface ReadBodyResult { + body: string; + truncated: boolean; +} + +async function readBody( + headers: Headers, + body: ReadableStream, + maxLength: number +): Promise { + if (!isTextual(headers.get("content-type"))) { + // For non-textual content, cancel the stream immediately. + // We don't need to read it, just ensure it's canceled to signal + // to Cloudflare that we're not using this teed stream. + await body.cancel(); + return undefined; + } + const reader = body.getReader(); + try { + const decoder = new TextDecoder(); + let result = ""; + let totalRead = 0; + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + const chunk = decoder.decode(value, { stream: true }); + result += chunk; + totalRead += chunk.length; + if (totalRead > maxLength) { + // Cancel the reader - we've read enough + await reader.cancel(); + return { + body: result, + truncated: true, + }; + } + } + return { + body: result, + truncated: false, + }; + } finally { + reader.releaseLock(); + } +} + +const isTextual = (contentType: string | null) => { + if (!contentType) { + return false; + } + const v = contentType.toLowerCase(); + return ( + v.startsWith("text/") || + v.includes("json") || + v.includes("xml") || + v.includes("x-www-form-urlencoded") || + v.includes("graphql") || + v.includes("cloudevents+json") + ); +}; diff --git a/packages/api/src/routes/agent-request.test.ts b/packages/api/src/routes/agent-request.test.ts new file mode 100644 index 0000000..c41860c --- /dev/null +++ b/packages/api/src/routes/agent-request.test.ts @@ -0,0 +1,61 @@ +import { expect, test } from "bun:test"; +import { serve } from "../test"; + +test("webhook", async () => { + let deployedPromise: Promise | undefined; + + const { bindings, helpers, url } = await serve({ + bindings: { + async deployAgent(deployment): Promise { + deployedPromise = (async () => { + const srv = await Bun.serve({ + fetch: () => { + return new Response("Hello, world!"); + }, + port: 0, + }); + + const db = await bindings.database(); + await db.updateAgentDeployment({ + id: deployment.id, + agent_id: deployment.agent_id, + status: "success", + direct_access_url: srv.url.toString(), + }); + await db.updateAgent({ + id: deployment.agent_id, + active_deployment_id: deployment.id, + }); + })(); + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "public", + + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + await deployedPromise!; + if (!agent.request_url) { + throw new Error("No webhook route"); + } + + // Test the wildcard hostname routing (current implementation). + // We need to make the request go through the test server with the correct Host header. + const agentRequestURL = new URL(agent.request_url!); + const response1 = await fetch(agentRequestURL); + expect(response1.status).toBe(200); + expect(await response1.text()).toBe("Hello, world!"); +}); diff --git a/packages/api/src/routes/agents/agents.client.ts b/packages/api/src/routes/agents/agents.client.ts new file mode 100644 index 0000000..2d75ecb --- /dev/null +++ b/packages/api/src/routes/agents/agents.client.ts @@ -0,0 +1,359 @@ +import type { UIOptions, UIOptionsSchema } from "blink"; +import { z } from "zod"; +import { + assertResponseStatus, + nameFormat, + schemaPaginatedRequest, + schemaPaginatedResponse, + streamSSE, +} from "../../client-helper"; +import Client from "../../client.browser"; +import { + createAsyncIterableStream, + type AsyncIterableStream, +} from "../../util/async-iterable-stream"; +import AgentDeployments, { + schemaAgentDeploymentUploadFile, +} from "./deployments.client"; +import AgentEnv, { schemaCreateAgentEnv } from "./env.client"; +import AgentLogs from "./logs.client"; +import AgentMembers from "./members.client"; +import AgentRuns from "./runs.client"; +import AgentSteps from "./steps.client"; +import AgentTraces from "./traces.client"; + +export const schemaAgentVisibility = z.enum([ + "private", + "public", + "organization", +]); + +export const schemaCreateAgentRequest = z.object({ + organization_id: z.uuid(), + name: z.string().regex(nameFormat), + + description: z.string().optional(), + visibility: schemaAgentVisibility.default("organization").optional(), + // Time-to-live in seconds for chats created by this agent. + // null or undefined means chats never expire (kept forever). + chat_expire_ttl: z.number().int().positive().nullable().optional(), + + // These can optionally provided to trigger a deployment. + source_files: z.array(schemaAgentDeploymentUploadFile).optional(), + // If provided, a build will not occur and the files will be used as-is. + output_files: z.array(schemaAgentDeploymentUploadFile).optional(), + entrypoint: z.string().optional(), + env: z.array(schemaCreateAgentEnv).optional(), + + // Optional: Specify the request_id for the production deployment target. + // This is useful for setting up webhooks before the agent is fully deployed. + request_id: z.uuid().optional(), +}); + +export type CreateAgentRequest = z.infer; + +export const schemaAgent = z.object({ + id: z.uuid(), + organization_id: z.uuid(), + created_at: z.iso.datetime(), + updated_at: z.iso.datetime(), + created_by: z.uuid(), + name: z.string().regex(nameFormat), + description: z.string().nullable(), + avatar_url: z.string().nullable(), + visibility: schemaAgentVisibility, + active_deployment_id: z.uuid().nullable(), + pinned: z.boolean().default(false), + request_url: z + .url() + .nullable() + .describe("The URL for the agent requests. Only visible to owners."), + chat_expire_ttl: z.number().int().positive().nullable(), + user_permission: z.enum(["read", "write", "admin"]).optional(), +}); + +export const schemaUpdateAgentRequest = z.object({ + id: z.uuid(), + name: z.string().regex(nameFormat).optional(), + description: z.string().optional(), + visibility: schemaAgentVisibility.optional(), + active_deployment_id: z.uuid().optional(), + avatar_file_id: z.uuid().nullable().optional(), + chat_expire_ttl: z.number().int().positive().nullable().optional(), +}); + +export type UpdateAgentRequest = z.infer; + +export type Agent = z.infer; + +export const schemaListAgentsRequest = schemaPaginatedRequest.extend({ + organization_id: z.uuid().optional(), + pinned: z.boolean().optional(), +}); + +export type ListAgentsRequest = z.infer; + +export const schemaListAgentsResponse = schemaPaginatedResponse(schemaAgent); + +export type ListAgentsResponse = z.infer; + +export const schemaAgentCompletionRequest = z.object({ + agent_id: z.uuid(), + input: z.string(), + caret: z.number().optional(), + selection: z.tuple([z.number(), z.number()]).optional(), + + chat_id: z.uuid().optional(), + agent_deployment_id: z.uuid().optional(), +}); + +export type AgentCompletionRequest = z.infer< + typeof schemaAgentCompletionRequest +>; + +export const schemaAgentCompletionResponse = z.object({ + text: z.string(), + caret: z.number().optional(), + selection: z.tuple([z.number(), z.number()]).optional(), +}); + +export type AgentCompletion = + | { + text: string; + replace?: [number, number]; + } + | { + id: string; + label: string; + detail?: string; + insertText?: string; + replace?: [number, number]; + }; + +export const schemaAgentUIOptionsRequest = z.object({ + agent_id: z.uuid(), + agent_deployment_id: z.uuid().optional(), + selected: z.record(z.string(), z.string()).optional(), +}); + +export type AgentUIOptionsRequest = z.infer; + +export const schemaAgentRuntimeUsageRequest = z.object({ + agent_id: z.uuid(), + start_time: z.iso.datetime().pipe(z.coerce.date()), + end_time: z.iso.datetime().pipe(z.coerce.date()), +}); + +export type AgentRuntimeUsageRequest = z.infer< + typeof schemaAgentRuntimeUsageRequest +>; + +export const schemaAgentRuntimeUsageResponse = z.object({ + seconds: z.string(), +}); + +export type AgentRuntimeUsageResponse = z.infer< + typeof schemaAgentRuntimeUsageResponse +>; + +export default class Agents { + private readonly client: Client; + public readonly deployments: AgentDeployments; + public readonly env: AgentEnv; + public readonly runs: AgentRuns; + public readonly steps: AgentSteps; + public readonly logs: AgentLogs; + public readonly traces: AgentTraces; + public readonly members: AgentMembers; + + public constructor(client: Client) { + this.client = client; + this.deployments = new AgentDeployments(client); + this.env = new AgentEnv(client); + this.runs = new AgentRuns(client); + this.steps = new AgentSteps(client); + this.logs = new AgentLogs(client); + this.traces = new AgentTraces(client); + this.members = new AgentMembers(client); + } + + /** + * Create an agent. + * + * @param request - The request body. + * @returns The agent. + */ + public async create(request: CreateAgentRequest): Promise { + const resp = await this.client.request( + "POST", + "/api/agents", + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Update an agent. + * + * @param request - The request body. + * @returns The agent. + */ + public async update(request: UpdateAgentRequest): Promise { + const resp = await this.client.request( + "PATCH", + `/api/agents/${request.id}`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Get an agent. + * + * @param id - The id of the agent. + * @returns The agent. + */ + public async get(id: string): Promise { + const resp = await this.client.request("GET", `/api/agents/${id}`); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * List agents. + * + * @param request - The request body. + * @returns The agents. + */ + public async list(request: ListAgentsRequest): Promise { + const query = new URLSearchParams(); + if (request.organization_id) { + query.set("organization_id", request.organization_id); + } + if (request.page) { + query.set("page", request.page.toString()); + } + if (request.per_page) { + query.set("per_page", request.per_page.toString()); + } + if (typeof request.pinned === "boolean") { + query.set("pinned", request.pinned.toString()); + } + const resp = await this.client.request( + "GET", + `/api/agents?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete an agent. + * + * @param id - The id of the agent. + */ + public async delete(id: string): Promise { + const resp = await this.client.request("DELETE", `/api/agents/${id}`); + await assertResponseStatus(resp, 204); + } + + /** + * Get input completions for an agent. + * + * @param request - The request body. + * @returns The completions. + */ + public async completions( + request: AgentCompletionRequest + ): Promise> { + const req = await this.client.request( + "POST", + `/api/agents/${request.agent_id}/completions`, + JSON.stringify(request) + ); + await assertResponseStatus(req, 200); + if (req.headers.get("content-type") === "application/json") { + const body: AgentCompletion = await req.json(); + return createAsyncIterableStream( + new ReadableStream({ + start(controller) { + controller.enqueue(body); + controller.close(); + }, + }) + ); + } + return streamSSE(req, schemaAgentCompletionResponse); + } + + /** + * Get the options schema for an agent. + * + * @param request - The request body. + * @returns The options schema. + */ + public async uiOptions( + request: AgentUIOptionsRequest + ): Promise> { + const query = new URLSearchParams(); + if (request.agent_deployment_id) { + query.set("agent_deployment_id", request.agent_deployment_id); + } + if (request.selected) { + query.set("selected", JSON.stringify(request.selected)); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/ui-options?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Pin an agent for the current user. + * + * @param id - The id of the agent. + */ + public async pin(id: string): Promise { + const resp = await this.client.request("POST", `/api/agents/${id}/pin`); + await assertResponseStatus(resp, 204); + } + + /** + * Unpin an agent for the current user. + * + * @param id - The id of the agent. + */ + public async unpin(id: string): Promise { + const resp = await this.client.request("DELETE", `/api/agents/${id}/pin`); + await assertResponseStatus(resp, 204); + } + + /** + * Get runtime usage for an agent. + * + * @param request - The request body. + * @returns The runtime usage in seconds. + */ + public async getRuntimeUsage( + request: AgentRuntimeUsageRequest + ): Promise { + const query = new URLSearchParams(); + query.set("start_time", request.start_time.toISOString()); + query.set("end_time", request.end_time.toISOString()); + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/usage/runtime?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} + +export * from "./deployments.client"; +export * from "./members.client"; +export * from "./runs.client"; +export * from "./steps.client"; diff --git a/packages/api/src/routes/agents/agents.server.ts b/packages/api/src/routes/agents/agents.server.ts new file mode 100644 index 0000000..9a5b86d --- /dev/null +++ b/packages/api/src/routes/agents/agents.server.ts @@ -0,0 +1,487 @@ +import * as convert from "@blink.so/database/convert"; +import type { Agent } from "@blink.so/database/schema"; +import { Client } from "blink/client"; +import { Hono, type Context } from "hono"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import { streamSSE } from "../../client-helper"; +import { + authorizeOrganization, + withAgentPermission, + withAgentURLParam, + withAuth, + withPagination, +} from "../../middleware"; +import type { Bindings } from "../../server"; +import { isUniqueConstraintError } from "../../server-helper"; +import { + schemaAgentCompletionRequest, + schemaAgentCompletionResponse, + schemaAgentRuntimeUsageRequest, + schemaCreateAgentRequest, + schemaUpdateAgentRequest, + type ListAgentsResponse, +} from "./agents.client"; +import mountDeployments, { createAgentDeployment } from "./deployments.server"; +import mountEnv from "./env.server"; +import mountLogs from "./logs.server"; +import mountAgentsMe from "./me/me.server"; +import mountAgentMembers from "./members.server"; +import mountRuns from "./runs.server"; +import mountSteps from "./steps.server"; +import mountTraces from "./traces.server"; + +export default function mountAgents(app: Hono<{ Bindings: Bindings }>) { + // Create an agent. + app.post( + "/", + withAuth, + validator("json", (value, c) => { + return schemaCreateAgentRequest.parse(value); + }), + async (c) => { + const req = c.req.valid("json"); + const org = await authorizeOrganization(c, req.organization_id); + const db = await c.env.database(); + try { + const agent = await db.tx(async (tx) => { + const agent = await tx.insertAgent({ + organization_id: org.id, + created_by: c.get("user_id"), + name: req.name, + description: req.description, + visibility: req.visibility ?? "organization", + chat_expire_ttl: req.chat_expire_ttl, + }); + + // Grant admin permission to the creator + await tx.upsertAgentPermission({ + agent_id: agent.id, + user_id: agent.created_by, + permission: "admin", + created_by: agent.created_by, + }); + + // If a request_id was specified, update the production deployment target + if (req.request_id) { + const productionTarget = await tx.selectAgentDeploymentTargetByName( + agent.id, + "production" + ); + if (productionTarget) { + await tx.updateAgentDeploymentTarget(productionTarget.id, { + request_id: req.request_id, + }); + } + } + + if (req.env) { + for (const env of req.env) { + await tx.insertAgentEnvironmentVariable({ + agent_id: agent.id, + key: env.key, + value: env.value, + secret: env.secret, + // By default, insert for both preview and production. + target: env.target ?? ["preview", "production"], + created_by: c.get("user_id"), + updated_by: c.get("user_id"), + }); + } + } + + if (req.output_files || req.source_files) { + // Since the target is production, this will be the active + // deployment for the agent assuming the build is successful. + await createAgentDeployment({ + req: c.req.raw, + db: tx, + bindings: c.env, + outputFiles: req.output_files, + sourceFiles: req.source_files, + entrypoint: req.entrypoint, + agentID: agent.id, + userID: c.get("user_id"), + organizationID: org.id, + target: "production", + }); + } + + return agent; + }); + return c.json( + convert.agent(agent, await createAgentRequestURL(c, agent), "admin") + ); + } catch (error) { + if (isUniqueConstraintError(error, "agent_organization_id_lower_idx")) { + return c.json({ error: "That name is already taken!" }, 400); + } + throw error; + } + } + ); + + // List agents for the current user. + // Optionally, filter by organization ID. + app.get("/", withAuth, withPagination, async (c) => { + const orgParam = c.req.query("organization_id"); + const db = await c.env.database(); + if (orgParam) { + await authorizeOrganization(c, orgParam); + } + + let pinned: boolean | undefined; + if (c.req.query("pinned")) { + if (c.req.query("pinned") === "true") { + pinned = true; + } else if (c.req.query("pinned") === "false") { + pinned = false; + } + } + + const agents = await db.selectAgentsForUser({ + userID: c.get("user_id"), + organizationID: orgParam, + pinned, + page: c.get("page"), + per_page: c.get("per_page"), + }); + + const response: ListAgentsResponse = { + items: await Promise.all( + agents.items.map(async (agent) => + convert.agent( + agent, + await createAgentRequestURL(c, agent), + await getAgentUserPermission(c, agent) + ) + ) + ), + has_more: agents.has_more, + }; + return c.json(response); + }); + + // Get an agent. + app.get( + "/:agent_id", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + async (c) => { + const agent = c.get("agent"); + return c.json( + convert.agent( + agent, + await createAgentRequestURL(c, agent), + await getAgentUserPermission(c, agent) + ) + ); + } + ); + + // Update an agent. + app.patch( + "/:agent_id", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + validator("json", (value) => { + return schemaUpdateAgentRequest.parse(value); + }), + async (c) => { + const agent = c.get("agent"); + const db = await c.env.database(); + const req = c.req.valid("json"); + + // Changing visibility requires admin permission + if (req.visibility !== undefined && req.visibility !== agent.visibility) { + const permission = c.get("agent_permission"); + if (permission !== "admin") { + throw new HTTPException(403, { + message: + "Changing agent visibility requires admin permission. You have " + + permission + + " permission.", + }); + } + } + + try { + const updated = await db.updateAgent({ + id: agent.id, + name: req.name, + description: req.description, + visibility: req.visibility, + active_deployment_id: req.active_deployment_id, + avatar_file_id: req.avatar_file_id, + chat_expire_ttl: req.chat_expire_ttl, + }); + return c.json( + convert.agent( + updated, + await createAgentRequestURL(c, updated), + await getAgentUserPermission(c, updated) + ) + ); + } catch (error) { + if (isUniqueConstraintError(error, "agent_organization_id_lower_idx")) { + return c.json({ error: "That name is already taken!" }, 400); + } + throw error; + } + } + ); + + // Pin an agent. + app.post("/:agent_id/pin", withAuth, withAgentURLParam, async (c) => { + const agent = c.get("agent"); + const db = await c.env.database(); + try { + await db.insertAgentPin({ + agent_id: agent.id, + user_id: c.get("user_id"), + }); + } catch (err) { + if (!isUniqueConstraintError(err)) { + throw err; + } + } + return c.body(null, 204); + }); + + // Unpin an agent. + app.delete("/:agent_id/pin", withAuth, withAgentURLParam, async (c) => { + const agent = c.get("agent"); + const db = await c.env.database(); + await db.deleteAgentPin({ agentID: agent.id, userID: c.get("user_id") }); + return c.body(null, 204); + }); + + // Delete an agent. + app.delete( + "/:agent_id", + withAuth, + withAgentURLParam, + withAgentPermission("admin"), + async (c) => { + const agent = c.get("agent"); + const db = await c.env.database(); + await db.deleteAgent({ id: agent.id }); + return c.body(null, 204); + } + ); + + // Get input completions for an agent. + app.post( + "/:agent_id/completions", + withAuth, + withAgentURLParam, + validator("json", (value) => { + return schemaAgentCompletionRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const req = c.req.valid("json"); + const deployment = await db.selectAgentDeploymentByIDOrActive({ + agentID: req.agent_id, + id: req.agent_deployment_id, + }); + if (!deployment) { + return c.json({ error: "Deployment not found" }, 404); + } + // Perform a fetch to the URL. + if (!deployment.direct_access_url) { + return c.json({ error: "Deployment is not ready" }, 503); + } + const url = new URL("/_agent/completions", deployment.direct_access_url); + const resp = await fetch(url, { + method: "POST", + body: JSON.stringify({ + input: req.input, + caret: req.caret, + selection: req.selection, + }), + }); + if (!resp.ok) { + return c.json({ error: "Failed to get completions" }, 500); + } + if (resp.headers.get("content-type") === "application/json") { + const body = await resp.json(); + return c.json(body); + } else if (resp.headers.get("content-type") !== "text/event-stream") { + return c.json({ error: "Unexpected content type" }, 500); + } + return new Response(streamSSE(resp, schemaAgentCompletionResponse), { + headers: { + "Content-Type": "text/event-stream", + }, + }); + } + ); + + // Get the options schema for an agent. + app.get("/:agent_id/ui-options", withAuth, withAgentURLParam, async (c) => { + const agent = c.get("agent"); + const deploymentID = c.req.query("agent_deployment_id"); + const db = await c.env.database(); + const deployment = await db.selectAgentDeploymentByIDOrActive({ + agentID: agent.id, + id: deploymentID, + }); + if (!deployment) { + return c.json({ error: "Deployment not found" }, 404); + } + // Perform a fetch to the URL. + if (!deployment.direct_access_url) { + return c.json({ error: "Deployment is not ready" }, 503); + } + + const selectedRaw = c.req.query("selected"); + let selected: Record | undefined; + if (selectedRaw) { + try { + selected = JSON.parse(selectedRaw); + } catch (error) { + return c.json({ error: "Invalid selected options" }, 400); + } + } + + // Build an input that uniquely determines the response for caching. + const etagInput = { + agent_id: agent.id, + agent_deployment_id: deployment.id, + selected, + // Tie to user/org access in case permissions change response shape. + user_id: c.get("user_id"), + organization_id: c.get("organization").id, + // Also include a stable identifier for the deployment content. + deployment_updated_at: deployment.updated_at, + }; + const etag = await computeETag(etagInput); + const ifNoneMatch = c.req.header("if-none-match"); + if (ifNoneMatch && (ifNoneMatch === `W/${etag}` || ifNoneMatch === etag)) { + return c.body(null, 304, { + ETag: etag, + // This caches based on the deployment context, so it's safe to keep + // for a while. With consistent inputs, it's safe to assume we + // should expect consistent responses. + "Cache-Control": "private, max-age=600, stale-while-revalidate=120", + // Vary on these request headers since they affect auth and conditional. + Vary: "Authorization, Cookie", + }); + } + + const client = new Client({ + baseUrl: deployment.direct_access_url, + }); + const resp = await client.ui({ + selectedOptions: selected, + }); + return c.json(resp, 200, { + ETag: etag, + // Private cache with revalidation; downstream can use conditional requests. + "Cache-Control": "private, max-age=0, must-revalidate", + Vary: "Authorization, Cookie", + }); + }); + + // Get runtime usage for an agent. + app.get( + "/:agent_id/usage/runtime", + withAuth, + withAgentURLParam, + validator("query", (value, c) => { + const agent = c.get("agent"); + return schemaAgentRuntimeUsageRequest.parse({ + agent_id: agent.id, + start_time: value["start_time"], + end_time: value["end_time"], + }); + }), + async (c) => { + const validated = c.req.valid("query"); + const seconds = await c.env.runtime.usage({ + agent_id: validated.agent_id, + start_time: validated.start_time, + end_time: validated.end_time, + }); + return c.json({ seconds }); + } + ); + + mountDeployments(app.basePath("/:agent_id/deployments")); + mountEnv(app.basePath("/:agent_id/env")); + mountSteps(app.basePath("/:agent_id/steps")); + mountRuns(app.basePath("/:agent_id/runs")); + mountLogs(app.basePath("/:agent_id/logs")); + mountTraces(app.basePath("/:agent_id/traces")); + mountAgentMembers(app.basePath("/:agent_id/members")); + + // This is special - just for the agent invocation API. + // We don't like to do this, but we do because this API + // should be fully managed by us, for now. + mountAgentsMe(app.basePath("/me")); +} + +export const createAgentRequestURL = async ( + c: Context<{ Bindings: Bindings; Variables: any }>, + agent: Agent +): Promise => { + if (!c.env.createRequestURL) { + return; + } + // Get the production deployment target's request_id + const db = await c.env.database(); + const target = await db.selectAgentDeploymentTargetByName( + agent.id, + "production" + ); + if (!target) { + return; + } + return c.env.createRequestURL(target.request_id); +}; + +/** + * Get the user's permission level for an agent + */ +export const getAgentUserPermission = async ( + c: Context<{ Bindings: Bindings; Variables: any }>, + agent: Agent +): Promise<"read" | "write" | "admin"> => { + const db = await c.env.database(); + const org = await db.selectOrganizationForUser({ + organizationID: agent.organization_id, + userID: c.get("user_id"), + }); + + const permission = await db.getAgentPermissionForUser({ + agentId: agent.id, + userId: c.get("user_id"), + orgRole: org?.membership?.role, + agentVisibility: agent.visibility, + }); + + if (permission === undefined) { + throw new HTTPException(403, { + message: "You don't have permission to access this agent", + }); + } + + return permission; +}; + +// Compute a stable strong ETag for a given input payload. +async function computeETag(payload: unknown): Promise { + const encoder = new TextEncoder(); + const data = encoder.encode(JSON.stringify(payload)); + const hash = await crypto.subtle.digest("SHA-1", data); + const bytes = new Uint8Array(hash); + let hex = ""; + for (let i = 0; i < bytes.length; i++) { + const h = bytes[i]!.toString(16).padStart(2, "0"); + hex += h; + } + return `"${hex}"`; +} diff --git a/packages/api/src/routes/agents/agents.test.ts b/packages/api/src/routes/agents/agents.test.ts new file mode 100644 index 0000000..2309614 --- /dev/null +++ b/packages/api/src/routes/agents/agents.test.ts @@ -0,0 +1,353 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("CRUD /api/agents", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + }); + + let agents = await client.agents.list({ + organization_id: org.id, + }); + expect(agents.items.length).toBe(1); + expect(agents.items[0]).toEqual(agent); + + await client.agents.delete(agent.id); + + agents = await client.agents.list({ + organization_id: org.id, + }); + expect(agents.items.length).toBe(0); +}); + +test("create agent with deployment and env", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + + env: [ + { + key: "TEST_ENV", + value: "test", + secret: false, + }, + ], + }); + + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + expect(deployment.output_files.length).toBe(1); + expect(deployment.output_files[0]!.path).toBe("test.js"); + expect(deployment.output_files[0]!.id).toBeDefined(); + expect(deployment.target).toBe("production"); + + const vars = await client.agents.env.list({ + agent_id: agent.id, + }); + expect(vars.length).toBe(1); + expect(vars[0]!.key).toBe("TEST_ENV"); + expect(vars[0]!.value).toBe("test"); + expect(vars[0]!.secret).toBe(false); + // By default, it's for all environments. + expect(vars[0]!.target).toEqual(["preview", "production"]); +}); + +test("create and update agent with duplicate name", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + await expect( + client.agents.create({ + name: "test-AGENT", + organization_id: org.id, + }) + ).rejects.toThrow("That name is already taken!"); + + const second = await client.agents.create({ + name: "test-agent-2", + organization_id: org.id, + }); + + await expect( + client.agents.update({ + id: second.id, + name: "test-agent", + }) + ).rejects.toThrow("That name is already taken!"); +}); + +test("get agent runtime usage", async () => { + const { helpers } = await serve({ + bindings: { + runtime: { + usage: async () => "10.0", + }, + }, + }); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const startTime = new Date("2025-01-01T00:00:00Z"); + const endTime = new Date("2025-01-02T00:00:00Z"); + + const usage = await client.agents.getRuntimeUsage({ + agent_id: agent.id, + start_time: startTime, + end_time: endTime, + }); + + expect(usage.seconds).toBe("10.0"); +}); + +test("agent permissions - read user can view but not modify", async () => { + const { helpers, bindings } = await serve(); + const { user: ownerUser, client: ownerClient } = await helpers.createUser(); + const { user: readUser, client: readClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "test-org", + }); + + // Add read user to organization + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + + // Create a private agent + const agent = await ownerClient.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "private", + organization_id: org.id, + }); + + // Grant read permission + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + + // Read user can get agent + const fetchedAgent = await readClient.agents.get(agent.id); + expect(fetchedAgent.id).toBe(agent.id); + + // Read user cannot update agent + await expect( + readClient.agents.update({ + id: agent.id, + description: "Modified", + }) + ).rejects.toThrow("write permission"); + + // Read user cannot change visibility + await expect( + readClient.agents.update({ + id: agent.id, + visibility: "public", + }) + ).rejects.toThrow("write permission"); + + // Read user cannot delete agent + await expect(readClient.agents.delete(agent.id)).rejects.toThrow( + "admin permission" + ); + + // Read user cannot manage members + await expect( + readClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "write", + }) + ).rejects.toThrow("admin permission"); +}); + +test("agent permissions - write user can modify but not delete", async () => { + const { helpers, bindings } = await serve(); + const { user: ownerUser, client: ownerClient } = await helpers.createUser(); + const { user: writeUser, client: writeClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "test-org", + }); + + // Add write user to organization + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: writeUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "private", + organization_id: org.id, + }); + + // Grant write permission + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "write", + }); + + // Write user can update agent + const updated = await writeClient.agents.update({ + id: agent.id, + description: "Modified Description", + }); + expect(updated.description).toBe("Modified Description"); + + // Write user cannot change visibility (requires admin) + await expect( + writeClient.agents.update({ + id: agent.id, + visibility: "public", + }) + ).rejects.toThrow("admin permission"); + + // Write user cannot delete agent + await expect(writeClient.agents.delete(agent.id)).rejects.toThrow( + "admin permission" + ); + + // Write user cannot manage members + await expect( + writeClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "admin", + }) + ).rejects.toThrow("admin permission"); +}); + +test("agent permissions - admin can do everything including change visibility", async () => { + const { helpers, bindings } = await serve(); + const { user: ownerUser, client: ownerClient } = await helpers.createUser(); + const { user: adminUser, client: adminClient } = await helpers.createUser(); + const { user: newMemberUser, client: newMember } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "test-org", + }); + + // Add admin user to organization + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: adminUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + name: "test-agent", + visibility: "private", + organization_id: org.id, + }); + + // Grant admin permission + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: adminUser.id, + permission: "admin", + }); + + // Admin can update agent + await adminClient.agents.update({ + id: agent.id, + description: "Updated by admin", + }); + + // Admin can change visibility + const updated = await adminClient.agents.update({ + id: agent.id, + visibility: "public", + }); + expect(updated.visibility).toBe("public"); + + // Admin can manage members + await adminClient.agents.members.grant({ + agent_id: agent.id, + user_id: newMemberUser.id, + permission: "read", + }); + + const members = await adminClient.agents.members.list({ agent_id: agent.id }); + expect(members.items.length).toBe(3); // owner + admin + new member + + // Admin can delete agent + await adminClient.agents.delete(agent.id); +}); + +test("agent permissions - no access to private agent without permission", async () => { + const { helpers, bindings } = await serve(); + const { user: ownerUser, client: ownerClient } = await helpers.createUser(); + const { user: otherUser, client: otherClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "test-org", + }); + + // Add other user to the organization so they can attempt to access the agent + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: otherUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + name: "test-agent", + visibility: "private", + organization_id: org.id, + }); + + // Other user cannot access private agent without explicit permission + await expect(otherClient.agents.get(agent.id)).rejects.toThrow( + "private agent requires explicit permission" + ); +}); diff --git a/packages/api/src/routes/agents/deployments.client.ts b/packages/api/src/routes/agents/deployments.client.ts new file mode 100644 index 0000000..2ca6a6a --- /dev/null +++ b/packages/api/src/routes/agents/deployments.client.ts @@ -0,0 +1,259 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaPaginatedRequest, + schemaPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; + +export const schemaGetAgentDeploymentRequest = z.union([ + z.object({ + agent_id: z.uuid(), + deployment_id: z.uuid(), + }), + z.object({ + agent_id: z.uuid(), + deployment_number: z.number().int().positive(), + }), +]); + +export type GetAgentDeploymentRequest = z.infer< + typeof schemaGetAgentDeploymentRequest +>; + +export const schemaDeleteAgentDeploymentRequest = z.object({ + agent_id: z.uuid(), + deployment_id: z.uuid(), +}); + +export type DeleteAgentDeploymentRequest = z.infer< + typeof schemaDeleteAgentDeploymentRequest +>; + +export const schemaRedeployAgentDeploymentRequest = z.union([ + z.object({ + agent_id: z.uuid(), + deployment_id: z.uuid(), + }), + z.object({ + agent_id: z.uuid(), + deployment_number: z.number().int().positive(), + }), +]); + +export type RedeployAgentDeploymentRequest = z.infer< + typeof schemaRedeployAgentDeploymentRequest +>; + +export const schemaAgentDeploymentFile = z.object({ + path: z.string(), + id: z.uuid(), +}); + +export type AgentDeploymentFile = z.infer; + +export const schemaAgentDeploymentUploadFile = schemaAgentDeploymentFile.or( + z.object({ + path: z.string(), + // No inline data can exceed 5MB. + data: z.string().max(1024 * 1024 * 5), + }) +); + +export type AgentDeploymentUploadFile = z.infer< + typeof schemaAgentDeploymentUploadFile +>; + +export const schemaAgentDeploymentTarget = z.enum(["production", "preview"]); + +export type AgentDeploymentTarget = z.infer; + +export const schemaCreateAgentDeploymentRequest = z + .object({ + agent_id: z.uuid(), + output_files: z.array(schemaAgentDeploymentUploadFile).optional(), + source_files: z.array(schemaAgentDeploymentUploadFile).optional(), + // Legacy field for backwards compatibility + files: z.array(schemaAgentDeploymentUploadFile).optional(), + target: schemaAgentDeploymentTarget, + entrypoint: z.string().optional(), + message: z.string().max(128).optional(), + }) + .transform((data) => { + // Map legacy 'files' field to 'output_files' if 'output_files' is not provided + if (data.files && !data.output_files) { + return { + ...data, + output_files: data.files, + files: undefined, + }; + } + return data; + }); + +export type CreateAgentDeploymentRequest = z.infer< + typeof schemaCreateAgentDeploymentRequest +>; + +export const schemaAgentDeployment = z.object({ + id: z.uuid(), + number: z.number().int().positive(), + created_at: z.iso.datetime(), + updated_at: z.iso.datetime(), + created_by: z.uuid().nullable(), + created_from: z.enum(["cli"]), + agent_id: z.uuid(), + source_files: z.array(schemaAgentDeploymentFile), + output_files: z.array(schemaAgentDeploymentFile), + status: z.enum(["success", "failed", "deploying", "pending"]), + target: schemaAgentDeploymentTarget, + error_message: z.string().nullable(), + user_message: z.string().nullable(), + platform: z.enum(["lambda"]), + platform_memory_mb: z.number().int().positive(), + platform_region: z.string().nullable(), +}); + +export type AgentDeployment = z.infer; + +export const schemaAgentDeploymentLog = z.object({ + id: z.uuid(), + created_at: z.string().datetime(), + updated_at: z.string().datetime(), + agent_id: z.uuid(), + deployment_id: z.uuid(), + level: z.enum(["log", "info", "warning", "error"]), + message: z.string(), +}); + +export type AgentDeploymentLog = z.infer; + +export const schemaListAgentDeploymentsRequest = schemaPaginatedRequest.extend({ + agent_id: z.uuid(), + order: z.enum(["asc", "desc"]).default("asc").optional(), +}); + +export type ListAgentDeploymentsRequest = z.infer< + typeof schemaListAgentDeploymentsRequest +>; + +export const schemaListAgentDeploymentsResponse = schemaPaginatedResponse( + schemaAgentDeployment +); + +export type ListAgentDeploymentsResponse = z.infer< + typeof schemaListAgentDeploymentsResponse +>; + +export default class AgentDeployments { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * List the deployments for an agent. + * + * @param request - The request body. + * @returns The deployments. + */ + public async list( + request: ListAgentDeploymentsRequest + ): Promise { + const query = new URLSearchParams(); + if (request.page) { + query.set("page", request.page.toString()); + } + if (request.per_page) { + query.set("per_page", request.per_page.toString()); + } + if (request.order) { + query.set("order", request.order); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/deployments?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Get a deployment. + * + * @param request - The request body. + * @returns The deployment. + */ + public async get( + request: GetAgentDeploymentRequest + ): Promise { + let param: string; + if ("deployment_id" in request) { + param = request.deployment_id; + } else { + param = request.deployment_number.toString(); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/deployments/${param}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Create a deployment. + * + * @param request - The request body. + * @returns The deployment. + */ + public async create( + request: CreateAgentDeploymentRequest + ): Promise { + const resp = await this.client.request( + "POST", + `/api/agents/${request.agent_id}/deployments`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete a deployment. + * + * @param request - The request body. + * @returns The deployment. + */ + public async delete(request: DeleteAgentDeploymentRequest): Promise { + const resp = await this.client.request( + "DELETE", + `/api/agents/${request.agent_id}/deployments/${request.deployment_id}` + ); + await assertResponseStatus(resp, 200); + } + + /** + * Re-deploy an existing deployment. + * + * @param request - The request body. + * @returns The new deployment. + */ + public async redeploy( + request: RedeployAgentDeploymentRequest + ): Promise { + let param: string; + if ("deployment_id" in request) { + param = request.deployment_id; + } else { + param = request.deployment_number.toString(); + } + const resp = await this.client.request( + "POST", + `/api/agents/${request.agent_id}/deployments/${param}/redeploy` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/agents/deployments.server.ts b/packages/api/src/routes/agents/deployments.server.ts new file mode 100644 index 0000000..bcba8b9 --- /dev/null +++ b/packages/api/src/routes/agents/deployments.server.ts @@ -0,0 +1,293 @@ +import * as convert from "@blink.so/database/convert"; +import Querier from "@blink.so/database/querier"; +import type { AgentDeployment } from "@blink.so/database/schema"; +import { Hono } from "hono"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import { + withAgentPermission, + withAgentURLParam, + withAuth, + withPagination, +} from "../../middleware"; +import type { Bindings } from "../../server"; +import { + schemaCreateAgentDeploymentRequest, + type AgentDeploymentFile, + type AgentDeploymentTarget, + type AgentDeploymentUploadFile, + type ListAgentDeploymentsResponse, +} from "./deployments.client"; + +// /api/agents/:id/deployments +export default function mountDeployments( + app: Hono<{ + Bindings: Bindings; + }> +) { + // List deployments. + app.get( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + withPagination, + async (c) => { + const agent = c.get("agent"); + const db = await c.env.database(); + const deployments = await db.selectAgentDeploymentsByAgentID({ + agentID: agent.id, + page: c.get("page"), + per_page: c.get("per_page"), + }); + const listDeployments: ListAgentDeploymentsResponse = { + has_more: deployments.has_more, + items: deployments.items.map(convert.agentDeployment), + }; + return c.json(listDeployments); + } + ); + + // Create a deployment. + app.post( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + validator("json", (data) => { + return schemaCreateAgentDeploymentRequest.parse(data); + }), + async (c) => { + const agent = c.get("agent"); + const req = c.req.valid("json"); + + const deployment = await createAgentDeployment({ + req: c.req.raw, + bindings: c.env, + sourceFiles: req.source_files, + outputFiles: req.output_files, + entrypoint: req.entrypoint, + agentID: agent.id, + userID: c.get("user_id"), + organizationID: agent.organization_id, + target: req.target, + userMessage: req.message, + }); + return c.json(convert.agentDeployment(deployment)); + } + ); + + // Get a deployment. + app.get( + "/:deployment_id", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + async (c) => { + const agent = c.get("agent"); + const deploymentID = c.req.param("deployment_id"); + + let deployment: (AgentDeployment & { target: string }) | null = null; + const db = await c.env.database(); + if (deploymentID.match(/^\d+$/)) { + deployment = await db.selectAgentDeploymentByNumber( + agent.id, + parseInt(deploymentID) + ); + } else { + deployment = await db.selectAgentDeploymentByID(deploymentID); + } + if (!deployment) { + throw new HTTPException(404, { + message: "Deployment not found", + }); + } + if (deployment.agent_id !== agent.id) { + throw new HTTPException(404, { + message: "Deployment not found", + }); + } + return c.json(convert.agentDeployment(deployment)); + } + ); + + // Re-deploy an existing deployment. + app.post( + "/:deployment_id/redeploy", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + async (c) => { + const agent = c.get("agent"); + const deploymentID = c.req.param("deployment_id"); + const db = await c.env.database(); + + let existingDeployment: (AgentDeployment & { target: string }) | null = + null; + if (deploymentID.match(/^\d+$/)) { + existingDeployment = await db.selectAgentDeploymentByNumber( + agent.id, + parseInt(deploymentID) + ); + } else { + existingDeployment = await db.selectAgentDeploymentByID(deploymentID); + } + if (!existingDeployment) { + throw new HTTPException(404, { + message: "Deployment not found", + }); + } + if (existingDeployment.agent_id !== agent.id) { + throw new HTTPException(404, { + message: "Deployment not found", + }); + } + + const deployment = await createAgentDeployment({ + req: c.req.raw, + bindings: c.env, + db, + sourceFiles: existingDeployment.source_files ?? undefined, + outputFiles: existingDeployment.output_files ?? undefined, + entrypoint: existingDeployment.entrypoint, + agentID: agent.id, + userID: c.get("user_id"), + organizationID: agent.organization_id, + target: existingDeployment.target as AgentDeploymentTarget, + userMessage: existingDeployment.user_message ?? undefined, + }); + return c.json(convert.agentDeployment(deployment)); + } + ); +} + +export const createAgentDeployment = async ({ + req, + db, + bindings, + sourceFiles, + outputFiles, + entrypoint, + agentID, + userID, + organizationID, + target, + userMessage, +}: { + req: Request; + bindings: Bindings; + db?: Querier; + sourceFiles?: AgentDeploymentUploadFile[]; + outputFiles?: AgentDeploymentUploadFile[]; + entrypoint?: string; + agentID: string; + userID: string; + organizationID: string; + target: AgentDeploymentTarget; + userMessage?: string; +}) => { + if (!db) { + db = await bindings.database(); + } + + // Check that files are provided. + if (outputFiles?.length === 0 && sourceFiles?.length === 0) { + throw new HTTPException(400, { + message: "No output files or source files provided", + }); + } + + // If there are output files, ensure the entrypoint is in the output files. + if (outputFiles?.length && entrypoint) { + if (!outputFiles.find((file) => file.path === entrypoint)) { + throw new HTTPException(400, { + message: + "Entrypoint not found in output files. You must specify entrypoint to build your agent.", + }); + } + } + + // If there are *only* source files, we'll need to queue a build. + // In that case, we need to make sure the entrypoint is in the source files. + // + // TODO: This can be inferred as part of our build, so entrypoint should + // probably be optional. + if (sourceFiles?.length && !outputFiles?.length && entrypoint) { + if (!sourceFiles.find((file) => file.path === entrypoint)) { + throw new HTTPException(400, { + message: + "Entrypoint not found in source files. You must specify entrypoint to build your agent.", + }); + } + } + + const uploadFiles = async (files: AgentDeploymentUploadFile[]) => { + const uploadedFiles: AgentDeploymentFile[] = []; + for (const file of files) { + if ("data" in file) { + const { id } = await bindings.files.upload({ + file: new File([file.data], file.path), + user_id: userID, + organization_id: organizationID, + }); + uploadedFiles.push({ + path: file.path, + id, + }); + } else { + uploadedFiles.push(file); + } + } + return uploadedFiles; + }; + + const uploadedSourceFiles = await uploadFiles(sourceFiles ?? []); + const uploadedOutputFiles = await uploadFiles(outputFiles ?? []); + + // Validate total size of output files does not exceed 25MB. + if (uploadedOutputFiles.length > 0) { + let totalSize = 0; + for (const file of uploadedOutputFiles) { + const fileData = await bindings.files.download(file.id); + totalSize += fileData.size; + // Cancel the stream to avoid memory leaks. + await fileData.stream.cancel(); + } + const maxSize = 25 * 1024 * 1024; // 25MB + if (totalSize > maxSize) { + throw new HTTPException(400, { + message: `Total size of output files (${(totalSize / 1024 / 1024).toFixed(2)}MB) exceeds the maximum allowed size of 25MB`, + }); + } + } + + const deploymentTarget = await db.selectAgentDeploymentTargetByName( + agentID, + target + ); + if (!deploymentTarget) { + throw new HTTPException(400, { + message: "Target not found", + }); + } + + const deployment = await db.insertAgentDeployment({ + agent_id: agentID, + source_files: uploadedSourceFiles, + output_files: uploadedOutputFiles, + status: "pending", + target_id: deploymentTarget.id, + compatibility_version: "3", + entrypoint: entrypoint ?? "", + created_by: userID, + created_from: "cli", + user_message: userMessage, + platform: "lambda", + platform_memory_mb: 1024, + }); + await bindings.deployAgent(deployment); + return { + ...deployment, + target: deploymentTarget.target, + }; +}; diff --git a/packages/api/src/routes/agents/deployments.test.ts b/packages/api/src/routes/agents/deployments.test.ts new file mode 100644 index 0000000..e083fab --- /dev/null +++ b/packages/api/src/routes/agents/deployments.test.ts @@ -0,0 +1,268 @@ +import { expect, test } from "bun:test"; +import Client from "../../client.node"; +import { serve } from "../../test"; + +test("CRUD /api/agents/:agent_id/deployments", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + }); + + const file = await client.files.upload( + new File(["console.log('Hello, world!');"], "test.js") + ); + + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "test.js", + id: file.id, + }, + ], + }); + expect(deployment.number).toBe(1); + expect(deployment.status).toBe("pending"); + + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + expect(deployments.items[0]).toEqual(deployment); +}); + +test("Backwards compatibility: /api/agents/:agent_id/deployments with legacy 'files' field", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + }); + + const file = await client.files.upload( + new File(["console.log('Hello, world!');"], "test.js") + ); + + // Use legacy 'files' field instead of 'output_files' + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + files: [ + { + path: "test.js", + id: file.id, + }, + ], + } as any); // Cast to any to bypass TypeScript check for legacy field + + expect(deployment.number).toBe(1); + expect(deployment.status).toBe("pending"); + // Verify the files were properly mapped to output_files + expect(deployment.output_files.length).toBe(1); + expect(deployment.output_files[0].path).toBe("test.js"); +}); + +test("Reject deployment when output files exceed 25MB", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + }); + + // Create a file that's 20MB + const largeContent = new Uint8Array(20 * 1024 * 1024); + const file1 = await client.files.upload( + new File([largeContent], "large1.bin") + ); + + // Create another file that's 10MB (total 30MB) + const mediumContent = new Uint8Array(10 * 1024 * 1024); + const file2 = await client.files.upload( + new File([mediumContent], "large2.bin") + ); + + // Should throw error because total size exceeds 25MB + await expect( + client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "large1.bin", + id: file1.id, + }, + { + path: "large2.bin", + id: file2.id, + }, + ], + }) + ).rejects.toThrow(); +}); + +test("Accept deployment when output files are under 25MB", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + }); + + // Create two files that together are under 25MB + const content1 = new Uint8Array(10 * 1024 * 1024); // 10MB + const file1 = await client.files.upload(new File([content1], "medium1.bin")); + + const content2 = new Uint8Array(14 * 1024 * 1024); // 14MB (total 24MB) + const file2 = await client.files.upload(new File([content2], "medium2.bin")); + + // Should succeed because total is under 25MB + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "medium1.bin", + id: file1.id, + }, + { + path: "medium2.bin", + id: file2.id, + }, + ], + }); + + expect(deployment.number).toBe(1); + expect(deployment.status).toBe("pending"); + expect(deployment.output_files.length).toBe(2); +}); + +test("deployments permissions - read user can view deployments", async () => { + const { helpers, bindings } = await serve(); + const { user: readUser, client: readClient } = await helpers.createUser(); + const { client: ownerClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ name: "test-org" }); + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "private", + output_files: [{ path: "test.js", data: "console.log('test');" }], + }); + + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + + // Read user can list deployments + const deployments = await readClient.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + + // Read user can get deployment details + const deployment = await readClient.agents.deployments.get({ + agent_id: agent.id, + deployment_id: deployments.items[0]!.id, + }); + expect(deployment.id).toBe(deployments.items[0]!.id); + + // Read user cannot create deployments + await expect( + readClient.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [{ path: "new.js", data: "console.log('new');" }], + }) + ).rejects.toThrow("write permission"); +}); + +test("API key authentication - create deployment", async () => { + const { helpers, bindings, url } = await serve(); + const { client, user: owner } = await helpers.createUser(); + const db = await bindings.database(); + + const org = await client.organizations.create({ + name: "test-org-api-key", + }); + const apiKey = await client.users.createApiKey({ + name: "Test API Key", + }); + const apiKeyClient = new Client({ + baseURL: url.toString(), + authToken: apiKey.key, + }); + + const agent = await apiKeyClient.agents.create({ + organization_id: org.id, + name: "test-agent-api-key", + output_files: [ + { + path: "test.js", + data: "console.log('Hello from API key!');", + }, + ], + }); + + const deployment = await apiKeyClient.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "deploy.js", + data: "console.log('Deployment from API key');", + }, + ], + }); + + expect(deployment).toBeDefined(); + expect(deployment.number).toBe(2); + expect(deployment.status).toBe("pending"); + expect(deployment.output_files.length).toBe(1); + expect(deployment.output_files[0].path).toBe("deploy.js"); + + const deployments = await apiKeyClient.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(2); + expect(deployments.items.some((d) => d.id === deployment.id)).toBe(true); + + const fetchedDeployment = await apiKeyClient.agents.deployments.get({ + agent_id: agent.id, + deployment_id: deployment.id, + }); + expect(fetchedDeployment.id).toBe(deployment.id); + expect(fetchedDeployment.number).toBe(2); +}); diff --git a/packages/api/src/routes/agents/env.client.ts b/packages/api/src/routes/agents/env.client.ts new file mode 100644 index 0000000..3475d09 --- /dev/null +++ b/packages/api/src/routes/agents/env.client.ts @@ -0,0 +1,144 @@ +import { z } from "zod"; +import { assertResponseStatus } from "../../client-helper"; +import Client from "../../client.browser"; +import { schemaAgentDeploymentTarget } from "./deployments.client"; + +const schemaListAgentEnvRequest = z.object({ + agent_id: z.uuid(), + target: schemaAgentDeploymentTarget.array().optional(), +}); + +export type ListAgentEnvRequest = z.infer; + +const schemaAgentEnvironmentVariable = z.object({ + id: z.uuid(), + created_at: z.date(), + updated_at: z.date(), + created_by: z.uuid(), + updated_by: z.uuid(), + key: z.string(), + value: z.string().nullable(), + secret: z.boolean(), + target: schemaAgentDeploymentTarget.array(), +}); + +export type AgentEnvironmentVariable = z.infer< + typeof schemaAgentEnvironmentVariable +>; + +export const schemaCreateAgentEnv = z.object({ + key: z.string(), + value: z.string(), + secret: z.boolean(), + target: schemaAgentDeploymentTarget.array().optional(), + upsert: z.boolean().optional(), +}); + +export const schemaCreateAgentEnvRequest = schemaCreateAgentEnv.extend({ + agent_id: z.uuid(), +}); + +export type CreateAgentEnvRequest = z.infer; + +const schemaDeleteAgentEnvRequest = z.object({ + agent_id: z.uuid(), + id: z.uuid(), +}); + +export type DeleteAgentEnvRequest = z.infer; + +export const schemaUpdateAgentEnvRequest = z.object({ + agent_id: z.uuid(), + id: z.uuid(), + key: z.string().optional(), + value: z.string().optional(), + secret: z.boolean().optional(), + target: schemaAgentDeploymentTarget + .array() + .default(["preview", "production"]) + .optional(), +}); + +export type UpdateAgentEnvRequest = z.infer; + +export default class AgentEnv { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * List the environment variables for an agent. + * + * @param id - The id of the agent. + * @returns The environment variables. + * @returns + */ + public async list( + id: ListAgentEnvRequest + ): Promise { + const query = new URLSearchParams(); + if (id.target) { + for (const target of id.target) { + query.append("target", target); + } + } + const resp = await this.client.request( + "GET", + `/api/agents/${id.agent_id}/env?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Create an environment variable for an agent. + * + * @param request - The request body. + * @returns The environment variable. + */ + public async create( + request: CreateAgentEnvRequest + ): Promise { + const resp = await this.client.request( + "POST", + `/api/agents/${request.agent_id}/env`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete an environment variable for an agent. + * + * @param request - The request body. + * @returns The environment variable. + */ + public async delete(request: DeleteAgentEnvRequest): Promise { + const resp = await this.client.request( + "DELETE", + `/api/agents/${request.agent_id}/env/${request.id}` + ); + await assertResponseStatus(resp, 204); + } + + /** + * Update an environment variable for an agent. + * + * @param request - The request body. + * @returns The environment variable. + */ + public async update( + request: UpdateAgentEnvRequest + ): Promise { + const resp = await this.client.request( + "PUT", + `/api/agents/${request.agent_id}/env/${request.id}`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/agents/env.server.ts b/packages/api/src/routes/agents/env.server.ts new file mode 100644 index 0000000..cb8b514 --- /dev/null +++ b/packages/api/src/routes/agents/env.server.ts @@ -0,0 +1,206 @@ +import { + type Agent, + type AgentEnvironmentVariable as DBAgentEnvironmentVariable, +} from "@blink.so/database/schema"; +import { Hono, type MiddlewareHandler } from "hono"; +import { validator } from "hono/validator"; +import z from "zod"; +import { + withAgentPermission, + withAgentURLParam, + withAuth, +} from "../../middleware"; +import type { Bindings } from "../../server"; +import { isUniqueConstraintError } from "../../server-helper"; +import { + type AgentDeploymentTarget, + schemaAgentDeploymentTarget, +} from "./deployments.client"; +import { + type AgentEnvironmentVariable, + schemaCreateAgentEnvRequest, + schemaUpdateAgentEnvRequest, +} from "./env.client"; + +export default function mountEnv( + app: Hono<{ + Bindings: Bindings; + }> +) { + // List environment variables for an agent. + app.get( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + validator("query", (value) => { + let target: AgentDeploymentTarget[] | undefined; + if (value["target"]) { + if (!Array.isArray(value["target"])) { + target = [schemaAgentDeploymentTarget.parse(value["target"])]; + } else { + target = schemaAgentDeploymentTarget.array().parse(value["target"]); + } + } + return { target }; + }), + async (c) => { + const agent = c.get("agent"); + const db = await c.env.database(); + const env = await db.selectAgentEnvironmentVariablesByAgentID({ + agentID: agent.id, + target: c.req.valid("query").target, + }); + return c.json(env.map(convertAgentEnvironmentVariable)); + } + ); + + // Create an environment variable for an agent. + app.post( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + validator("json", (value) => { + return schemaCreateAgentEnvRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const req = c.req.valid("json"); + try { + const envVar = await db.insertAgentEnvironmentVariable({ + agent_id: c.get("agent").id, + key: req.key, + value: req.value, + secret: req.secret, + target: req.target, + created_by: c.get("user_id"), + updated_by: c.get("user_id"), + }); + return c.json(convertAgentEnvironmentVariable(envVar)); + } catch (err) { + if (isUniqueConstraintError(err)) { + // TODO: We shouldn't be doing this. It's a race condition. + // Kyle: I didn't feel like doing some crazy index upsert logic. + if (req.upsert) { + const envVar = await db.updateAgentEnvironmentVariableByKey( + c.get("agent").id, + req.key, + { + value: req.value, + secret: req.secret, + target: req.target, + updated_at: new Date(), + updated_by: c.get("user_id"), + } + ); + return c.json(convertAgentEnvironmentVariable(envVar)); + } + + return c.json( + { + message: `An environment variable with the key "${req.key}" already exists for your provided target(s)`, + }, + 400 + ); + } + throw err; + } + } + ); + + // Delete an environment variable for an agent. + app.delete( + "/:env_var_id", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + withEnvVar, + async (c) => { + const db = await c.env.database(); + await db.deleteAgentEnvironmentVariable(c.get("environmentVariable").id); + return c.body(null, 204); + } + ); + + // Update an environment variable for an agent. + app.put( + "/:env_var_id", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + withEnvVar, + validator("json", (value) => { + return schemaUpdateAgentEnvRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const envVar = c.get("environmentVariable"); + const req = c.req.valid("json"); + try { + const updated = await db.updateAgentEnvironmentVariable(envVar.id, { + key: req.key, + value: req.value, + secret: req.secret, + target: req.target, + updated_at: new Date(), + updated_by: c.get("user_id"), + }); + return c.json(convertAgentEnvironmentVariable(updated)); + } catch (err) { + if (isUniqueConstraintError(err)) { + return c.json( + { + message: `An environment variable with the key "${req.key}" already exists for your provided target(s)`, + }, + 400 + ); + } + throw err; + } + } + ); +} + +const withEnvVar: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + agent: Agent; + environmentVariable: DBAgentEnvironmentVariable; + }; +}> = async (c, next) => { + const id = c.req.param("env_var_id"); + if (!id) { + return c.json({ message: "Environment variable ID is required" }, 400); + } + const parsed = await z.uuid().safeParseAsync(id); + if (!parsed.success) { + return c.json({ message: "Invalid environment variable ID" }, 400); + } + const db = await c.env.database(); + const envVar = await db.selectAgentEnvironmentVariableByID(id); + if (!envVar) { + return c.json({ message: "Environment variable not found" }, 404); + } + if (envVar.agent_id !== c.get("agent").id) { + return c.json({ message: "Unauthorized" }, 401); + } + c.set("environmentVariable", envVar); + await next(); +}; + +const convertAgentEnvironmentVariable = ( + env: DBAgentEnvironmentVariable +): AgentEnvironmentVariable => { + return { + id: env.id, + created_at: env.created_at, + updated_at: env.updated_at, + created_by: env.created_by, + updated_by: env.updated_by, + key: env.key, + value: env.secret ? null : env.value, + secret: env.secret, + target: env.target as AgentDeploymentTarget[], + }; +}; diff --git a/packages/api/src/routes/agents/env.test.ts b/packages/api/src/routes/agents/env.test.ts new file mode 100644 index 0000000..f10cddf --- /dev/null +++ b/packages/api/src/routes/agents/env.test.ts @@ -0,0 +1,94 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("CRUD /api/agents/:id/env", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + visibility: "public", + organization_id: org.id, + + env: [ + { + key: "TEST_ENV", + value: "test", + secret: false, + }, + ], + }); + + let vars = await client.agents.env.list({ + agent_id: agent.id, + }); + expect(vars.length).toBe(1); + let envVar = vars[0]!; + expect(envVar.key).toBe("TEST_ENV"); + expect(envVar.value).toBe("test"); + expect(envVar.secret).toBe(false); + // By default, it's for all environments. + expect(envVar.target).toEqual(["preview", "production"]); + + // Update the environment variable to remove it from preview. + const updated = await client.agents.env.update({ + agent_id: agent.id, + id: envVar.id, + value: "another", + target: ["preview", "production"], + }); + expect(updated.value).toBe("another"); + expect(updated.target).toEqual(["preview", "production"]); + + // Try creating a new environment variable with the same key. By default, it's for all environments. + await expect( + client.agents.env.create({ + agent_id: agent.id, + key: "TEST_ENV", + value: "something", + secret: false, + target: ["production"], + }) + ).rejects.toThrow("already exists for your provided target(s)"); + + vars = await client.agents.env.list({ + agent_id: agent.id, + }); + expect(vars.length).toBe(1); + envVar = vars[0]!; + + await client.agents.env.delete({ + agent_id: agent.id, + id: envVar.id, + }); + + vars = await client.agents.env.list({ + agent_id: agent.id, + }); + expect(vars.length).toBe(0); + + // Ensure upserting works. + let upserted = await client.agents.env.create({ + agent_id: agent.id, + key: "TEST_ENV", + value: "something", + secret: false, + target: ["production"], + upsert: true, + }); + expect(upserted.value).toBe("something"); + expect(upserted.target).toEqual(["production"]); + + upserted = await client.agents.env.create({ + agent_id: agent.id, + key: "TEST_ENV", + value: "new-value", + secret: false, + target: ["production"], + upsert: true, + }); + expect(upserted.value).toBe("new-value"); +}); diff --git a/packages/api/src/routes/agents/logs.client.ts b/packages/api/src/routes/agents/logs.client.ts new file mode 100644 index 0000000..60f9044 --- /dev/null +++ b/packages/api/src/routes/agents/logs.client.ts @@ -0,0 +1,72 @@ +import z from "zod"; +import { assertResponseStatus } from "../../client-helper"; +import Client from "../../client.browser"; +import { FieldFilterGroupSchema } from "../agents/traces.client"; + +export const schemaGetAgentLogsRequest = z.object({ + start_time: z.iso.datetime().pipe(z.coerce.date()), + end_time: z.iso.datetime().pipe(z.coerce.date()), + // Simple filter - supports wildcard matching with * + message_pattern: z.string().optional(), + // Advanced filters - same as traces filtering + filters: z + .string() + .transform((val) => JSON.parse(val)) + .pipe(FieldFilterGroupSchema) + .optional(), + limit: z + .string() + // the limits are dictated by the AWS API + // https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html#API_StartQuery_RequestSyntax + .pipe(z.coerce.number().min(1).max(10_000)) + .optional(), +}); + +export type GetAgentLogsRequest = z.infer; + +const schemaAgentLog = z.object({ + timestamp: z.iso.datetime().pipe(z.coerce.date()), + message: z.string(), + level: z.enum(["info", "error", "warn"]), +}); + +export type AgentLog = z.infer; + +const schemaGetAgentLogsResponse = z.object({ + logs: z.array(schemaAgentLog), +}); + +export type GetAgentLogsResponse = z.infer; + +export default class AgentLogs { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public async logs( + request: GetAgentLogsRequest & { agent_id: string } + ): Promise { + const query = new URLSearchParams(); + query.set("start_time", request.start_time.toISOString()); + query.set("end_time", request.end_time.toISOString()); + if (request.limit) { + query.set("limit", request.limit.toString()); + } + if (request.message_pattern) { + query.set("message_pattern", request.message_pattern); + } + if (request.filters) { + query.set("filters", JSON.stringify(request.filters)); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/logs?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + const data = await resp.json(); + // this converts timestamp strings to Dates + return schemaGetAgentLogsResponse.parse(data); + } +} diff --git a/packages/api/src/routes/agents/logs.server.ts b/packages/api/src/routes/agents/logs.server.ts new file mode 100644 index 0000000..cf8b8bc --- /dev/null +++ b/packages/api/src/routes/agents/logs.server.ts @@ -0,0 +1,36 @@ +import { validator } from "hono/validator"; +import { + withAgentPermission, + withAgentURLParam, + withAuth, +} from "../../middleware"; +import type { APIServer } from "../../server"; +import { schemaGetAgentLogsRequest } from "./logs.client"; + +// /api/agents/:id/logs +export default function mountAgentLogs(app: APIServer) { + app.get( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + validator("query", (data) => { + return schemaGetAgentLogsRequest.parse(data); + }), + async (c) => { + const reqData = c.req.valid("query"); + const agent = c.get("agent"); + + const logs = await c.env.logs.get({ + agent_id: agent.id, + start_time: reqData.start_time, + end_time: reqData.end_time, + limit: reqData.limit ?? 200, + message_pattern: reqData.message_pattern, + filters: reqData.filters, + }); + + return c.json({ logs }); + } + ); +} diff --git a/packages/api/src/routes/agents/logs.test.ts b/packages/api/src/routes/agents/logs.test.ts new file mode 100644 index 0000000..e423fb9 --- /dev/null +++ b/packages/api/src/routes/agents/logs.test.ts @@ -0,0 +1,342 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; +import type { AgentLog } from "./logs.client"; + +test("get agent logs successfully", async () => { + const mockLogs: AgentLog[] = [ + { + timestamp: new Date("2024-01-01T10:00:00Z"), + message: "Agent started", + level: "info", + }, + { + timestamp: new Date("2024-01-01T10:05:00Z"), + message: "Processing request", + level: "info", + }, + ]; + + const { helpers } = await serve({ + bindings: { + logs: { + get: async (opts) => { + expect(typeof opts.agent_id).toBe("string"); + expect(opts.start_time).toBeInstanceOf(Date); + expect(opts.end_time).toBeInstanceOf(Date); + expect(opts.limit).toBe(100); + expect(opts.message_pattern).toBe("*info*"); + return mockLogs; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const startTime = new Date("2024-01-01T09:00:00Z"); + const endTime = new Date("2024-01-01T11:00:00Z"); + + const response = await client.agents.logs.logs({ + agent_id: agent.id, + start_time: startTime, + end_time: endTime, + limit: 100, + message_pattern: "*info*", + }); + + expect(response.logs).toHaveLength(2); + expect(response.logs[0].message).toBe("Agent started"); + expect(response.logs[0].level).toBe("info"); + expect(response.logs[1].message).toBe("Processing request"); + expect(response.logs[1].level).toBe("info"); +}); + +test("get agent logs without message pattern", async () => { + const mockLogs: AgentLog[] = [ + { + timestamp: new Date("2024-01-01T10:00:00Z"), + message: "All logs", + level: "info", + }, + ]; + + const { helpers } = await serve({ + bindings: { + logs: { + get: async (opts) => { + expect(opts.message_pattern).toBeUndefined(); + return mockLogs; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 200, + }); + + expect(response.logs).toHaveLength(1); + expect(response.logs[0].message).toBe("All logs"); + expect(response.logs[0].level).toBe("info"); +}); + +test("agent logs authorization failure", async () => { + const { helpers } = await serve({ + bindings: { + logs: { + get: async () => { + throw new Error("Should not reach logs service"); + }, + }, + }, + }); + + const { client: ownerClient } = await helpers.createUser(); + const { client: otherClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "private-org", + }); + const agent = await ownerClient.agents.create({ + name: "private-agent", + organization_id: org.id, + }); + + await expect( + otherClient.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 100, + }) + ).rejects.toThrow("Organization not found"); +}); + +test("agent logs with empty result", async () => { + const { helpers } = await serve({ + bindings: { + logs: { + get: async () => [], + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 100, + }); + + expect(response.logs).toEqual([]); +}); + +test("agent logs with invalid agent id", async () => { + const { helpers } = await serve({ + bindings: { + logs: { + get: async () => { + throw new Error("Should not reach logs service"); + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + + await expect( + client.agents.logs.logs({ + agent_id: "invalid-agent-id", + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 100, + }) + ).rejects.toThrow("Invalid agent ID"); +}); + +test("agent logs parameter validation", async () => { + const { helpers } = await serve({ + bindings: { + logs: { + get: async () => { + throw new Error("Should not reach logs service"); + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + // Test limit out of range - too high + await expect( + client.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 20000, // Above AWS limit of 10,000 + }) + ).rejects.toThrow(); + + // Test limit out of range - too low + await expect( + client.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 0, // Below minimum of 1 + }) + ).rejects.toThrow(); +}); + +test("get agent logs without limit parameter (optional)", async () => { + const mockLogs: AgentLog[] = [ + { + timestamp: new Date("2024-01-01T10:00:00Z"), + message: "Agent started", + level: "info", + }, + { + timestamp: new Date("2024-01-01T10:05:00Z"), + message: "Processing request", + level: "info", + }, + ]; + + const { helpers } = await serve({ + bindings: { + logs: { + get: async (opts) => { + expect(typeof opts.agent_id).toBe("string"); + expect(opts.start_time).toBeInstanceOf(Date); + expect(opts.end_time).toBeInstanceOf(Date); + // Verify that limit is either undefined or has a default value + expect( + opts.limit === undefined || typeof opts.limit === "number" + ).toBe(true); + return mockLogs; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const startTime = new Date("2024-01-01T09:00:00Z"); + const endTime = new Date("2024-01-01T11:00:00Z"); + + // Call API without limit parameter to test it's optional + const response = await client.agents.logs.logs({ + agent_id: agent.id, + start_time: startTime, + end_time: endTime, + }); + + expect(response.logs).toHaveLength(2); + expect(response.logs[0].message).toBe("Agent started"); + expect(response.logs[0].level).toBe("info"); + expect(response.logs[1].message).toBe("Processing request"); + expect(response.logs[1].level).toBe("info"); +}); + +test("logs permissions - requires write permission", async () => { + const { helpers, bindings } = await serve({ + bindings: { + logs: { + get: async () => [], + }, + }, + }); + const { user: readUser, client: readClient } = await helpers.createUser(); + const { user: writeUser, client: writeClient } = await helpers.createUser(); + const { client: ownerClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ name: "test-org" }); + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: writeUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "private", + }); + + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "write", + }); + + // Read user cannot access logs + await expect( + readClient.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2025-01-01"), + end_time: new Date("2025-01-02"), + }) + ).rejects.toThrow("requires write permission"); + + // Write user can access logs + const result = await writeClient.agents.logs.logs({ + agent_id: agent.id, + start_time: new Date("2025-01-01"), + end_time: new Date("2025-01-02"), + }); + expect(result).toBeDefined(); + expect(result.logs).toBeDefined(); +}); diff --git a/packages/api/src/routes/agents/me/me.client.ts b/packages/api/src/routes/agents/me/me.client.ts new file mode 100644 index 0000000..87620c7 --- /dev/null +++ b/packages/api/src/routes/agents/me/me.client.ts @@ -0,0 +1,281 @@ +// This is just a client for the agent invocation API. +// It's here so it could be reused, but also because it's +// much easier to test. + +import type { + CreateChatMessage, + SendMessagesBehavior, +} from "../../messages.client"; + +export interface AgentInvocationClientOptions { + baseURL?: string; + authToken?: string; +} + +// No Zod here so the wrapper client has no dependencies. +// Faster startup time! +export interface SendMessagesRequest { + messages: Array; + behavior: SendMessagesBehavior; +} + +export default class AgentInvocationClient { + private readonly baseURL: string; + private readonly authToken?: string; + + public constructor(options?: AgentInvocationClientOptions) { + this.baseURL = options?.baseURL ?? "https://blink.so"; + this.authToken = options?.authToken; + } + + public async deleteStorage(key: string): Promise { + const resp = await this.request( + "DELETE", + `/api/agents/me/storage/${encodeURIComponent(key)}` + ); + await this.assertResponseStatus(resp, 204); + } + + public async setStorage( + key: string, + value: string, + options?: { ttl?: number } + ): Promise { + const searchParams = new URLSearchParams(); + if (options?.ttl) { + searchParams.set("ttl", options.ttl.toString()); + } + const resp = await this.request( + "PUT", + `/api/agents/me/storage/${encodeURIComponent(key)}?${searchParams.toString()}`, + value + ); + await this.assertResponseStatus(resp, 204); + } + + public async getStorage(key: string): Promise { + const resp = await this.request( + "GET", + `/api/agents/me/storage/${encodeURIComponent(key)}` + ); + if (resp.status === 404) { + return undefined; + } + await this.assertResponseStatus(resp, 200); + return await resp.text(); + } + + public async listStorage( + prefix?: string, + options?: { limit?: number; cursor?: string } + ): Promise<{ + entries: Array<{ + key: string; + value: string; + }>; + cursor?: string; + }> { + const resp = await this.request( + "GET", + `/api/agents/me/storage`, + JSON.stringify({ prefix, limit: options?.limit, cursor: options?.cursor }) + ); + await this.assertResponseStatus(resp, 200); + return await resp.json(); + } + + public async upsertChat(key: string): Promise<{ + id: string; + created: boolean; + created_at: string; + }> { + const resp = await this.request( + "PUT", + `/api/agents/me/chats/${encodeURIComponent(key)}` + ); + // We can remove this once we move off all v2 deployments. + if (resp.status !== 200 && resp.status !== 204) { + await this.assertResponseStatus(resp, 200); + } + return await resp.json(); + } + + public async sendMessages( + key: string, + request: SendMessagesRequest + ): Promise { + const resp = await this.request( + "POST", + `/api/agents/me/chats/${encodeURIComponent(key)}/messages`, + JSON.stringify(request) + ); + await this.assertResponseStatus(resp, 204); + } + + public async getChat(id: string): Promise< + | { + id: string; + createdAt: string; + } + | undefined + > { + const resp = await this.request( + "GET", + `/api/agents/me/chats/${encodeURIComponent(id)}` + ); + if (resp.status === 404) { + return undefined; + } + await this.assertResponseStatus(resp, 200); + return await resp.json(); + } + + public async deleteChat(id: string): Promise { + const resp = await this.request( + "DELETE", + `/api/agents/me/chats/${encodeURIComponent(id)}` + ); + await this.assertResponseStatus(resp, 204); + } + + public async startChat(id: string): Promise { + const resp = await this.request( + "POST", + `/api/agents/me/chats/${encodeURIComponent(id)}/start` + ); + await this.assertResponseStatus(resp, 204); + } + + public async stopChat(id: string): Promise { + const resp = await this.request( + "POST", + `/api/agents/me/chats/${encodeURIComponent(id)}/stop` + ); + await this.assertResponseStatus(resp, 204); + } + + public async getMessages(id: string): Promise> { + const resp = await this.request( + "GET", + `/api/agents/me/chats/${encodeURIComponent(id)}/messages` + ); + await this.assertResponseStatus(resp, 200); + return await resp.json(); + } + + public async deleteMessages(id: string, messageIds: string[]): Promise { + const resp = await this.request( + "POST", + `/api/agents/me/chats/${encodeURIComponent(id)}/messages/delete`, + JSON.stringify({ message_ids: messageIds }) + ); + await this.assertResponseStatus(resp, 204); + } + + public async proxyOtlpTraces(request: Request): Promise { + if (!this.authToken) { + // There are valid situations where the agent may send traces but an invocation + // token is not available. For example, when the blink platform + // queries `/_agent/health` and the agent sends an associated trace. + // In these situations, we silently drop the traces and tell the agent + // that they were all processed successfully. The response format is based on the OTEL spec: + // https://opentelemetry.io/docs/specs/otlp/#full-success + const contentType = + request.headers.get("content-type")?.toLowerCase() || ""; + if (contentType.includes("application/x-protobuf")) { + return new Response(new Uint8Array(0), { + status: 200, + headers: { "Content-Type": "application/x-protobuf" }, + }); + } + return new Response(JSON.stringify({}), { + status: 200, + headers: { "Content-Type": "application/json" }, + }); + } + + // Headers that should not be forwarded when proxying + const hopByHopHeaders = new Set([ + "transfer-encoding", + "content-length", + "host", + "connection", + "keep-alive", + "proxy-authenticate", + "proxy-authorization", + "te", + "trailer", + "upgrade", + ]); + + const headers: Record = {}; + request.headers.forEach((value, key) => { + if (hopByHopHeaders.has(key.toLowerCase())) { + return; + } + headers[key] = value; + }); + + return this.request( + request.method as "GET" | "POST" | "PUT" | "DELETE" | "PATCH", + `/api/otlp/v1/traces`, + request.body ?? undefined, + { headers } + ); + } + + private async assertResponseStatus( + resp: Response, + status: number + ): Promise { + if (resp.status === status) { + return; + } + const body = await resp.text(); + try { + const parsed = JSON.parse(body); + if (parsed.error) { + throw new Error(parsed.error); + } + throw new Error(body); + } catch (err) { + throw new Error(`Expected status ${status}, got ${resp.status}: ${body}`); + } + } + + private request( + method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", + path: string, + body?: BodyInit, + options?: { + headers?: Record; + timeout?: number; + } + ) { + const url = new URL(path, this.baseURL); + const headers = new Headers(); + if (this.authToken) { + headers.set("Authorization", `Bearer ${this.authToken}`); + } + if (typeof body === "string") { + // Assume JSON. The user can always override this below. + headers.set("Content-Type", "application/json"); + } + if (options?.headers) { + for (const [key, value] of Object.entries(options.headers)) { + headers.set(key, value); + } + } + let signal: AbortSignal | undefined; + if (options?.timeout) { + signal = AbortSignal.timeout(options.timeout); + } + return fetch(url.toString(), { + method, + headers, + body, + signal, + duplex: body ? "half" : undefined, + } as RequestInit); + } +} diff --git a/packages/api/src/routes/agents/me/me.server.ts b/packages/api/src/routes/agents/me/me.server.ts new file mode 100644 index 0000000..e4e83bb --- /dev/null +++ b/packages/api/src/routes/agents/me/me.server.ts @@ -0,0 +1,370 @@ +import type { Chat } from "@blink.so/database/schema"; +import { Hono, type MiddlewareHandler } from "hono"; +import { bodyLimit } from "hono/body-limit"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import { decode, encode } from "next-auth/jwt"; +import { validate } from "uuid"; +import type { Bindings } from "../../../server"; +import { handleInsertMessages, validateMessages } from "../../messages.server"; +import type { SendMessagesRequest } from "./me.client"; + +// Mount the /api/agents/me routes. +// This is *only* available for agent invocations. +export default function mountAgentsMe(app: Hono<{ Bindings: Bindings }>) { + // Get the value of a key. + app.get("/storage/:key", withAgentInvocationAuth, async (c) => { + const target = c.get("agent_deployment_target_id"); + const value = await c.env.agentStore(target).get(c.req.param("key")); + if (!value) { + return c.body(null, 404); + } + return c.body(value, 200, { + "Content-Type": "application/octet-stream", + }); + }); + + // Set the value of a key. + app.put( + "/storage/:key", + withAgentInvocationAuth, + bodyLimit({ + maxSize: 20_000, + onError: (c) => { + return c.json({ error: "Request body too large" }, 413); + }, + }), + async (c) => { + const target = c.get("agent_deployment_target_id"); + const key = c.req.param("key"); + const value = await c.req.text(); + const { ttl } = c.req.query(); + await c.env.agentStore(target).set(key, value, { + ttl: ttl ? parseInt(ttl) : undefined, + }); + return c.body(null, 204); + } + ); + + // Delete a key. + app.delete("/storage/:key", withAgentInvocationAuth, async (c) => { + const target = c.get("agent_deployment_target_id"); + const key = c.req.param("key"); + await c.env.agentStore(target).delete(key); + return c.body(null, 204); + }); + + // List values. + app.get("/storage", withAgentInvocationAuth, async (c) => { + const target = c.get("agent_deployment_target_id"); + const { prefix, limit, cursor } = c.req.query(); + const values = await c.env.agentStore(target).list(prefix, { + limit: limit ? parseInt(limit) : 100, + cursor, + }); + return c.json(values, 200); + }); + + // Upsert a chat by key. + app.put( + "/chats/:key", + withAgentInvocationAuth, + validator("param", (value, c) => { + const key = value["key"]; + if (!key) { + return c.json({ error: "Invalid Key" }, 400); + } + if (key.length > 128) { + return c.json({ error: "Invalid Key" }, 400); + } + return key; + }), + async (c) => { + const key = c.req.valid("param"); + const db = await c.env.database(); + const agent = await db.selectAgentByID(c.get("agent_id")); + if (!agent) { + return c.json({ error: "Agent not found" }, 404); + } + const deployment = await db.selectAgentDeploymentByIDOrActive({ + agentID: agent.id, + id: c.get("agent_deployment_id"), + }); + if (!deployment) { + return c.json({ error: "Deployment not found" }, 404); + } + const { id, created_at, created } = + await db.upsertChatForAgentDeploymentTarget({ + created_at: new Date(), + organization_id: agent.organization_id, + visibility: "private", + agent_deployment_id: c.get("agent_deployment_id"), + agent_deployment_target_id: c.get("agent_deployment_target_id"), + agent_id: c.get("agent_id"), + agent_key: key, + title: null, + }); + if (deployment.compatibility_version !== "3") { + return c.body(null, 204); + } + return c.json( + { + id, + created_at: created_at.toISOString(), + created, + }, + 200 + ); + } + ); + + // Insert chat messages by ID. + app.post( + "/chats/:id/messages", + withAgentInvocationAuth, + validator("json", (value, c) => { + if (!value["messages"]) { + return c.json({ error: "Invalid messages" }, 400); + } + if (!value["behavior"]) { + return c.json({ error: "Invalid behavior" }, 400); + } + return value as SendMessagesRequest; + }), + async (c) => { + const req = c.req.valid("json"); + const id = c.req.param("id"); + + await validateMessages(req.messages); + + const db = await c.env.database(); + + let chat: Chat | undefined; + if (validate(id)) { + chat = await db.selectChatByID({ id }); + } else { + chat = await db.selectChatByAgentKey({ + agentID: c.get("agent_id"), + key: id, + }); + } + if (!chat) { + return c.json({ error: "Chat not found" }, 404); + } + // Verify the chat belongs to this agent + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + + await handleInsertMessages(c, { + chat, + messages: req.messages, + behavior: req.behavior, + agent_id: c.get("agent_id"), + // Deployments that start chats should use their own + // agent deployment so that the behavior is consistent + // with the deployed version on start. + agent_deployment_id: c.get("agent_deployment_id"), + }); + + return c.body(null, 204); + } + ); + + // Get a chat by ID. + app.get("/chats/:id", withAgentInvocationAuth, async (c) => { + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: c.req.param("id") }); + if (!chat) { + return c.body(null, 404); + } + // Verify the chat belongs to this agent. + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + return c.json( + { + id: chat.id, + createdAt: chat.created_at.toISOString(), + }, + 200 + ); + }); + + // Delete a chat by ID. + app.delete("/chats/:id", withAgentInvocationAuth, async (c) => { + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: c.req.param("id") }); + if (!chat) { + return c.body(null, 404); + } + // Verify the chat belongs to this agent. + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + await db.deleteChatByID(chat.id); + return c.body(null, 204); + }); + + // Start a chat by ID. + app.post("/chats/:id/start", withAgentInvocationAuth, async (c) => { + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: c.req.param("id") }); + if (!chat) { + return c.json({ error: "Chat not found" }, 404); + } + // Verify the chat belongs to this agent. + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + await c.env.chat.handleStart({ + id: chat.id, + interrupt: false, + }); + return c.body(null, 204); + }); + + // Stop a chat by ID. + app.post("/chats/:id/stop", withAgentInvocationAuth, async (c) => { + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: c.req.param("id") }); + if (!chat) { + return c.json({ error: "Chat not found" }, 404); + } + // Verify the chat belongs to this agent. + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + await c.env.chat.handleStop(chat.id); + return c.body(null, 204); + }); + + // Get messages from a chat by ID. + app.get("/chats/:id/messages", withAgentInvocationAuth, async (c) => { + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: c.req.param("id") }); + if (!chat) { + return c.json({ error: "Chat not found" }, 404); + } + // Verify the chat belongs to this agent. + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + const messages = await db.selectChatMessages({ + chatID: chat.id, + limit: 1000, + }); + return c.json( + messages.items.map((message) => ({ + id: message.id, + role: message.role, + parts: message.parts, + metadata: message.metadata, + })), + 200 + ); + }); + + // Delete messages from a chat by ID. + app.post( + "/chats/:id/messages/delete", + withAgentInvocationAuth, + validator("json", (value, c) => { + if (!value["message_ids"] || !Array.isArray(value["message_ids"])) { + return c.json({ error: "Invalid message_ids" }, 400); + } + return { message_ids: value["message_ids"] as string[] }; + }), + async (c) => { + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: c.req.param("id") }); + if (!chat) { + return c.json({ error: "Chat not found" }, 404); + } + // Verify the chat belongs to this agent. + if (chat.agent_id !== c.get("agent_id")) { + return c.json({ error: "Unauthorized" }, 403); + } + const req = c.req.valid("json"); + await db.deleteChatMessages(req.message_ids); + return c.body(null, 204); + } + ); +} + +export const withAgentInvocationAuth: MiddlewareHandler<{ + Bindings: Bindings; + Variables: AgentInvocationToken; +}> = async (c, next) => { + const authHeader = c.req.header("Authorization"); + if (!authHeader || !authHeader.startsWith("Bearer ")) { + throw new HTTPException(401, { message: "Unauthorized" }); + } + + const tokenValue = authHeader.substring(7); + let token; + try { + token = await decode({ + token: tokenValue, + secret: c.env.AUTH_SECRET, + salt: "agent-invocation", + }); + } catch { + throw new HTTPException(401, { message: "Unauthorized" }); + } + if (!token) { + throw new HTTPException(401, { message: "Unauthorized" }); + } + if ( + !token.agent_id || + !token.agent_deployment_id || + !token.agent_deployment_target_id + ) { + throw new HTTPException(401, { message: "Unauthorized" }); + } + c.set("agent_id", token.agent_id as string); + c.set("agent_deployment_id", token.agent_deployment_id as string); + c.set( + "agent_deployment_target_id", + token.agent_deployment_target_id as string + ); + if (token.run_id) { + c.set("run_id", token.run_id as string); + } + if (token.step_id) { + c.set("step_id", token.step_id as string); + } + if (token.chat_id) { + c.set("chat_id", token.chat_id as string); + } + await next(); +}; + +export interface AgentInvocationToken { + agent_id: string; + agent_deployment_id: string; + agent_deployment_target_id: string; + run_id?: string; + step_id?: string; + chat_id?: string; +} + +export const generateAgentInvocationToken = ( + authSecret: string, + params: AgentInvocationToken +) => { + return encode({ + salt: "agent-invocation", + secret: authSecret, + // These tokens only last for 5 minutes. + maxAge: 5 * 60, + token: { + agent_id: params.agent_id, + agent_deployment_id: params.agent_deployment_id, + agent_deployment_target_id: params.agent_deployment_target_id, + run_id: params.run_id, + step_id: params.step_id, + chat_id: params.chat_id, + }, + }); +}; diff --git a/packages/api/src/routes/agents/me/me.test.ts b/packages/api/src/routes/agents/me/me.test.ts new file mode 100644 index 0000000..bef1b05 --- /dev/null +++ b/packages/api/src/routes/agents/me/me.test.ts @@ -0,0 +1,229 @@ +import { describe, expect, test } from "bun:test"; +import { serve } from "../../../test"; +import AgentInvocationClient from "./me.client"; +import { generateAgentInvocationToken } from "./me.server"; + +describe("agent invocation api", async () => { + let handleStartID: string | undefined; + const { helpers, bindings, url } = await serve({ + bindings: { + chat: { + handleStart: async (opts) => { + handleStartID = opts.id; + }, + }, + }, + }); + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + organization_id: org.id, + }); + + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + + const target = await ( + await bindings.database() + ).selectAgentDeploymentTargetByName(agent.id, "production"); + if (!target) { + throw new Error("Target not found"); + } + const token = await generateAgentInvocationToken(bindings.AUTH_SECRET, { + agent_id: agent.id, + agent_deployment_id: deployment.id, + agent_deployment_target_id: target.id, + }); + + const agentClient = new AgentInvocationClient({ + baseURL: url.toString(), + authToken: token, + }); + + test("storage", async () => { + expect(await agentClient.getStorage("test")).toBeUndefined(); + + await agentClient.setStorage("test", "Hello, world!"); + + const resp = await agentClient.getStorage("test"); + expect(resp).toBe("Hello, world!"); + }); + + test("upsert chat", async () => { + // This should be idempotent. + await agentClient.upsertChat("bananas"); + await agentClient.upsertChat("bananas"); + await agentClient.upsertChat("bananas"); + await agentClient.upsertChat("bananas"); + await agentClient.upsertChat("bananas"); + + const chats = await client.chats.list({ + organization_id: org.id, + }); + expect(chats.items.length).toBe(1); + }); + + test("send messages", async () => { + const upserted = await agentClient.upsertChat("frogger"); + expect(handleStartID).toBeUndefined(); + await agentClient.sendMessages(upserted.id, { + behavior: "interrupt", + messages: [ + { + role: "user", + parts: [ + { + type: "text", + text: "Hello, world!", + }, + ], + }, + ], + }); + expect(handleStartID).toBeDefined(); + }); + + test("get chat", async () => { + const upserted = await agentClient.upsertChat("get-test"); + const retrieved = await agentClient.getChat(upserted.id); + expect(retrieved).toBeDefined(); + expect(retrieved?.id).toBe(upserted.id); + expect(retrieved?.createdAt).toBe(upserted.created_at); + + // Non-existent chat should return undefined + const nonExistent = await agentClient.getChat( + "00000000-0000-0000-0000-000000000000" + ); + expect(nonExistent).toBeUndefined(); + }); + + test("delete chat", async () => { + const upserted = await agentClient.upsertChat("delete-test"); + const retrieved = await agentClient.getChat(upserted.id); + expect(retrieved).toBeDefined(); + + await agentClient.deleteChat(upserted.id); + const afterDelete = await agentClient.getChat(upserted.id); + expect(afterDelete).toBeUndefined(); + }); + + test("start and stop chat", async () => { + handleStartID = undefined; + const upserted = await agentClient.upsertChat("start-stop-test"); + + // Start the chat + await agentClient.startChat(upserted.id); + expect(handleStartID!).toBe(upserted.id); + + // Stop is a no-op in tests but should not throw + await agentClient.stopChat(upserted.id); + }); + + test("get messages", async () => { + const upserted = await agentClient.upsertChat("get-messages-test"); + + // Initially empty + const emptyMessages = await agentClient.getMessages(upserted.id); + expect(emptyMessages.length).toBe(0); + + // Add messages + await agentClient.sendMessages(upserted.id, { + behavior: "append", + messages: [ + { + role: "user", + parts: [ + { + type: "text", + text: "Hello!", + }, + ], + }, + { + role: "assistant", + parts: [ + { + type: "text", + text: "Hi there!", + }, + ], + }, + ], + }); + + // Verify messages were added + const messages = await agentClient.getMessages(upserted.id); + expect(messages.length).toBe(2); + + // Find the user and assistant messages (order may vary) + const userMessage = messages.find((m) => m.role === "user"); + const assistantMessage = messages.find((m) => m.role === "assistant"); + + expect(userMessage).toBeDefined(); + expect(userMessage!.parts[0]).toEqual({ + type: "text", + text: "Hello!", + }); + expect(assistantMessage).toBeDefined(); + }); + + test("delete messages", async () => { + const upserted = await agentClient.upsertChat("delete-messages-test"); + + // Add messages + await agentClient.sendMessages(upserted.id, { + behavior: "append", + messages: [ + { + role: "user", + parts: [ + { + type: "text", + text: "Message 1", + }, + ], + }, + { + role: "user", + parts: [ + { + type: "text", + text: "Message 2", + }, + ], + }, + { + role: "user", + parts: [ + { + type: "text", + text: "Message 3", + }, + ], + }, + ], + }); + + const messages = await agentClient.getMessages(upserted.id); + expect(messages.length).toBe(3); + + // Delete the first message + await agentClient.deleteMessages(upserted.id, [messages[0].id!]); + + const afterDelete = await agentClient.getMessages(upserted.id); + expect(afterDelete.length).toBe(2); + expect(afterDelete[0].id!).toBe(messages[1].id!); + }); +}); diff --git a/packages/api/src/routes/agents/members.client.ts b/packages/api/src/routes/agents/members.client.ts new file mode 100644 index 0000000..e9fdd84 --- /dev/null +++ b/packages/api/src/routes/agents/members.client.ts @@ -0,0 +1,144 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaPaginatedRequest, + schemaPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; + +export const schemaAgentPermissionLevel = z.enum(["read", "write", "admin"]); + +export const schemaAgentPermission = z.object({ + user_id: z.uuid().nullable(), + agent_id: z.uuid(), + permission: schemaAgentPermissionLevel, + created_at: z.date(), + updated_at: z.date(), + created_by: z.uuid(), +}); + +export type AgentPermission = z.infer; + +export const schemaAgentUser = z.object({ + id: z.uuid(), + created_at: z.date(), + updated_at: z.date(), + display_name: z.string().nullable(), + email: z.email(), + avatar_url: z.url().nullable(), + username: z.string(), +}); + +export const schemaAgentMember = schemaAgentPermission.extend({ + user: schemaAgentUser.nullable(), +}); + +export type AgentMember = z.infer; + +export const schemaListAgentMembersRequest = schemaPaginatedRequest.extend({ + agent_id: z.uuid(), +}); + +export type ListAgentMembersRequest = z.infer< + typeof schemaListAgentMembersRequest +>; + +export const schemaListAgentMembersResponse = + schemaPaginatedResponse(schemaAgentMember); + +export type ListAgentMembersResponse = z.infer< + typeof schemaListAgentMembersResponse +>; + +export const schemaGrantAgentPermissionRequestBody = z.object({ + user_id: z.uuid().nullable(), + permission: schemaAgentPermissionLevel, +}); + +export const schemaGrantAgentPermissionRequest = + schemaGrantAgentPermissionRequestBody.extend({ + agent_id: z.uuid(), + }); + +export type GrantAgentPermissionRequest = z.infer< + typeof schemaGrantAgentPermissionRequest +>; + +export const schemaRevokeAgentPermissionRequest = z.object({ + agent_id: z.uuid(), + user_id: z.uuid().nullable(), +}); + +export type RevokeAgentPermissionRequest = z.infer< + typeof schemaRevokeAgentPermissionRequest +>; + +export default class AgentMembers { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * List members with permissions for an agent. + * + * @param request - The request body. + * @returns The list of members. + */ + public async list( + request: ListAgentMembersRequest + ): Promise { + const query = new URLSearchParams(); + if (request.per_page) { + query.set("per_page", request.per_page.toString()); + } + if (request.page) { + query.set("page", request.page.toString()); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/members?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Grant or update permission for a user (or org default if user_id is null). + * + * @param request - The request body. + * @returns The updated permission. + */ + public async grant( + request: GrantAgentPermissionRequest + ): Promise { + const resp = await this.client.request( + "POST", + `/api/agents/${request.agent_id}/members`, + JSON.stringify({ + user_id: request.user_id, + permission: request.permission, + } as z.infer) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Revoke permission for a user or org default. + * + * @param request - The request body. + */ + public async revoke(request: RevokeAgentPermissionRequest): Promise { + const query = new URLSearchParams(); + if (request.user_id) { + query.set("user_id", request.user_id); + } + const resp = await this.client.request( + "DELETE", + `/api/agents/${request.agent_id}/members?${query.toString()}` + ); + await assertResponseStatus(resp, 204); + } +} diff --git a/packages/api/src/routes/agents/members.server.ts b/packages/api/src/routes/agents/members.server.ts new file mode 100644 index 0000000..81cc31f --- /dev/null +++ b/packages/api/src/routes/agents/members.server.ts @@ -0,0 +1,139 @@ +import type { AgentPermission as DBAgentPermission } from "@blink.so/database/schema"; +import { validator } from "hono/validator"; +import { + withAgent, + withAgentPermission, + withAuth, + withPagination, + withTeamOrganization, +} from "../../middleware"; +import type { APIServer } from "../../server"; +import { + schemaGrantAgentPermissionRequestBody, + type AgentMember, + type ListAgentMembersResponse, +} from "./members.client"; + +export default function mountAgentMembers(server: APIServer) { + // List agent members (permissions) + server.get( + "/", + withAuth, + withAgent, + withTeamOrganization, + withAgentPermission("read"), + withPagination, + async (c) => { + const db = await c.env.database(); + const agent = c.get("agent"); + const members = await db.selectAgentPermissions({ + agentId: agent.id, + page: c.get("page"), + per_page: c.get("per_page"), + }); + const resp: ListAgentMembersResponse = { + has_more: members.has_more, + items: members.items.map((m) => + convertAgentMember({ + permission: m, + user: m.user, + }) + ), + }; + return c.json(resp); + } + ); + + // Grant or update permission + server.post( + "/", + withAuth, + withAgent, + withTeamOrganization, + withAgentPermission("admin"), + validator("json", (value) => { + return schemaGrantAgentPermissionRequestBody.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const agent = c.get("agent"); + const userId = c.get("user_id"); + const { user_id, permission } = c.req.valid("json"); + + const updated = await db.upsertAgentPermission({ + agent_id: agent.id, + user_id: user_id ?? undefined, + permission, + created_by: userId, + }); + + let user = null; + if (updated.user_id) { + user = await db.selectUserByID(updated.user_id); + } + + return c.json( + convertAgentMember({ + permission: updated as unknown as DBAgentPermission & { + user?: typeof user; + }, + user: user, + }) + ); + } + ); + + // Revoke permission + server.delete( + "/", + withAuth, + withAgent, + withTeamOrganization, + withAgentPermission("admin"), + async (c) => { + const db = await c.env.database(); + const agent = c.get("agent"); + const user_id = c.req.query("user_id") ?? null; + + await db.deleteAgentPermission({ + agent_id: agent.id, + user_id: user_id ?? undefined, + }); + + return c.body(null, 204); + } + ); +} + +function convertAgentMember(input: { + permission: DBAgentPermission; + user?: { + id: string; + created_at: Date; + updated_at: Date; + username: string; + display_name: string | null; + email: string | null; + avatar_url: string | null; + } | null; +}): AgentMember { + return { + user_id: input.permission.user_id, + agent_id: input.permission.agent_id, + permission: input.permission.permission, + created_at: input.permission.created_at, + updated_at: input.permission.updated_at, + created_by: input.permission.created_by, + user: input.user + ? { + id: input.user.id, + created_at: input.user.created_at, + updated_at: input.user.updated_at, + username: input.user.username, + display_name: input.user.display_name, + email: input.user.email!, + avatar_url: input.user.avatar_url, + } + : null, + }; +} diff --git a/packages/api/src/routes/agents/runs.client.ts b/packages/api/src/routes/agents/runs.client.ts new file mode 100644 index 0000000..a787c18 --- /dev/null +++ b/packages/api/src/routes/agents/runs.client.ts @@ -0,0 +1,76 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaCursorPaginatedRequest, + schemaCursorPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; +import type { ChatRun } from "../chats/runs.client"; +import { schemaChatRun } from "../chats/runs.client"; + +export const schemaListAgentRunsRequest = schemaCursorPaginatedRequest.extend({ + agent_id: z.uuid(), + agent_deployment_id: z.uuid().optional(), +}); + +export type ListAgentRunsRequest = z.infer; + +// Right now, these are equal, but they might not +// always return the same data. +export type AgentRun = ChatRun; + +export const schemaListAgentRunsResponse = + schemaCursorPaginatedResponse(schemaChatRun); + +export type ListAgentRunsResponse = z.infer; + +export const schemaGetAgentRunRequest = z.object({ + agent_id: z.uuid(), + run_id: z.uuid(), +}); + +export type GetAgentRunRequest = z.infer; + +export default class AgentRuns { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * List runs for an agent. + */ + public async list( + request: ListAgentRunsRequest + ): Promise { + const params = new URLSearchParams(); + if (request.agent_deployment_id) { + params.set("agent_deployment_id", request.agent_deployment_id); + } + if (request.limit) { + params.set("limit", request.limit.toString()); + } + if (request.cursor) { + params.set("cursor", request.cursor); + } + const response = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/runs?${params.toString()}` + ); + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * Get a run by ID. + */ + public async get(request: GetAgentRunRequest): Promise { + const response = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/runs/${request.run_id}` + ); + await assertResponseStatus(response, 200); + return response.json(); + } +} diff --git a/packages/api/src/routes/agents/runs.server.ts b/packages/api/src/routes/agents/runs.server.ts new file mode 100644 index 0000000..1249857 --- /dev/null +++ b/packages/api/src/routes/agents/runs.server.ts @@ -0,0 +1,107 @@ +import type { ChatRunWithStatus as DBChatRunWithStatus } from "@blink.so/database/schema"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import { validate } from "uuid"; +import { z } from "zod"; +import { + withAgentPermission, + withAgentURLParam, + withAuth, + withCursorPagination, +} from "../../middleware"; +import type { APIServer } from "../../server"; +import type { ListChatRunsResponse } from "../chats/runs.client"; +import type { AgentRun } from "./runs.client"; + +export default function mountAgentRuns(app: APIServer) { + // List runs for an agent. + app.get( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + withCursorPagination, + validator("query", (value) => { + if (Array.isArray(value["agent_deployment_id"])) { + throw new HTTPException(400, { + message: "agent_deployment_id must not be supplied multiple times", + }); + } + const agent_deployment_id = value["agent_deployment_id"]; + if ( + agent_deployment_id && + !z.uuid().safeParse(agent_deployment_id).success + ) { + throw new HTTPException(400, { + message: "agent_deployment_id must be a valid UUID", + }); + } + return { agent_deployment_id }; + }), + async (c) => { + const db = await c.env.database(); + const permission = c.get("agent_permission"); + const userId = c.get("user_id"); + + // Read users can only see runs from their own chats + let chatIds: string[] | undefined; + if (permission === "read") { + const chats = await db.selectChats({ + agentID: c.get("agent").id, + }); + // Filter to only chats created by this user + chatIds = chats.items + .filter((chat) => chat.created_by === userId) + .map((chat) => chat.id); + } + + const runs = await db.selectAgentRuns({ + agent_id: c.get("agent").id, + agent_deployment_id: c.req.valid("query").agent_deployment_id, + chat_ids: chatIds, + cursor: c.get("cursor"), + limit: c.get("limit"), + }); + const resp: ListChatRunsResponse = { + items: runs.items.map(convertAgentRun), + next_cursor: runs.next_cursor, + }; + return c.json(resp); + } + ); + + // Get a run by ID. + app.get( + "/:id", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + async (c) => { + if (!validate(c.req.param("id"))) { + return c.json({ error: "Invalid run ID" }, 400); + } + const db = await c.env.database(); + const run = await db.selectAgentRun({ + agent_id: c.get("agent").id, + run_id: c.req.param("id"), + }); + if (!run) { + return c.json({ error: "Run not found" }, 404); + } + return c.json(convertAgentRun(run)); + } + ); +} + +const convertAgentRun = (run: DBChatRunWithStatus): AgentRun => { + return { + id: run.id, + started_at: run.created_at, + agent_id: run.agent_id, + agent_deployment_id: run.agent_deployment_id, + chat_id: run.chat_id, + step_count: run.last_step_number, + status: run.status, + error: run.error, + }; +}; diff --git a/packages/api/src/routes/agents/runs.test.ts b/packages/api/src/routes/agents/runs.test.ts new file mode 100644 index 0000000..0efb69d --- /dev/null +++ b/packages/api/src/routes/agents/runs.test.ts @@ -0,0 +1,226 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("GET /api/agents/:agent_id/runs", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + + output_files: [ + { + data: "console.log('Hello, world!');", + path: "test.js", + }, + ], + }); + + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + const chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + agent_deployment_id: deployment.id, + }); + + await client.messages.send({ + chat_id: chat.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "Hello, world!" }], + }, + ], + }); + + const runs = await client.agents.runs.list({ + agent_id: agent.id, + }); + expect(runs.items.length).toBe(1); + let run = runs.items[0]!; + expect(run.agent_id).toBe(agent.id); + expect(run.agent_deployment_id).toBe(deployment.id); + // Users will rarely encounter a null status, but it's + // possible when a run is created but not yet started. + expect(run.status).toBe("streaming"); + + const db = await bindings.database(); + run = await client.agents.runs.get({ + agent_id: agent.id, + run_id: run.id, + }); + expect(run.status).toBe("streaming"); + + const steps = await client.agents.steps.list({ + agent_id: agent.id, + run_id: run.id, + }); + expect(steps.items.length).toBe(1); + const step = steps.items[0]!; + + await db.updateChatRunStep({ + id: step.id, + error: "Test error", + }); + + run = await client.agents.runs.get({ + agent_id: agent.id, + run_id: run.id, + }); + expect(run.status).toBe("error"); + expect(run.error).toBe("Test error"); + + await db.updateChatRunStep({ + id: step.id, + error: null, + completed_at: new Date(), + }); + + run = await client.agents.runs.get({ + agent_id: agent.id, + run_id: run.id, + }); + expect(run.status).toBe("completed"); + expect(run.error).toBe(null); + expect(run.step_count).toBe(1); + + await db.insertChatRunStep({ + agent_id: run.agent_id, + agent_deployment_id: run.agent_deployment_id!, + chat_id: chat.id, + chat_run_id: run.id, + }); + + run = await client.agents.runs.get({ + agent_id: agent.id, + run_id: run.id, + }); + expect(run.step_count).toBe(2); + expect(run.status).toBe("streaming"); +}); + +test("runs permissions - read user sees only own chat runs", async () => { + const { helpers, bindings } = await serve(); + const { user: ownerUser, client: ownerClient } = await helpers.createUser(); + const { user: readUser, client: readClient } = await helpers.createUser(); + const { user: writeUser, client: writeClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "test-org", + }); + + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: writeUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "private", + output_files: [ + { + path: "test.js", + data: "console.log('test');", + }, + ], + }); + + const deployments = await ownerClient.agents.deployments.list({ + agent_id: agent.id, + }); + await ownerClient.agents.update({ + id: agent.id, + active_deployment_id: deployments.items[0]!.id, + }); + + // Grant permissions + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "write", + }); + + // Create chats with messages to trigger runs + const ownerChat = await ownerClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "owner message" }], + }, + ], + }); + + const readChat = await readClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "read message" }], + }, + ], + }); + + const writeChat = await writeClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "write message" }], + }, + ], + }); + + // Read user should only see runs from their own chat + const readUserRuns = await readClient.agents.runs.list({ + agent_id: agent.id, + }); + expect(readUserRuns.items.length).toBe(1); + expect(readUserRuns.items[0]!.chat_id).toBe(readChat.id); + + // Write user should see all runs + const writeUserRuns = await writeClient.agents.runs.list({ + agent_id: agent.id, + }); + expect(writeUserRuns.items.length).toBe(3); + const writeUserChatIds = writeUserRuns.items.map((r) => r.chat_id).sort(); + expect(writeUserChatIds).toEqual( + [ownerChat.id, readChat.id, writeChat.id].sort() + ); + + // Owner should see all runs + const ownerRuns = await ownerClient.agents.runs.list({ + agent_id: agent.id, + }); + expect(ownerRuns.items.length).toBe(3); +}); diff --git a/packages/api/src/routes/agents/steps.client.ts b/packages/api/src/routes/agents/steps.client.ts new file mode 100644 index 0000000..d3fafd0 --- /dev/null +++ b/packages/api/src/routes/agents/steps.client.ts @@ -0,0 +1,84 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaCursorPaginatedRequest, + schemaCursorPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; +import { + schemaChatRunStepStatus, + schemaChatRunStepSummary, + type ChatRunStep, + type ChatRunStepSummary, +} from "../chats/steps.client"; + +export type AgentRunStepSummary = ChatRunStepSummary; + +export type AgentRunStep = ChatRunStep; + +export const schemaListAgentRunStepsRequest = + schemaCursorPaginatedRequest.extend({ + agent_id: z.uuid(), + agent_deployment_id: z.uuid().optional(), + chat_id: z.uuid().optional(), + run_id: z.uuid().optional(), + status: schemaChatRunStepStatus.optional(), + }); + +export type ListAgentRunStepsRequest = z.infer< + typeof schemaListAgentRunStepsRequest +>; + +export const schemaListAgentRunStepsResponse = schemaCursorPaginatedResponse( + schemaChatRunStepSummary +); + +export type ListAgentRunStepsResponse = z.infer< + typeof schemaListAgentRunStepsResponse +>; + +export interface GetAgentRunStepRequest { + agent_id: string; + step_id: string; +} + +export default class AgentSteps { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public async list( + request: ListAgentRunStepsRequest + ): Promise { + const query = new URLSearchParams(); + if (request.run_id) { + query.set("run_id", request.run_id); + } + if (request.agent_deployment_id) { + query.set("agent_deployment_id", request.agent_deployment_id); + } + if (request.chat_id) { + query.set("chat_id", request.chat_id); + } + if (request.status) { + query.set("status", request.status); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/steps?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + public async get(request: GetAgentRunStepRequest): Promise { + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/steps/${request.step_id}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/agents/steps.server.ts b/packages/api/src/routes/agents/steps.server.ts new file mode 100644 index 0000000..7e4cb71 --- /dev/null +++ b/packages/api/src/routes/agents/steps.server.ts @@ -0,0 +1,198 @@ +import type { + ChatRunStepStatus, + ChatRunStepWithStatus, +} from "@blink.so/database/schema"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import z from "zod"; +import { + withAgentPermission, + withAgentURLParam, + withAuth, + withCursorPagination, +} from "../../middleware"; +import type { APIServer } from "../../server"; +import { + schemaChatRunStepStatus, + type ChatRunStepSummary, +} from "../chats/steps.client"; +import { + type AgentRunStep, + type ListAgentRunStepsResponse, +} from "./steps.client"; + +export default function mountSteps(app: APIServer) { + // List steps for an agent. + app.get( + "/", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + withCursorPagination, + validator("query", (value) => { + if (Array.isArray(value["deployment_id"])) { + throw new HTTPException(400, { + message: "deployment_id must not be supplied multiple times", + }); + } + if (Array.isArray(value["chat_id"])) { + throw new HTTPException(400, { + message: "chat_id must not be supplied multiple times", + }); + } + if (Array.isArray(value["run_id"])) { + throw new HTTPException(400, { + message: "run_id must not be supplied multiple times", + }); + } + + const deployment_id = value["deployment_id"]; + if (deployment_id && !z.uuid().safeParse(deployment_id).success) { + throw new HTTPException(400, { + message: "deployment_id must be a valid UUID", + }); + } + const chat_id = value["chat_id"]; + if (chat_id && !z.uuid().safeParse(chat_id).success) { + throw new HTTPException(400, { + message: "chat_id must be a valid UUID", + }); + } + const run_id = value["run_id"]; + if (run_id && !z.uuid().safeParse(run_id).success) { + throw new HTTPException(400, { + message: "run_id must be a valid UUID", + }); + } + const status = value["status"]; + if (status && !schemaChatRunStepStatus.safeParse(status).success) { + throw new HTTPException(400, { + message: "status must be a valid chat run step status", + }); + } + + return { + deployment_id, + chat_id, + run_id, + status: status as ChatRunStepStatus, + }; + }), + async (c) => { + const db = await c.env.database(); + const permission = c.get("agent_permission"); + const userId = c.get("user_id"); + + // Read users can only see steps from their own chats + let chatIds: string[] | undefined; + if (permission === "read") { + const chats = await db.selectChats({ + agentID: c.get("agent").id, + }); + // Filter to only chats created by this user + chatIds = chats.items + .filter((chat) => chat.created_by === userId) + .map((chat) => chat.id); + } + + const steps = await db.selectAgentSteps({ + agent_id: c.get("agent").id, + agent_deployment_id: c.req.valid("query").deployment_id, + chat_id: c.req.valid("query").chat_id, + run_id: c.req.valid("query").run_id, + status: c.req.valid("query").status, + chat_ids: chatIds, + cursor: c.get("cursor"), + limit: c.get("limit"), + }); + + const response: ListAgentRunStepsResponse = { + next_cursor: steps.next_cursor, + items: steps.items.map(convertChatRunStepToSummary), + }; + + return c.json(response); + } + ); + + // Get a step for an agent. + app.get( + "/:step_id", + withAuth, + withAgentURLParam, + withAgentPermission("read"), + async (c) => { + const id = c.req.param("step_id"); + if (!z.uuid().safeParse(id).success) { + throw new HTTPException(400, { + message: "step_id must be a valid UUID", + }); + } + const db = await c.env.database(); + const step = await db.selectAgentStep({ + agent_id: c.get("agent").id, + step_id: id, + }); + if (!step) { + throw new HTTPException(404, { + message: "Step not found", + }); + } + + return c.json(convertChatRunStep(step)); + } + ); +} + +const convertChatRunStep = (step: ChatRunStepWithStatus): AgentRunStep => { + return { + id: step.id, + number: step.number, + chat_id: step.chat_id, + chat_run_id: step.chat_run_id, + agent_id: step.agent_id, + agent_deployment_id: step.agent_deployment_id, + continuation_reason: step.continuation_reason, + error: step.error, + response_status: step.response_status, + response_message_id: step.response_message_id, + started_at: step.started_at.toISOString(), + status: step.status, + heartbeat_at: step.heartbeat_at, + completed_at: step.completed_at, + interrupted_at: step.interrupted_at, + first_message_id: step.first_message_id, + last_message_id: step.last_message_id, + response_headers: step.response_headers, + response_headers_redacted: step.response_headers_redacted, + response_body: step.response_body, + response_body_redacted: step.response_body_redacted, + time_to_first_token_micros: step.time_to_first_token_micros, + usage_model: step.usage_model, + usage_total_input_tokens: step.usage_total_input_tokens, + usage_total_output_tokens: step.usage_total_output_tokens, + usage_total_tokens: step.usage_total_tokens, + usage_total_cached_input_tokens: step.usage_total_cached_input_tokens, + usage_cost_usd: step.usage_cost_usd, + }; +}; + +const convertChatRunStepToSummary = ( + step: ChatRunStepWithStatus +): ChatRunStepSummary => { + return { + id: step.id, + number: step.number, + chat_id: step.chat_id, + chat_run_id: step.chat_run_id, + agent_id: step.agent_id, + agent_deployment_id: step.agent_deployment_id, + continuation_reason: step.continuation_reason, + error: step.error, + response_status: step.response_status, + response_message_id: step.response_message_id, + started_at: step.started_at.toISOString(), + status: step.status, + time_to_first_token_micros: step.time_to_first_token_micros, + }; +}; diff --git a/packages/api/src/routes/agents/steps.test.ts b/packages/api/src/routes/agents/steps.test.ts new file mode 100644 index 0000000..0689e11 --- /dev/null +++ b/packages/api/src/routes/agents/steps.test.ts @@ -0,0 +1,146 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("GET /api/agents/:agent_id/runs", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + + output_files: [ + { + data: "console.log('Hello, world!');", + path: "test.js", + }, + ], + }); + + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + const chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + agent_deployment_id: deployment.id, + }); + + await client.messages.send({ + chat_id: chat.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "Hello, world!" }], + }, + ], + }); + + let resp = await client.agents.steps.list({ + agent_id: agent.id, + agent_deployment_id: deployment.id, + status: "completed", + }); + expect(resp.items.length).toBe(0); + + resp = await client.agents.steps.list({ + agent_id: agent.id, + agent_deployment_id: deployment.id, + status: "streaming", + }); + expect(resp.items.length).toBe(1); + expect(resp.items[0]!.status).toBe("streaming"); + + const step = await client.agents.steps.get({ + agent_id: agent.id, + step_id: resp.items[0]!.id, + }); + expect(step.status).toBe("streaming"); +}); + +test("steps permissions - read user sees only own chat steps", async () => { + const { helpers, bindings } = await serve(); + const { user: readUser, client: readClient } = await helpers.createUser(); + const { user: writeUser, client: writeClient } = await helpers.createUser(); + const { client: ownerClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ name: "test-org" }); + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: writeUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "private", + output_files: [{ path: "test.js", data: "console.log('test');" }], + }); + + const deployments = await ownerClient.agents.deployments.list({ + agent_id: agent.id, + }); + await ownerClient.agents.update({ + id: agent.id, + active_deployment_id: deployments.items[0]!.id, + }); + + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "write", + }); + + // Create chats with messages + await ownerClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [{ role: "user", parts: [{ type: "text", text: "owner" }] }], + }); + const readChat = await readClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [{ role: "user", parts: [{ type: "text", text: "read" }] }], + }); + await writeClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [{ role: "user", parts: [{ type: "text", text: "write" }] }], + }); + + // Read user should only see steps from their own chat + const readUserSteps = await readClient.agents.steps.list({ + agent_id: agent.id, + }); + expect(readUserSteps.items.length).toBe(1); + expect(readUserSteps.items[0]!.chat_id).toBe(readChat.id); + + // Write user should see all steps + const writeUserSteps = await writeClient.agents.steps.list({ + agent_id: agent.id, + }); + expect(writeUserSteps.items.length).toBe(3); +}); diff --git a/packages/api/src/routes/agents/traces.client.ts b/packages/api/src/routes/agents/traces.client.ts new file mode 100644 index 0000000..fe6554a --- /dev/null +++ b/packages/api/src/routes/agents/traces.client.ts @@ -0,0 +1,64 @@ +import { z } from "zod"; +import { assertResponseStatus } from "../../client-helper"; +import Client from "../../client.browser"; +import type { OtelEvent, OtelLink, OtelSpan } from "../otlp/convert"; + +export const FieldFilterSchema = z.object({ + type: z.literal("eq"), + key: z.string(), + value: z.string(), +}); + +export const FieldFilterGroupSchema = z.object({ + type: z.literal("and"), + get filters() { + return z.array(z.union([FieldFilterSchema, FieldFilterGroupSchema])); + }, +}); + +export const SpansRequestSchema = z.object({ + start_time: z.iso.datetime().pipe(z.coerce.date()), + end_time: z.iso.datetime().pipe(z.coerce.date()), + filters: z + .string() + .transform((val) => JSON.parse(val)) + .pipe(FieldFilterGroupSchema), + limit: z + .string() + .pipe(z.coerce.number().min(1).max(10_000)) + .optional(), +}); + +export type FieldFilter = z.infer; +export type FieldFilterGroup = z.infer; +export type SpansRequest = z.infer; + +export type GetSpansResponse = { traces: OtelSpan[] }; +export type { OtelEvent, OtelLink, OtelSpan }; + +export default class AgentTraces { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public async spans( + request: SpansRequest & { agent_id: string } + ): Promise { + const query = new URLSearchParams(); + query.set("start_time", request.start_time.toISOString()); + query.set("end_time", request.end_time.toISOString()); + query.set("filters", JSON.stringify(request.filters)); + if (request.limit !== undefined) { + query.set("limit", request.limit.toString()); + } + const resp = await this.client.request( + "GET", + `/api/agents/${request.agent_id}/traces/spans?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + const data = (await resp.json()) as GetSpansResponse; + return data; + } +} diff --git a/packages/api/src/routes/agents/traces.server.ts b/packages/api/src/routes/agents/traces.server.ts new file mode 100644 index 0000000..5c2c58c --- /dev/null +++ b/packages/api/src/routes/agents/traces.server.ts @@ -0,0 +1,35 @@ +import { validator } from "hono/validator"; +import { + withAgentPermission, + withAgentURLParam, + withAuth, +} from "../../middleware"; +import type { APIServer } from "../../server"; +import { SpansRequestSchema } from "./traces.client"; + +// /api/agents/:id/traces/spans +export default function mountAgentTraces(app: APIServer) { + app.get( + "/spans", + withAuth, + withAgentURLParam, + withAgentPermission("write"), + validator("query", (data) => { + return SpansRequestSchema.parse(data); + }), + async (c) => { + const reqData = c.req.valid("query"); + const agent = c.get("agent"); + + const traces = await c.env.traces.read({ + agent_id: agent.id, + start_time: reqData.start_time, + end_time: reqData.end_time, + limit: reqData.limit ?? 200, + filters: reqData.filters, + }); + + return c.json({ traces }); + } + ); +} diff --git a/packages/api/src/routes/agents/traces.test.ts b/packages/api/src/routes/agents/traces.test.ts new file mode 100644 index 0000000..845b5e9 --- /dev/null +++ b/packages/api/src/routes/agents/traces.test.ts @@ -0,0 +1,487 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; +import type { FieldFilterGroup, OtelSpan } from "./traces.client"; + +const createMockSpan = (overrides?: Partial): OtelSpan => ({ + agent_id: "test-agent-id", + start_time: "2024-01-01 10:00:00.000000000", + end_time: "2024-01-01 10:00:01.000000000", + payload: { + span: { + duration_ns: "1000000000", + trace_id: "abc123", + id: "span123", + parent_span_id: "", + name: "test-span", + kind: "INTERNAL", + status_code: "OK", + status_message: "", + trace_state: "", + flags: 0, + dropped_attributes_count: 0, + dropped_events_count: 0, + dropped_links_count: 0, + attributes: { test: "value" }, + events: [], + links: [], + }, + resource: { + attributes: {}, + dropped_attributes_count: 0, + }, + scope: { + name: undefined, + version: undefined, + attributes: {}, + dropped_attributes_count: 0, + }, + }, + ...overrides, +}); + +test("get agent traces successfully with all parameters", async () => { + const mockTraces: OtelSpan[] = [ + createMockSpan({ + start_time: "2024-01-01 10:00:00.000000000", + end_time: "2024-01-01 10:00:01.000000000", + }), + createMockSpan({ + start_time: "2024-01-01 10:05:00.000000000", + end_time: "2024-01-01 10:05:01.000000000", + }), + ]; + + const { helpers } = await serve({ + bindings: { + traces: { + read: async (opts) => { + expect(typeof opts.agent_id).toBe("string"); + expect(opts.start_time).toBeInstanceOf(Date); + expect(opts.end_time).toBeInstanceOf(Date); + expect(opts.limit).toBe(100); + expect(opts.filters).toEqual({ + type: "and", + filters: [{ type: "eq", key: "status", value: "ok" }], + }); + return mockTraces; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const startTime = new Date("2024-01-01T09:00:00Z"); + const endTime = new Date("2024-01-01T11:00:00Z"); + + const response = await client.agents.traces.spans({ + agent_id: agent.id, + start_time: startTime, + end_time: endTime, + limit: 100, + filters: { + type: "and", + filters: [{ type: "eq", key: "status", value: "ok" }], + }, + }); + + expect(response.traces).toHaveLength(2); + expect(response.traces[0].start_time).toBe("2024-01-01 10:00:00.000000000"); + expect(response.traces[1].start_time).toBe("2024-01-01 10:05:00.000000000"); +}); + +test("get agent traces with default limit when not specified", async () => { + const mockTraces: OtelSpan[] = [createMockSpan()]; + + const { helpers } = await serve({ + bindings: { + traces: { + read: async (opts) => { + // Should default to 200 + expect(opts.limit).toBe(200); + return mockTraces; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + filters: { + type: "and", + filters: [], + }, + }); + + expect(response.traces).toHaveLength(1); +}); + +test("agent traces authorization failure - different user", async () => { + const { helpers } = await serve({ + bindings: { + traces: { + read: async () => { + throw new Error("Should not reach traces service"); + }, + }, + }, + }); + + const { client: ownerClient } = await helpers.createUser(); + const { client: otherClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "private-org", + }); + const agent = await ownerClient.agents.create({ + name: "private-agent", + organization_id: org.id, + }); + + try { + await otherClient.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + filters: { + type: "and", + filters: [], + }, + }); + throw new Error("Should not reach this line"); + } catch (error) { + expect(error).toBeInstanceOf(Error); + expect((error as any).message).toContain("Organization not found"); + } +}); + +test("agent traces with empty result", async () => { + const { helpers } = await serve({ + bindings: { + traces: { + read: async () => [], + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + filters: { + type: "and", + filters: [], + }, + }); + + expect(response.traces).toEqual([]); +}); + +test("agent traces with invalid agent id", async () => { + const { helpers } = await serve({ + bindings: { + traces: { + read: async () => { + throw new Error("Should not reach traces service"); + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + + try { + await client.agents.traces.spans({ + agent_id: "invalid-agent-id", + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + filters: { + type: "and", + filters: [], + }, + }); + throw new Error("Should not reach this line"); + } catch (error) { + expect(error).toBeInstanceOf(Error); + expect((error as any).message).toContain("Invalid agent ID"); + } +}); + +test("agent traces parameter validation - limit out of range", async () => { + const { helpers } = await serve({ + bindings: { + traces: { + read: async () => { + throw new Error("Should not reach traces service"); + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + // Test limit too high + try { + await client.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 20000, // Above max of 10,000 + filters: { + type: "and", + filters: [], + }, + }); + throw new Error("Should not reach this line"); + } catch (error) { + expect(error).toBeInstanceOf(Error); + expect((error as any).message).toContain("expected number to be <=10000"); + } + + // Test limit too low + try { + await client.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + limit: 0, // Below minimum of 1 + filters: { + type: "and", + filters: [], + }, + }); + throw new Error("Should not reach this line"); + } catch (error) { + expect(error).toBeInstanceOf(Error); + expect((error as any).message).toContain("expected number to be >=1"); + } +}); + +test("agent traces with complex nested filters", async () => { + const mockTraces: OtelSpan[] = [createMockSpan()]; + const filters = { + type: "and", + filters: [ + { type: "eq", key: "status", value: "ok" }, + { + type: "and", + filters: [ + { type: "eq", key: "service", value: "api" }, + { type: "eq", key: "env", value: "prod" }, + ], + }, + ], + } satisfies FieldFilterGroup; + + const { helpers } = await serve({ + bindings: { + traces: { + read: async (opts) => { + expect(opts.filters).toEqual(filters); + return mockTraces; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + filters, + }); + + expect(response.traces).toHaveLength(1); +}); + +test("agent traces respects time range filtering", async () => { + const startTime = new Date("2024-01-01T09:00:00Z"); + const endTime = new Date("2024-01-01T11:00:00Z"); + + const mockTraces: OtelSpan[] = [ + createMockSpan({ + start_time: "2024-01-01 09:30:00.000000000", + end_time: "2024-01-01 09:30:01.000000000", + }), + ]; + + const { helpers } = await serve({ + bindings: { + traces: { + read: async (opts) => { + expect(opts.start_time?.toISOString()).toBe(startTime.toISOString()); + expect(opts.end_time?.toISOString()).toBe(endTime.toISOString()); + return mockTraces; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.traces.spans({ + agent_id: agent.id, + start_time: startTime, + end_time: endTime, + filters: { + type: "and", + filters: [], + }, + }); + + expect(response.traces).toHaveLength(1); +}); + +test("agent traces correctly passes agent_id to traces service", async () => { + const mockTraces: OtelSpan[] = [createMockSpan()]; + let capturedAgentId: string | undefined; + + const { helpers } = await serve({ + bindings: { + traces: { + read: async (opts) => { + // Capture the agent_id passed to traces service + capturedAgentId = opts.agent_id; + return mockTraces; + }, + }, + }, + }); + + const { client } = await helpers.createUser(); + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + const response = await client.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2024-01-01T09:00:00Z"), + end_time: new Date("2024-01-01T11:00:00Z"), + filters: { + type: "and", + filters: [], + }, + }); + + expect(response.traces).toHaveLength(1); + expect(capturedAgentId).toBe(agent.id); +}); + +test("traces permissions - requires write permission", async () => { + const { helpers, bindings } = await serve({ + bindings: { + traces: { + read: async (opts) => { + return []; + }, + }, + }, + }); + const { user: readUser, client: readClient } = await helpers.createUser(); + const { user: writeUser, client: writeClient } = await helpers.createUser(); + const { client: ownerClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ name: "test-org" }); + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: writeUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "private", + }); + + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "write", + }); + + // Read user cannot access traces + await expect( + readClient.agents.traces.spans({ + agent_id: agent.id, + start_time: new Date("2025-01-01"), + end_time: new Date("2025-01-02"), + filters: { type: "and", filters: [] }, + }) + ).rejects.toThrow("requires write permission"); + + // TODO: Fix this - write user call is failing due to mock issues + // // Write user can access traces + // const result = await writeClient.agents.traces.spans({ + // agent_id: agent.id, + // start_time: new Date("2025-01-01"), + // end_time: new Date("2025-01-02"), + // }); + // expect(result).toBeDefined(); + // expect(result.traces).toBeDefined(); +}); diff --git a/packages/api/src/routes/ai-gateway.server.ts b/packages/api/src/routes/ai-gateway.server.ts new file mode 100644 index 0000000..b52ba3f --- /dev/null +++ b/packages/api/src/routes/ai-gateway.server.ts @@ -0,0 +1,590 @@ +import { ingestUsageEvent } from "@blink.so/billing/ingest-usage-event"; +import type { EnvLike } from "@blink.so/billing/metronome"; +import { Money } from "@blink.so/billing/money"; +import type Querier from "@blink.so/database/querier"; +import { createParser, type EventSourceMessage } from "eventsource-parser"; +import { z } from "zod"; +import type { APIServer } from "../server"; +import { withToolsAuth } from "./tools/tools.server"; + +const UpstreamRequestSchema = z.looseObject({ + stream: z.boolean().optional(), + stream_options: z + .object({ + include_usage: z.boolean().optional(), + }) + .optional(), +}); + +const StreamingChunkSchema = z.looseObject({ + choices: z.array( + z.object({ + delta: z.object({ + provider_metadata: z.object({ + gateway: z.object({ + cost: z.string(), + }), + }), + }), + }) + ), +}); + +const LanguageModelFinishChunkSchema = z.looseObject({ + type: z.literal("finish"), + providerMetadata: z.object({ + gateway: z.object({ + cost: z.string(), + }), + }), +}); + +const NonStreamingResponseSchema = z.looseObject({ + choices: z + .array( + z.object({ + message: z.object({ + provider_metadata: z.object({ + gateway: z.object({ cost: z.string() }), + }), + }), + }) + ) + .optional(), +}); + +const VERCEL_AI_GATEWAY_URL = "https://ai-gateway.vercel.sh"; + +function createGatewayUrl(path: string[]): string { + return `${VERCEL_AI_GATEWAY_URL}/${path.join("/")}`; +} + +function extractCostFromStreamingChunk(obj: unknown): Money | undefined { + // Try language model format first (type: "finish") + const languageModelParsed = LanguageModelFinishChunkSchema.safeParse(obj); + if (languageModelParsed.success) { + const cost = languageModelParsed.data.providerMetadata?.gateway?.cost; + if (cost) { + return Money.from(cost); + } + } + + // Try chat completions format + const parsed = StreamingChunkSchema.safeParse(obj); + if (!parsed.success) { + return undefined; + } + const data = parsed.data; + if (!data.choices) { + return undefined; + } + for (const choice of data.choices) { + // https://vercel.com/docs/ai-gateway/provider-options#example-provider-metadata-output + // > The gateway.cost value is the amount debited from your AI Gateway Credits balance for + // > this request. It is returned as a decimal string. + const cost = choice?.delta?.provider_metadata?.gateway?.cost; + if (!cost) { + continue; + } + return Money.from(cost); + } + + return undefined; +} + +function extractCostFromNonStreamingResponse(obj: unknown): Money | undefined { + // Try language model format first (has providerMetadata at top level) + const languageModelParsed = LanguageModelFinishChunkSchema.safeParse(obj); + if (languageModelParsed.success) { + const cost = languageModelParsed.data.providerMetadata?.gateway?.cost; + if (cost) { + return Money.from(cost); + } + } + + // Try chat completions format + const parsed = NonStreamingResponseSchema.safeParse(obj); + if (!parsed.success) { + console.warn("Invalid non-streaming chunk:", obj); + return undefined; + } + const data = parsed.data; + if (!data.choices) { + return undefined; + } + for (const choice of data.choices) { + const cost = choice?.message?.provider_metadata?.gateway?.cost; + if (!cost) { + continue; + } + return Money.from(cost); + } + return undefined; +} + +async function recordBilling( + env: EnvLike, + querier: Querier, + opts: { + organizationId: string; + userId?: string; + cost: Money; + } +) { + try { + const usageEvent = await ingestUsageEvent(env, querier, { + organizationId: opts.organizationId, + costUSD: opts.cost, + transactionId: `proxy-${crypto.randomUUID()}`, + eventType: "language_model", + userID: opts.userId, + }); + } catch (error) { + console.error("Failed to record billing to Metronome for LLM usage", error); + } +} + +function createResponseHeaders(contentType: string): Headers { + const headers = new Headers(); + headers.set("content-type", contentType); + return headers; +} + +export function mountDisabledAIGateway(server: APIServer) { + server.all("*", async (c) => { + return c.json({ error: "Service unavailable" }, 503); + }); +} + +function mountAIGateway(server: APIServer) { + // GET /api/ai-gateway/v1/models + server.get("/v1/models", async (_c) => { + const upstream = await fetch(createGatewayUrl(["v1", "models"]), { + method: "GET", + headers: { + "content-type": "application/json", + }, + }); + + return new Response(upstream.body, { + status: upstream.status, + headers: createResponseHeaders("application/json"), + }); + }); + // GET /api/ai-gateway/v1/models/* + server.get("/v1/models/*", async (c) => { + const rest = c.req.path.split("/v1/models/")[1] ?? ""; + const upstream = await fetch(createGatewayUrl(["v1", "models", rest]), { + method: "GET", + headers: { + "content-type": "application/json", + }, + }); + return new Response(upstream.body, { + status: upstream.status, + headers: createResponseHeaders("application/json"), + }); + }); + + // POST /api/ai-gateway/v1/chat/completions + // The tools auth allows us to let an agent or a user invoke this endpoint. + server.post("/v1/chat/completions", withToolsAuth(), async (c) => { + if (!c.env.AI_GATEWAY_API_KEY) { + console.error("AI_GATEWAY_API_KEY is not set"); + return c.json({ error: "Service unavailable" }, 503); + } + + let organizationID: string | undefined; + const db = await c.env.database(); + if (c.get("agent_id")) { + const agent = await db.selectAgentByID(c.get("agent_id")!); + if (agent) { + organizationID = agent.organization_id; + } + } else { + const userID = c.get("user_id"); + if (userID) { + const user = await db.selectUserByID(userID); + if (user) { + // TODO: This should be configured by the user, + // but for now since all is free, it's fine. + organizationID = user.organization_id; + } + } + } + + if (!organizationID) { + return c.json({ error: "Organization not found" }, 404); + } + + let payload: unknown; + try { + payload = await c.req.json(); + } catch { + return c.json({ error: "Invalid payload" }, 400); + } + + const parsedIn = UpstreamRequestSchema.safeParse(payload); + if (!parsedIn.success) { + return c.json({ error: "Invalid payload" }, 400); + } + const normalized = parsedIn.data; + if (normalized?.stream === true) { + normalized.stream_options = { + ...(normalized.stream_options ?? {}), + include_usage: true, + }; + } + + const upstream = await fetch( + createGatewayUrl(["v1", "chat", "completions"]), + { + method: "POST", + headers: { + "content-type": "application/json", + authorization: `Bearer ${c.env.AI_GATEWAY_API_KEY}`, + }, + body: JSON.stringify(normalized), + } + ); + + // Non-streaming response + if (!normalized?.stream) { + const json = await upstream.json().catch(() => ({})); + const cost = extractCostFromNonStreamingResponse(json); + if (cost != null) { + await recordBilling(c.env, db, { + organizationId: organizationID, + userId: c.get("user_id"), + cost, + }); + } else { + console.warn( + "LLM cost not available. The user will not be billed for this request.", + json + ); + } + return new Response(JSON.stringify(json), { + status: upstream.status, + headers: createResponseHeaders("application/json"), + }); + } + + const body = upstream.body; + if (!body) { + return c.json({ error: "Upstream returned no body" }, 502); + } + + const [toClient, toLog] = body.tee(); + + (async () => { + try { + let lastCost: Money | undefined; + const decoder = new TextDecoder(); + const parser = createParser({ + onEvent: (evt: EventSourceMessage) => { + const data = evt.data; + if (!data || data === "[DONE]") { + return; + } + try { + const json = JSON.parse(data); + const cost = extractCostFromStreamingChunk(json); + if (cost != null) { + lastCost = cost; + } + } catch { + console.warn("Malformed JSON chunk:", data); + } + }, + }); + + const reader = toLog.getReader(); + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + parser.feed(decoder.decode(value, { stream: true })); + } + + if (lastCost != null) { + await recordBilling(c.env, db, { + organizationId: organizationID, + userId: c.get("user_id"), + cost: lastCost, + }); + } else { + console.warn( + "LLM cost not available. The user will not be billed for this request." + ); + } + } catch (err) { + console.error("Failed to parse SSE for cost:", err); + } + })(); + + // For streaming responses, determine content type from upstream + const streamingHeaders = createResponseHeaders( + upstream.headers.get("content-type") ?? "text/event-stream" + ); + streamingHeaders.set("cache-control", "no-cache"); + + return new Response(toClient, { + status: upstream.status, + headers: streamingHeaders, + }); + }); + + // POST /api/ai-gateway/v1/ai/language-model + // Language Model API endpoint (AI SDK v5 protocol) + server.post("/v1/ai/language-model", async (c) => { + if (!c.env.AI_GATEWAY_API_KEY) { + console.error("AI_GATEWAY_API_KEY is not set"); + return c.json({ error: "Service unavailable" }, 503); + } + + try { + // This is GIGA JANK to allow users to unauthenticated + // use our model gateway right now. This is *just* + // to allow the Cloudflare team to test the CLI/Edit mode + // without needing auth. + await withToolsAuth()(c as any, async () => {}); + } catch (err) { + // + } + + // @ts-expect-error + const agentID = c.get("agent_id")! as string | undefined; + // @ts-expect-error + const userID = c.get("user_id")! as string | undefined; + + let organizationID: string | undefined; + const db = await c.env.database(); + if (agentID) { + const agent = await db.selectAgentByID(agentID); + if (agent) { + organizationID = agent.organization_id; + } + } else { + if (userID) { + const user = await db.selectUserByID(userID); + if (user) { + organizationID = user.organization_id; + } + } + } + + if (!organizationID) { + organizationID = "9d2cef66-36eb-4a32-bd83-e5aca9f993ee"; + + // TODO: Remove this once we open auth. + // return c.json({ error: "Organization not found" }, 404); + } + + let payload: unknown; + try { + payload = await c.req.json(); + } catch { + return c.json({ error: "Invalid payload" }, 400); + } + + // Extract headers for the language model API + const modelId = c.req.header("ai-language-model-id"); + const streaming = c.req.header("ai-language-model-streaming") === "true"; + const specVersion = c.req.header("ai-language-model-specification-version"); + const authMethod = c.req.header("ai-gateway-auth-method"); + const protocolVersion = c.req.header("ai-gateway-protocol-version"); + + // Forward headers to Vercel AI Gateway + const upstreamHeaders: Record = { + "content-type": "application/json", + authorization: `Bearer ${c.env.AI_GATEWAY_API_KEY}`, + }; + + if (modelId) upstreamHeaders["ai-language-model-id"] = modelId; + if (specVersion) + upstreamHeaders["ai-language-model-specification-version"] = specVersion; + if (authMethod) upstreamHeaders["ai-gateway-auth-method"] = authMethod; + if (protocolVersion) + upstreamHeaders["ai-gateway-protocol-version"] = protocolVersion; + upstreamHeaders["ai-language-model-streaming"] = streaming + ? "true" + : "false"; + + if (modelId && modelId.startsWith("anthropic/")) { + // We automatically add caching for Anthropic models. + // It's only enabled if the user has no provider options set. + applyCachingForAnthropic(payload); + } + + const upstream = await fetch( + createGatewayUrl(["v1", "ai", "language-model"]), + { + method: "POST", + headers: upstreamHeaders, + body: JSON.stringify(payload), + } + ); + + // Non-streaming response + if (!streaming) { + const json = await upstream.json().catch(() => ({})); + const cost = extractCostFromNonStreamingResponse(json); + if (cost != null) { + await recordBilling(c.env, db, { + organizationId: organizationID, + userId: userID, + cost, + }); + } else { + console.warn( + "LLM cost not available. The user will not be billed for this request.", + json + ); + } + return new Response(JSON.stringify(json), { + status: upstream.status, + headers: createResponseHeaders("application/json"), + }); + } + + const body = upstream.body; + if (!body) { + return c.json({ error: "Upstream returned no body" }, 502); + } + + const [toClient, toLog] = body.tee(); + + (async () => { + try { + let lastCost: Money | undefined; + const decoder = new TextDecoder(); + const parser = createParser({ + onEvent: (evt: EventSourceMessage) => { + const data = evt.data; + if (!data || data === "[DONE]") { + return; + } + try { + const json = JSON.parse(data); + const cost = extractCostFromStreamingChunk(json); + if (cost != null) { + lastCost = cost; + } + } catch { + console.warn("Malformed JSON chunk:", data); + } + }, + }); + + const reader = toLog.getReader(); + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + parser.feed(decoder.decode(value, { stream: true })); + } + + if (lastCost != null) { + await recordBilling(c.env, db, { + organizationId: organizationID, + userId: userID, + cost: lastCost, + }); + } else { + console.warn( + "LLM cost not available. The user will not be billed for this request." + ); + } + } catch (err) { + console.error("Failed to parse SSE for cost:", err); + } + })(); + + // For streaming responses, determine content type from upstream + const streamingHeaders = createResponseHeaders( + upstream.headers.get("content-type") ?? "text/event-stream" + ); + streamingHeaders.set("cache-control", "no-cache"); + + return new Response(toClient, { + status: upstream.status, + headers: streamingHeaders, + }); + }); +} + +const applyCachingForAnthropic = (body: unknown) => { + if (!body || typeof body !== "object") { + return; + } + if (!("prompt" in body)) { + return; + } + if (!Array.isArray(body.prompt)) { + return; + } + const prompt = body.prompt; + let hasCaching = false; + let lastSystemMessage: any | undefined; + for (const message of prompt) { + if (!message || typeof message !== "object") { + return; + } + if (message.role === "system") { + lastSystemMessage = message; + } + if ( + "providerOptions" in message && + typeof message.providerOptions === "object" + ) { + if ( + "anthropic" in message.providerOptions && + typeof message.providerOptions.anthropic === "object" + ) { + if ( + "cacheControl" in message.providerOptions.anthropic && + typeof message.providerOptions.anthropic.cacheControl === "object" + ) { + hasCaching = true; + } + } + } + } + if (hasCaching) { + return; + } + + const applyCaching = (message: any) => { + if (typeof message !== "object") { + return; + } + const providerOptions = message.providerOptions ?? {}; + if (typeof providerOptions !== "object") { + return; + } + message.providerOptions = providerOptions; + const anthropic = providerOptions.anthropic ?? {}; + if (typeof anthropic !== "object") { + return; + } + providerOptions.anthropic = anthropic; + const cacheControl = anthropic.cacheControl ?? {}; + if (typeof cacheControl !== "object") { + return; + } + anthropic.cacheControl = cacheControl; + cacheControl.type = "ephemeral"; + }; + + // We cache the last system message, and the last user message. + if (lastSystemMessage) { + applyCaching(lastSystemMessage); + } + const lastMessage = prompt[prompt.length - 1]; + if (lastMessage) { + applyCaching(lastMessage); + } +}; diff --git a/packages/api/src/routes/ai-gateway.test-data.ts b/packages/api/src/routes/ai-gateway.test-data.ts new file mode 100644 index 0000000..8dedf68 --- /dev/null +++ b/packages/api/src/routes/ai-gateway.test-data.ts @@ -0,0 +1,501 @@ +/** + * Mock response from the AI Gateway API for language model endpoint (streaming). + * Based on the AI SDK v5 language model protocol. + */ +export const mockLanguageModelStreamResponse = [ + { + type: "stream-start", + warnings: [], + }, + { + type: "response-metadata", + id: "msg_01ABC123", + modelId: "claude-sonnet-4-5-20250929", + }, + { + type: "text-delta", + delta: "Crimson", + }, + { + type: "text-delta", + delta: " leaves", + }, + { + type: "text-delta", + delta: " drift", + }, + { + type: "text-delta", + delta: " down", + }, + { + type: "finish", + finishReason: "stop", + usage: { + inputTokens: 20, + outputTokens: 15, + totalTokens: 35, + }, + providerMetadata: { + anthropic: { + usage: { + input_tokens: 20, + output_tokens: 15, + }, + }, + gateway: { + cost: "0.00123456", + generationId: "gen_test123", + }, + }, + }, +]; + +/** + * Mock response from the AI Gateway API for language model endpoint (non-streaming). + */ +export const mockLanguageModelNonStreamResponse = { + type: "finish", + finishReason: "stop", + text: "Crimson leaves drift down", + usage: { + inputTokens: 20, + outputTokens: 15, + totalTokens: 35, + }, + providerMetadata: { + anthropic: { + usage: { + input_tokens: 20, + output_tokens: 15, + }, + }, + gateway: { + cost: "0.00098765", + generationId: "gen_test456", + }, + }, +}; + +/** + * Mock response from the AI Gateway API. Obtained from: + * ```sh + * curl -N -i -sS \ + * -X POST 'https://ai-gateway.vercel.sh/v1/chat/completions' \ + * -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \ + * -H 'Content-Type: application/json' \ + * -d '{ + * "model": "openai/gpt-5-nano", + * "messages": [{"role":"user","content":"Write a one-sentence haiku about autumn leaves."}], + * "stream": true + * }' + * ``` + */ +export const mockStreamResponse = [ + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { role: "assistant" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: "Leaves" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " drift" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " through" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " autumn" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: "," }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " amber" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " and" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " gold" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " fill" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " the" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " air" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: "," }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " crisp" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " beneath" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " gold" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: " light" }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { content: "." }, + logprobs: null, + finish_reason: null, + }, + ], + system_fingerprint: "fp_fgxl45222n", + }, + { + id: "chatcmpl-1757349644035-l8a72s26lhk", + object: "chat.completion.chunk", + created: 1757349644, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + delta: { + provider_metadata: { + openai: { + responseId: + "resp_68bf070bd8c8819682f47993ab757cb40e98feaec1cde277", + serviceTier: "default", + }, + gateway: { + routing: { + originalModelId: "openai/gpt-5-nano", + resolvedProvider: "openai", + resolvedProviderApiModelId: "gpt-5-nano-2025-08-07", + internalResolvedModelId: "openai:gpt-5-nano-2025-08-07", + fallbacksAvailable: [], + internalReasoning: + "Selected openai as preferred provider for gpt-5-nano. 0 fallback(s) available: ", + planningReasoning: + "System credentials planned for: openai. Total execution order: openai(system)", + canonicalSlug: "openai/gpt-5-nano", + finalProvider: "openai", + attempts: [ + { + provider: "openai", + internalModelId: "openai:gpt-5-nano-2025-08-07", + providerApiModelId: "gpt-5-nano-2025-08-07", + credentialType: "system", + success: true, + startTime: 142645.133868, + endTime: 142895.83524, + }, + ], + }, + cost: "0.00154605", + }, + }, + }, + logprobs: null, + finish_reason: "stop", + }, + ], + usage: { + prompt_tokens: 17, + completion_tokens: 1943, + total_tokens: 1960, + prompt_tokens_details: { cached_tokens: 0 }, + completion_tokens_details: { reasoning_tokens: 1920 }, + cache_creation_input_tokens: 0, + cost: 0.00154605, + is_byok: false, + }, + system_fingerprint: "fp_fgxl45222n", + }, +] as const; + +/** + * Mock response from the AI Gateway API. Obtained from: + * ```sh + * curl -N -i -sS \ + * -X POST 'https://ai-gateway.vercel.sh/v1/chat/completions' \ + * -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \ + * -H 'Content-Type: application/json' \ + * -d '{ + * "model": "openai/gpt-5-nano", + * "messages": [{"role":"user","content":"Write a one-sentence haiku about autumn leaves."}] + * }' + * ``` + */ +export const mockNonStreamingResponse = { + id: "chatcmpl-1757351529366-xulgpen3xnd", + object: "chat.completion", + created: 1757351529, + model: "openai/gpt-5-nano", + choices: [ + { + index: 0, + message: { + role: "assistant", + content: + "Crimson leaves drift down, through the chilly autumn air, in quiet gold light.", + provider_metadata: { + openai: { + responseId: "resp_68bf0e605c44819cb5dd6c3c3171c66b0f806517e2ece3e9", + serviceTier: "default", + }, + gateway: { + routing: { + originalModelId: "openai/gpt-5-nano", + resolvedProvider: "openai", + resolvedProviderApiModelId: "gpt-5-nano-2025-08-07", + internalResolvedModelId: "openai:gpt-5-nano-2025-08-07", + fallbacksAvailable: [], + internalReasoning: + "Selected openai as preferred provider for gpt-5-nano. 0 fallback(s) available: ", + planningReasoning: + "System credentials planned for: openai. Total execution order: openai(system)", + canonicalSlug: "openai/gpt-5-nano", + finalProvider: "openai", + attempts: [ + { + provider: "openai", + internalModelId: "openai:gpt-5-nano-2025-08-07", + providerApiModelId: "gpt-5-nano-2025-08-07", + credentialType: "system", + success: true, + startTime: 355212.035928, + endTime: 364268.242051, + }, + ], + }, + cost: "0.00103405", + }, + }, + }, + logprobs: null, + finish_reason: "stop", + }, + ], + usage: { + prompt_tokens: 17, + completion_tokens: 1303, + total_tokens: 1320, + prompt_tokens_details: { cached_tokens: 0 }, + completion_tokens_details: { reasoning_tokens: 1280 }, + cache_creation_input_tokens: 0, + cost: 0.00103405, + is_byok: false, + }, + system_fingerprint: "fp_n2s0rii0gn", +} as const; diff --git a/packages/api/src/routes/api-keys.server.ts b/packages/api/src/routes/api-keys.server.ts new file mode 100644 index 0000000..e1b27dd --- /dev/null +++ b/packages/api/src/routes/api-keys.server.ts @@ -0,0 +1,159 @@ +const KEY_CHARS = + "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +const API_KEY_PREFIX = "bk"; + +async function randomFromAlphabet( + alphabet: string, + len: number +): Promise { + const { randomInt } = await import("node:crypto"); + if (alphabet.length < 2) { + throw new Error("Alphabet too small"); + } + const out: string[] = []; + for (let i = 0; i < len; i++) { + const j = randomInt(0, alphabet.length); // [0, n) + out.push(alphabet[j] as string); + } + return out.join(""); +} + +async function hmacHexSHA256( + keySecret: string, + pepper: string +): Promise { + const { webcrypto } = await import("node:crypto"); + const key = await webcrypto.subtle.importKey( + "raw", + new TextEncoder().encode(keySecret), + { name: "HMAC", hash: { name: "SHA-256" } }, + false, + ["sign"] + ); + const signature = await webcrypto.subtle.sign( + "HMAC", + key, + new TextEncoder().encode(pepper) + ); + return Buffer.from(signature).toString("hex"); +} + +const PEPPER_CACHE = new Map(); + +async function derivePepper(rootSecret: string): Promise { + // in API key authentication, the root secret is usually the AUTH_SECRET environment variable, + // so it stays constant for the lifetime of the application. we cache the pepper + // to avoid re-deriving it for each API key. + const cached = PEPPER_CACHE.get(rootSecret); + if (cached) { + return cached; + } + if (PEPPER_CACHE.size >= 128) { + const aKey = PEPPER_CACHE.keys().next().value!; + if (!aKey) { + throw new Error("No key to delete"); + } + PEPPER_CACHE.delete(aKey); + } + const { webcrypto } = await import("node:crypto"); + const rootKey = await webcrypto.subtle.importKey( + "raw", + new TextEncoder().encode(rootSecret), + { name: "HKDF" }, + false, + ["deriveBits", "deriveKey"] + ); + const params = { + name: "HKDF", + hash: "SHA-256", + salt: new TextEncoder().encode("pepper"), + info: new TextEncoder().encode("pepper"), + }; + // derive 256 bits (32 bytes) + const bits = await webcrypto.subtle.deriveBits(params, rootKey, 256); + return Buffer.from(bits).toString("hex"); +} + +export function parseApiKey( + key: string +): + | { prefix: string; lookup: string; secret: string; error?: undefined } + | { error: string } { + const [prefix, lookup, secret] = key.split("_"); + if (!prefix || !lookup || !secret) { + return { error: "Invalid API key" }; + } + if (prefix !== API_KEY_PREFIX) { + return { error: "Invalid API key prefix" }; + } + return { prefix, lookup, secret }; +} + +function constructApiKeyString(args: { + prefix: string; + lookup: string; + secret: string; +}): string { + return `${args.prefix}_${args.lookup}_${args.secret}`; +} + +/** + * Generates a new API key in format: `bk__` + * + * Returns the full key to show the user once, plus a hash to store in the database. + * The hash is derived via HMAC-SHA256(keySecret, pepper) where pepper is derived from rootSecret. + * + * - lookup: 12-char identifier for fast DB retrieval + * - secret: 32-char secret the user keeps (never store this) + * - hash: what you store in DB for verification + * + * The pepper system means an attacker needs both the database AND the rootSecret to verify keys, + * making it more secure than a simple hash. + */ +export async function newApiKeyString(rootSecret: string): Promise<{ + lookup: string; + secret: string; + prefix: string; + hash: string; + fullKey: string; +}> { + // a pepper is a random string deterministically derived from the root secret + const pepper = await derivePepper(rootSecret); + const lookup = await randomFromAlphabet(KEY_CHARS, 12); + const keySecret = await randomFromAlphabet(KEY_CHARS, 32); + // a key hash is the signature obtained by signing the pepper with the key secret using HMAC-SHA256 + const keyHash = await hmacHexSHA256(keySecret, pepper); + return { + lookup, + secret: keySecret, + prefix: API_KEY_PREFIX, + hash: keyHash, + fullKey: constructApiKeyString({ + prefix: API_KEY_PREFIX, + lookup, + secret: keySecret, + }), + }; +} + +/** + * Verifies an API key by comparing the stored hash against a freshly computed one. + * + * Re-derives the pepper from rootSecret, computes HMAC-SHA256(keySecret, pepper), + * and performs a timing-safe comparison to prevent side-channel attacks. + */ +export async function verifyApiKeyString(args: { + rootSecret: string; + keySecret: string; + hash: string; +}): Promise { + const { rootSecret, keySecret, hash } = args; + const pepper = await derivePepper(rootSecret); + const keyHash = await hmacHexSHA256(keySecret, pepper); + + const { timingSafeEqual } = await import("node:crypto"); + const isValid = + keyHash.length === hash.length && + timingSafeEqual(Buffer.from(keyHash), Buffer.from(hash)); + return isValid; +} diff --git a/packages/api/src/routes/api-keys.test.ts b/packages/api/src/routes/api-keys.test.ts new file mode 100644 index 0000000..483aa6e --- /dev/null +++ b/packages/api/src/routes/api-keys.test.ts @@ -0,0 +1,52 @@ +import { expect, test } from "bun:test"; +import { + newApiKeyString, + parseApiKey, + verifyApiKeyString, +} from "./api-keys.server"; + +test("newApiKeyString", async () => { + const rootSecret = "test-root-secret"; + const { lookup, secret, prefix, hash, fullKey } = + await newApiKeyString(rootSecret); + expect(lookup).toBeDefined(); + expect(secret).toBeDefined(); + expect(prefix).toBe("bk"); + expect(hash).toBeDefined(); + expect(fullKey).toBeDefined(); + // bk__ + expect(fullKey.length).toBe(2 + 1 + 12 + 1 + 32); +}); + +test("verifyApiKeyString", async () => { + const rootSecret = "test-root-secret"; + const key = "bk_6ZdOMx6Z7W2n_0KICJOuLfiq4ftiYmOg9bl3BxSpnpX2Z"; + const hash = + "1710fb0c40fa96d679db8ba59851b9451d5a075af0a275735b2043ab177fd9ae"; + const parsed = parseApiKey(key); + if (parsed.error !== undefined) { + throw new Error("this should never happen"); + } + const verified = await verifyApiKeyString({ + rootSecret, + keySecret: parsed.secret, + hash, + }); + expect(verified).toBe(true); + + expect( + await verifyApiKeyString({ + rootSecret, + keySecret: parsed.secret + "x", + hash, + }) + ).toBe(false); + + expect( + await verifyApiKeyString({ + rootSecret, + keySecret: parsed.secret, + hash: hash + "x", + }) + ).toBe(false); +}); diff --git a/packages/api/src/routes/auth/auth.client.ts b/packages/api/src/routes/auth/auth.client.ts new file mode 100644 index 0000000..f92d1ff --- /dev/null +++ b/packages/api/src/routes/auth/auth.client.ts @@ -0,0 +1,343 @@ +import { z } from "zod"; +import { assertResponseStatus } from "../../client-helper"; +import Client from "../../client.browser"; + +/** + * Cookie name for the session token. + * Always use the same cookie name regardless of environment. + */ +export const SESSION_COOKIE_NAME = "blink_session_token"; + +/** + * Secure flag for session cookies. + * Set to false for now to allow development over HTTP. + */ +export const SESSION_SECURE = false; + +export const schemaSignInWithCredentialsRequest = z.object({ + email: z.string().email(), + password: z.string().min(8), +}); + +export const schemaSignInWithCredentialsResponse = z.object({ + ok: z.boolean(), + url: z.string(), +}); + +export const schemaVerifyEmailRequest = z.object({ + code: z.string(), +}); + +export const schemaVerifyEmailResponse = z.object({ + ok: z.boolean(), +}); + +export const schemaResetPasswordRequest = z.object({ + password: z.string().min(8), +}); + +export const schemaResetPasswordResponse = z.object({ + ok: z.boolean(), +}); + +export const schemaRequestEmailChangeRequest = z.object({ + currentPassword: z.string(), + newEmail: z.string().email(), +}); + +export const schemaRequestEmailChangeResponse = z.object({ + ok: z.boolean(), +}); + +export const schemaVerifyEmailChangeRequest = z.object({ + code: z.string(), +}); + +export const schemaVerifyEmailChangeResponse = z.object({ + ok: z.boolean(), +}); + +export const schemaSignupRequest = z.object({ + email: z.string().email("Invalid email address"), + password: z.string().min(8, "Password must be at least 8 characters"), + redirect: z.string().optional(), +}); + +export const schemaSignupResponse = z.object({ + ok: z.boolean(), + redirect_url: z.string(), +}); + +export const schemaResendEmailVerificationResponse = z.object({ + ok: z.boolean(), +}); + +export const schemaRequestPasswordResetRequest = z.object({ + email: z.string().email(), +}); + +export const schemaRequestPasswordResetResponse = z.object({ + ok: z.boolean(), + redirect_url: z.string(), +}); + +export const schemaResendPasswordResetResponse = z.object({ + ok: z.boolean(), +}); + +export type SignInWithCredentialsRequest = z.infer< + typeof schemaSignInWithCredentialsRequest +>; +export type SignInWithCredentialsResponse = z.infer< + typeof schemaSignInWithCredentialsResponse +>; +export type VerifyEmailRequest = z.infer; +export type VerifyEmailResponse = z.infer; +export type ResetPasswordRequest = z.infer; +export type ResetPasswordResponse = z.infer; +export type RequestEmailChangeRequest = z.infer< + typeof schemaRequestEmailChangeRequest +>; +export type RequestEmailChangeResponse = z.infer< + typeof schemaRequestEmailChangeResponse +>; +export type VerifyEmailChangeRequest = z.infer< + typeof schemaVerifyEmailChangeRequest +>; +export type VerifyEmailChangeResponse = z.infer< + typeof schemaVerifyEmailChangeResponse +>; +export type SignupRequest = z.infer; +export type SignupResponse = z.infer; +export type ResendEmailVerificationResponse = z.infer< + typeof schemaResendEmailVerificationResponse +>; +export type RequestPasswordResetRequest = z.infer< + typeof schemaRequestPasswordResetRequest +>; +export type RequestPasswordResetResponse = z.infer< + typeof schemaRequestPasswordResetResponse +>; +export type ResendPasswordResetResponse = z.infer< + typeof schemaResendPasswordResetResponse +>; + +export default class Auth { + private readonly client: Client; + private readonly baseURL: URL; + + public constructor(client: Client, baseURL: URL) { + this.client = client; + this.baseURL = baseURL; + } + + /** + * token returns a JWT token for the current user. + * + * @param cb - Callback to receive the URL to authenticate with. + * @param options - Options for the token request. + * @returns A promise that resolves to a JWT token. + */ + public async token( + cb: (url: string, id: string) => void, + options: { + timeout: number; + } = { + timeout: 120_000, + } + ) { + // Open a WebSocket connection to the server with an ID. + // Client resolves token with a JWT. + return new Promise((resolve, reject) => { + const id = crypto.randomUUID(); + const ws = this.client.websocket(`/api/auth/token?id=${id}`); + const url = new URL(`/auth?id=${id}`, this.baseURL); + const timeout = setTimeout(() => { + reject(new Error("Timeout waiting for the user to authenticate")); + }, options.timeout); + ws.onerror = (event) => { + clearTimeout(timeout); + console.log("error", event); + reject(new Error("Failed to connect to server")); + }; + ws.onopen = () => { + cb(url.toString(), id); + }; + ws.onmessage = (event) => { + if (typeof event.data !== "string") { + return; + } + clearTimeout(timeout); + resolve(event.data); + }; + }); + } + + /** + * signInWithCredentials signs in a user with email and password. + * + * @param request - The signin request. + * @returns A promise that resolves to the login response. + */ + public async signInWithCredentials( + request: SignInWithCredentialsRequest + ): Promise { + const response = await this.client.request( + "POST", + "/api/auth/signin/credentials", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * verifyEmail verifies a user's email address with a verification code. + * The verification token is read from the httpOnly cookie on the server. + * + * @param request - The verification request. + * @returns A promise that resolves to the verification response. + */ + public async verifyEmail( + request: VerifyEmailRequest + ): Promise { + const response = await this.client.request( + "POST", + "/api/auth/verify-email", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * resetPassword resets the user's password using the verified token from the cookie. + * + * @param request - The password reset request. + * @returns A promise that resolves to the reset response. + */ + public async resetPassword( + request: ResetPasswordRequest + ): Promise { + const response = await this.client.request( + "POST", + "/api/auth/reset-password", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * requestEmailChange requests a change of the user's email address. + * Requires authentication - user ID is taken from the session. + * + * @param request - The email change request. + * @returns A promise that resolves to the request response. + */ + public async requestEmailChange( + request: RequestEmailChangeRequest + ): Promise { + const response = await this.client.request( + "POST", + "/api/auth/request-email-change", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * verifyEmailChange verifies the email change with a verification code. + * Requires authentication - user ID is taken from the session. + * + * @param request - The email change verification request. + * @returns A promise that resolves to the verification response. + */ + public async verifyEmailChange( + request: VerifyEmailChangeRequest + ): Promise { + const response = await this.client.request( + "POST", + "/api/auth/verify-email-change", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * signup creates a new user account with email and password. + * + * @param request - The signup request. + * @returns A promise that resolves to the signup response with redirect URL. + */ + public async signup(request: SignupRequest): Promise { + const response = await this.client.request( + "POST", + "/api/auth/signup", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * resendEmailVerification resends the email verification code. + * The verification token is read from the httpOnly cookie on the server. + * + * @returns A promise that resolves to the response. + */ + public async resendEmailVerification(): Promise { + const response = await this.client.request( + "POST", + "/api/auth/resend-email-verification", + "" + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * requestPasswordReset initiates a password reset flow. + * + * @param request - The password reset request. + * @returns A promise that resolves to the response with redirect URL. + */ + public async requestPasswordReset( + request: RequestPasswordResetRequest + ): Promise { + const response = await this.client.request( + "POST", + "/api/auth/request-password-reset", + JSON.stringify(request) + ); + + await assertResponseStatus(response, 200); + return response.json(); + } + + /** + * resendPasswordReset resends the password reset code. + * The reset token is read from the httpOnly cookie on the server. + * + * @returns A promise that resolves to the response. + */ + public async resendPasswordReset(): Promise { + const response = await this.client.request( + "POST", + "/api/auth/resend-password-reset", + "" + ); + + await assertResponseStatus(response, 200); + return response.json(); + } +} diff --git a/packages/api/src/routes/auth/auth.server.test.ts b/packages/api/src/routes/auth/auth.server.test.ts new file mode 100644 index 0000000..817746a --- /dev/null +++ b/packages/api/src/routes/auth/auth.server.test.ts @@ -0,0 +1,1034 @@ +import { hash } from "bcrypt-ts"; +import { afterEach, beforeEach, expect, test } from "bun:test"; +import { http, HttpResponse } from "msw"; +import { setupServer, SetupServerApi } from "msw/node"; +import { serve } from "../../test"; + +// Mock OAuth provider responses +const mockGitHubProfile = { + id: 123456, + email: "github@example.com", + name: "GitHub User", + login: "githubuser", + avatar_url: "https://github.com/avatar.jpg", +}; + +const mockGoogleProfile = { + id: "google-id-123", + email: "google@example.com", + name: "Google User", + picture: "https://google.com/avatar.jpg", +}; + +const mockOAuthTokenResponse = { + access_token: "mock-access-token", + token_type: "Bearer", + expires_in: 3600, + refresh_token: "mock-refresh-token", + scope: "user:email", +}; + +test("GET /csrf returns CSRF token", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/csrf`); + expect(res.status).toBe(200); + + const data = await res.json(); + expect(data.csrfToken).toBeString(); + expect(data.csrfToken.length).toBeGreaterThan(0); +}); + +test("GET /providers returns available providers", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/providers`); + expect(res.status).toBe(200); + + const data = await res.json(); + expect(data.credentials).toEqual({ + id: "credentials", + name: "Credentials", + type: "credentials", + }); + expect(data.github).toEqual({ + id: "github", + name: "GitHub", + type: "oauth", + }); + expect(data.google).toEqual({ + id: "google", + name: "Google", + type: "oauth", + }); +}); + +test("GET /session returns empty when no session", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/session`); + expect(res.status).toBe(200); + + const data = await res.json(); + expect(data).toEqual({}); +}); + +test("GET /session returns user data with valid session", async () => { + const { helpers, bindings, url } = await serve(); + const { user } = await helpers.createUser({ + email: "test@example.com", + display_name: "Test User", + }); + + // Create session token + const { encode } = await import("next-auth/jwt"); + const token = await encode({ + secret: bindings.AUTH_SECRET, + salt: "blink_session_token", + token: { + sub: user.id, + id: user.id, + email: user.email, + name: user.display_name, + avatar_url: null, + organization_id: user.organization_id, + }, + }); + + const res = await fetch(`${url}/api/auth/session`, { + headers: { + Cookie: `blink_session_token=${token}`, + }, + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.user).toBeDefined(); + expect(data.user.id).toBe(user.id); + expect(data.user.email).toBe(user.email); + expect(data.user.name).toBe(user.display_name); + expect(data.expires).toBeString(); +}); + +test("POST /signin/credentials with valid credentials", async () => { + const { helpers, url, bindings } = await serve(); + const password = "password123"; + const hashedPassword = await hash(password, 10); + + const db = await bindings.database(); + const { user } = await helpers.createUser({ + email: "login@example.com", + display_name: "Login User", + }); + + // Set password and verify email + await db.updateUserByID({ + id: user.id, + password: hashedPassword, + email_verified: new Date(), + }); + + const res = await fetch(`${url}/api/auth/signin/credentials`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: "login@example.com", + password, + }), + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + expect(data.url).toBe("/chat"); + + // Check cookies - note: Response.headers.getSetCookie() returns all Set-Cookie headers + const cookies = res.headers.getSetCookie?.() || [ + res.headers.get("Set-Cookie") || "", + ]; + const cookieString = cookies.join("; "); + expect(cookieString).toContain("blink_session_token="); + expect(cookieString).toContain("last_login_provider=credentials"); +}); + +test("POST /signin/credentials with invalid password", async () => { + const { helpers, url, bindings } = await serve(); + const hashedPassword = await hash("correctpassword", 10); + + const db = await bindings.database(); + const { user } = await helpers.createUser({ + email: "wrong@example.com", + }); + + await db.updateUserByID({ + id: user.id, + password: hashedPassword, + email_verified: new Date(), + }); + + const res = await fetch(`${url}/api/auth/signin/credentials`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: "wrong@example.com", + password: "wrongpassword", + }), + }); + + expect(res.status).toBe(401); + const data = await res.json(); + expect(data.error).toBe("Invalid credentials"); +}); + +test("POST /signin/credentials with unverified email", async () => { + const { helpers, url, bindings } = await serve(); + const password = "password123"; + const hashedPassword = await hash(password, 10); + + const db = await bindings.database(); + const { user } = await helpers.createUser({ + email: "unverified@example.com", + }); + + await db.updateUserByID({ + id: user.id, + password: hashedPassword, + email_verified: null, // Not verified + }); + + const res = await fetch(`${url}/api/auth/signin/credentials`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: "unverified@example.com", + password, + }), + }); + + expect(res.status).toBe(401); + const data = await res.json(); + expect(data.error).toBe("Email not verified"); +}); + +test("POST /signin/credentials with non-existent user", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/signin/credentials`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: "nonexistent@example.com", + password: "password123", + }), + }); + + expect(res.status).toBe(401); + const data = await res.json(); + expect(data.error).toBe("Invalid credentials"); +}); + +test("POST /signin/credentials with missing fields", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/signin/credentials`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: "test@example.com", + // Missing password + }), + }); + + expect(res.status).toBe(400); +}); + +test("POST /signout clears session cookie", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/signout`, { + method: "POST", + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + + const cookies = res.headers.get("Set-Cookie"); + expect(cookies).toContain("blink_session_token="); + expect(cookies).toContain("Max-Age=0"); +}); + +test("GET /signin/github redirects to GitHub OAuth", async () => { + const { url, bindings } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-github-client-id", + GITHUB_CLIENT_SECRET: "test-github-client-secret", + }, + }); + + const res = await fetch(`${url}/api/auth/signin/github`, { + redirect: "manual", + }); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toStartWith("https://github.com/login/oauth/authorize"); + expect(location).toContain("client_id=test-github-client-id"); + expect(location).toContain("scope=user%3Aemail"); + expect(location).toContain("state="); + expect(location).toContain("response_type=code"); +}); + +test("GET /signin/google redirects to Google OAuth", async () => { + const { url } = await serve({ + bindings: { + GOOGLE_CLIENT_ID: "test-google-client-id", + GOOGLE_CLIENT_SECRET: "test-google-client-secret", + }, + }); + + const res = await fetch(`${url}/api/auth/signin/google`, { + redirect: "manual", + }); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toStartWith("https://accounts.google.com/o/oauth2/v2/auth"); + expect(location).toContain("client_id=test-google-client-id"); + expect(location).toContain("scope=openid+email+profile"); + expect(location).toContain("access_type=offline"); + expect(location).toContain("prompt=consent"); +}); + +test("GET /signin/unknown-provider returns 404", async () => { + const { url } = await serve(); + const res = await fetch(`${url}/api/auth/signin/unknown`); + expect(res.status).toBe(404); + // 404 response from Hono - route doesn't exist +}); + +test("GET /callback/github with missing code returns error", async () => { + const { url, bindings } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-client-id", + GITHUB_CLIENT_SECRET: "test-client-secret", + }, + }); + + // Generate valid state + const { encode } = await import("next-auth/jwt"); + const state = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "github", + nonce: "test-nonce", + callbackUrl: `${url}/api/auth/callback/github`, + }, + }); + + const res = await fetch(`${url}/api/auth/callback/github?state=${state}`, { + redirect: "manual", + }); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toContain("/login?error=missing_params"); +}); + +test("GET /callback/github with invalid state returns error", async () => { + const { url } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-client-id", + GITHUB_CLIENT_SECRET: "test-client-secret", + }, + }); + + const res = await fetch( + `${url}/api/auth/callback/github?code=test-code&state=invalid-state`, + { + redirect: "manual", + } + ); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toContain("/login?error=invalid_state"); +}); + +// OAuth Integration Tests with MSW +let mswServer: SetupServerApi; + +beforeEach(() => { + mswServer = setupServer(); + mswServer.listen({ + onUnhandledRequest: "bypass", + }); +}); + +afterEach(() => { + if (mswServer) { + mswServer.close(); + } +}); + +test("GET /callback/github creates new user on successful OAuth", async () => { + const { url, bindings } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-client-id", + GITHUB_CLIENT_SECRET: "test-client-secret", + }, + }); + + // Mock GitHub OAuth token exchange + mswServer.use( + http.post("https://github.com/login/oauth/access_token", () => { + return HttpResponse.json(mockOAuthTokenResponse); + }), + http.get("https://api.github.com/user", () => { + return HttpResponse.json(mockGitHubProfile); + }) + ); + + const { encode } = await import("next-auth/jwt"); + const state = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "github", + nonce: "test-nonce", + callbackUrl: `${url}/api/auth/callback/github`, + }, + }); + + const res = await fetch( + `${url}/api/auth/callback/github?code=test-code&state=${state}`, + { + redirect: "manual", + } + ); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toBe("/chat"); + + // Verify cookies were set + const cookies = res.headers.getSetCookie?.() || [ + res.headers.get("Set-Cookie") || "", + ]; + const cookieString = cookies.join("; "); + expect(cookieString).toContain("blink_session_token="); + expect(cookieString).toContain("last_login_provider=github"); + + // Verify user was created in database + const db = await bindings.database(); + const user = await db.selectUserByEmail(mockGitHubProfile.email); + expect(user).toBeDefined(); + expect(user!.email).toBe(mockGitHubProfile.email); + expect(user!.display_name).toBe(mockGitHubProfile.name); + + // Verify OAuth account was linked + const accountResult = await db.selectUserAccountByProviderAccountID( + "github", + mockGitHubProfile.id.toString() + ); + expect(accountResult).toBeDefined(); + expect(accountResult!.user_account.user_id).toBe(user!.id); + expect(accountResult!.user_account.provider).toBe("github"); + expect(accountResult!.user_account.access_token).toBe( + mockOAuthTokenResponse.access_token + ); +}); + +test("GET /callback/google creates new user on successful OAuth", async () => { + const { url, bindings } = await serve({ + bindings: { + GOOGLE_CLIENT_ID: "test-google-client-id", + GOOGLE_CLIENT_SECRET: "test-google-client-secret", + }, + }); + + // Mock Google OAuth token exchange + mswServer.use( + http.post("https://oauth2.googleapis.com/token", () => { + return HttpResponse.json(mockOAuthTokenResponse); + }), + http.get("https://www.googleapis.com/oauth2/v2/userinfo", () => { + return HttpResponse.json(mockGoogleProfile); + }) + ); + + const { encode } = await import("next-auth/jwt"); + const state = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "google", + nonce: "test-nonce", + callbackUrl: `${url}/api/auth/callback/google`, + }, + }); + + const res = await fetch( + `${url}/api/auth/callback/google?code=test-code&state=${state}`, + { + redirect: "manual", + } + ); + + expect(res.status).toBe(302); + expect(res.headers.get("Location")).toBe("/chat"); + + const db = await bindings.database(); + const user = await db.selectUserByEmail(mockGoogleProfile.email); + expect(user).toBeDefined(); + expect(user!.email).toBe(mockGoogleProfile.email); + expect(user!.display_name).toBe(mockGoogleProfile.name); + + const accountResult = await db.selectUserAccountByProviderAccountID( + "google", + mockGoogleProfile.id + ); + expect(accountResult).toBeDefined(); + expect(accountResult!.user_account.provider).toBe("google"); +}); + +test("GET /callback/github returns existing OAuth user on repeat login", async () => { + const { url, bindings } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-client-id", + GITHUB_CLIENT_SECRET: "test-client-secret", + }, + }); + + mswServer.use( + http.post("https://github.com/login/oauth/access_token", () => { + return HttpResponse.json(mockOAuthTokenResponse); + }), + http.get("https://api.github.com/user", () => { + return HttpResponse.json(mockGitHubProfile); + }) + ); + + const { encode } = await import("next-auth/jwt"); + const state = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "github", + nonce: "test-nonce", + callbackUrl: `${url}/api/auth/callback/github`, + }, + }); + + // First login - creates user + await fetch(`${url}/api/auth/callback/github?code=test-code&state=${state}`, { + redirect: "manual", + }); + + const db = await bindings.database(); + const firstUser = await db.selectUserByEmail(mockGitHubProfile.email); + expect(firstUser).toBeDefined(); + + // Generate new state for second login + const state2 = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "github", + nonce: "test-nonce-2", + callbackUrl: `${url}/api/auth/callback/github`, + }, + }); + + // Second login - should return same user + const res2 = await fetch( + `${url}/api/auth/callback/github?code=test-code-2&state=${state2}`, + { + redirect: "manual", + } + ); + + expect(res2.status).toBe(302); + expect(res2.headers.get("Location")).toBe("/chat"); + + // Verify same user is returned + const secondUser = await db.selectUserByEmail(mockGitHubProfile.email); + expect(secondUser).toBeDefined(); + expect(secondUser!.id).toBe(firstUser!.id); +}); + +test("GET /callback/github with no access token returns error", async () => { + const { url, bindings } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-client-id", + GITHUB_CLIENT_SECRET: "test-client-secret", + }, + }); + + // Mock GitHub returning error instead of access token + mswServer.use( + http.post("https://github.com/login/oauth/access_token", () => { + return HttpResponse.json({ error: "access_denied" }); + }) + ); + + const { encode } = await import("next-auth/jwt"); + const state = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "github", + nonce: "test-nonce", + callbackUrl: `${url}/api/auth/callback/github`, + }, + }); + + const res = await fetch( + `${url}/api/auth/callback/github?code=test-code&state=${state}`, + { + redirect: "manual", + } + ); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toContain("/login?error=no_access_token"); +}); + +test("OAuth callback with wrong provider in state returns error", async () => { + const { url, bindings } = await serve({ + bindings: { + GITHUB_CLIENT_ID: "test-client-id", + GITHUB_CLIENT_SECRET: "test-client-secret", + }, + }); + + // Generate state for google but request github callback + const { encode } = await import("next-auth/jwt"); + const state = await encode({ + secret: bindings.AUTH_SECRET, + salt: "oauth-state", + token: { + provider: "google", // Wrong provider + nonce: "test-nonce", + callbackUrl: `${url}/api/auth/callback/google`, + }, + }); + + const res = await fetch( + `${url}/api/auth/callback/github?code=test-code&state=${state}`, + { + redirect: "manual", + } + ); + + expect(res.status).toBe(302); + const location = res.headers.get("Location"); + expect(location).toContain("/login?error=invalid_state"); +}); + +test("POST /verify-email with valid code verifies email and creates session", async () => { + const { url, helpers, bindings } = await serve(); + const hashedPassword = await hash("password123", 10); + + const db = await bindings.database(); + const { user } = await helpers.createUser({ + email: "verify@example.com", + email_verified: null, + }); + + // Update user with password + await db.updateUserByID({ + id: user.id, + password: hashedPassword, + }); + + // Create an email verification code + const code = "12345678"; + await db.insertEmailVerification({ + email: user.email!, + code, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + // Generate verification token and set it as a cookie + const { encode } = await import("next-auth/jwt"); + const token = await encode({ + secret: bindings.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email: user.email, + }, + }); + + const res = await fetch(`${url}/api/auth/verify-email`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Cookie: `email_verification_token=${token}`, + }, + body: JSON.stringify({ code }), + }); + + expect(res.status).toBe(200); + const data = (await res.json()) as { ok: boolean }; + expect(data.ok).toBe(true); + + // Verify session cookie was set + const cookies = res.headers.get("Set-Cookie"); + expect(cookies).toContain("blink_session_token"); + + // Verify user's email_verified was updated + const updatedUser = await db.selectUserByID(user.id); + expect(updatedUser?.email_verified).not.toBeNull(); + + // Verify the code was deleted by the API (trying to use it again should fail) + const secondAttempt = await fetch(`${url}/api/auth/verify-email`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Cookie: `email_verification_token=${token}`, + }, + body: JSON.stringify({ code }), + }); + expect(secondAttempt.status).toBe(401); +}); + +test("POST /verify-email with invalid code returns error", async () => { + const { url, helpers, bindings } = await serve(); + + const { user } = await helpers.createUser({ + email: "invalid@example.com", + email_verified: null, + }); + + // Generate verification token and set it as a cookie + const { encode } = await import("next-auth/jwt"); + const token = await encode({ + secret: bindings.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email: user.email, + }, + }); + + const res = await fetch(`${url}/api/auth/verify-email`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Cookie: `email_verification_token=${token}`, + }, + body: JSON.stringify({ code: "wrong-code" }), + }); + + expect(res.status).toBe(401); + const data = (await res.json()) as { error: string }; + expect(data.error).toBe("Invalid code"); +}); + +test("POST /signup creates user and returns redirect URL", async () => { + const { url, bindings } = await serve(); + const email = "newuser@example.com"; + const password = "securepassword123"; + + const res = await fetch(`${url}/api/auth/signup`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email, password }), + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + expect(data.redirect_url).toBe("/email-verification"); + + // Verify user was created + const db = await bindings.database(); + const user = await db.selectUserByEmail(email); + expect(user).toBeDefined(); + expect(user?.email).toBe(email); + expect(user?.password).toBeDefined(); + expect(user?.email_verified).toBeNull(); + + // Verify verification cookie was set + const cookies = res.headers.get("set-cookie"); + expect(cookies).toContain("email_verification_token"); + expect(cookies).toContain("HttpOnly"); + expect(cookies).toContain("SameSite=Lax"); +}); + +test("POST /signup with redirect returns custom redirect URL", async () => { + const { url } = await serve(); + const email = "redirect@example.com"; + const password = "securepassword123"; + const redirect = "/custom-path"; + + const res = await fetch(`${url}/api/auth/signup`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email, password, redirect }), + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.redirect_url).toBe( + `/email-verification?redirect=${encodeURIComponent(redirect)}` + ); +}); + +test("POST /signup rejects duplicate email", async () => { + const { url, helpers } = await serve(); + const email = "existing@example.com"; + + await helpers.createUser({ email }); + + const res = await fetch(`${url}/api/auth/signup`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email, password: "password123" }), + }); + + expect(res.status).toBe(400); + const data = await res.json(); + expect(data.error).toContain("already exists"); +}); + +test("POST /signup validates email format", async () => { + const { url } = await serve(); + + const res = await fetch(`${url}/api/auth/signup`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email: "invalid-email", password: "password123" }), + }); + + expect(res.status).toBe(400); +}); + +test("POST /signup validates password length", async () => { + const { url } = await serve(); + + const res = await fetch(`${url}/api/auth/signup`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email: "test@example.com", password: "short" }), + }); + + expect(res.status).toBe(400); +}); + +test("POST /resend-email-verification regenerates token", async () => { + const { url, helpers, bindings } = await serve(); + const { user } = await helpers.createUser({ + email: "verify@example.com", + email_verified: null, + }); + + const db = await bindings.database(); + + // Create initial verification code + const initialCode = "11111111"; + await db.insertEmailVerification({ + email: user.email!, + code: initialCode, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + // Generate initial verification token + const { encode } = await import("next-auth/jwt"); + const initialToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email: user.email, + }, + }); + + const res = await fetch(`${url}/api/auth/resend-email-verification`, { + method: "POST", + headers: { + Cookie: `email_verification_token=${initialToken}`, + }, + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + + // Verify new token was set in cookie + const cookies = res.headers.get("set-cookie"); + expect(cookies).toContain("email_verification_token"); + expect(cookies).toContain("HttpOnly"); +}); + +test("POST /resend-email-verification fails without cookie", async () => { + const { url } = await serve(); + + const res = await fetch(`${url}/api/auth/resend-email-verification`, { + method: "POST", + }); + + expect(res.status).toBe(400); + const data = await res.json(); + expect(data.error).toContain("No verification session"); +}); + +test("POST /request-password-reset creates reset token for existing user", async () => { + const { url, helpers, bindings } = await serve(); + const { user } = await helpers.createUser({ + email: "reset@example.com", + password: await hash("oldpassword", 12), + }); + + const res = await fetch(`${url}/api/auth/request-password-reset`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email: user.email }), + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + expect(data.redirect_url).toBe("/reset-password/verify"); + + // Verify cookie was set + const cookies = res.headers.get("set-cookie"); + expect(cookies).toContain("email_verification_token"); + expect(cookies).toContain("HttpOnly"); +}); + +test("POST /request-password-reset always returns success (no email enumeration)", async () => { + const { url } = await serve(); + const nonExistentEmail = "nonexistent@example.com"; + + const res = await fetch(`${url}/api/auth/request-password-reset`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email: nonExistentEmail }), + }); + + // Should return success even though user doesn't exist + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + expect(data.redirect_url).toBe("/reset-password/verify"); +}); + +test("POST /request-password-reset validates email format", async () => { + const { url } = await serve(); + + const res = await fetch(`${url}/api/auth/request-password-reset`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ email: "not-an-email" }), + }); + + expect(res.status).toBe(400); +}); + +test("POST /resend-password-reset regenerates reset token", async () => { + const { url, helpers, bindings } = await serve(); + const { user } = await helpers.createUser({ + email: "reset2@example.com", + password: await hash("password", 12), + }); + + const db = await bindings.database(); + + // Create initial reset code + const initialCode = "99999999"; + await db.insertEmailVerification({ + email: user.email!, + code: initialCode, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + // Generate initial reset token + const { encode } = await import("next-auth/jwt"); + const initialToken = await encode({ + secret: bindings.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email: user.email, + }, + }); + + const res = await fetch(`${url}/api/auth/resend-password-reset`, { + method: "POST", + headers: { + Cookie: `email_verification_token=${initialToken}`, + }, + }); + + expect(res.status).toBe(200); + const data = await res.json(); + expect(data.ok).toBe(true); + + // Verify new token was set + const cookies = res.headers.get("set-cookie"); + expect(cookies).toContain("email_verification_token"); + expect(cookies).toContain("HttpOnly"); +}); + +test("POST /resend-password-reset fails without cookie", async () => { + const { url } = await serve(); + + const res = await fetch(`${url}/api/auth/resend-password-reset`, { + method: "POST", + }); + + expect(res.status).toBe(400); + const data = await res.json(); + expect(data.error).toContain("No reset session"); +}); + +test("POST /resend-password-reset fails for non-existent user", async () => { + const { url, bindings } = await serve(); + + // Generate token for non-existent user + const { encode } = await import("next-auth/jwt"); + const token = await encode({ + secret: bindings.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email: "nonexistent@example.com", + }, + }); + + const res = await fetch(`${url}/api/auth/resend-password-reset`, { + method: "POST", + headers: { + Cookie: `email_verification_token=${token}`, + }, + }); + + expect(res.status).toBe(404); + const data = await res.json(); + expect(data.error).toContain("User not found"); +}); diff --git a/packages/api/src/routes/auth/auth.server.ts b/packages/api/src/routes/auth/auth.server.ts new file mode 100644 index 0000000..ce3f508 --- /dev/null +++ b/packages/api/src/routes/auth/auth.server.ts @@ -0,0 +1,1220 @@ +import type { User, UserAccount } from "@blink.so/database/schema"; +import { compare, hash } from "bcrypt-ts"; +import type { Context } from "hono"; +import { getCookie, setCookie } from "hono/cookie"; +import { validator } from "hono/validator"; +import { decode, encode } from "next-auth/jwt"; +import { z } from "zod"; +import { withAuth } from "../../middleware"; +import type { APIServer, Bindings } from "../../server"; +import { + schemaRequestEmailChangeRequest, + schemaRequestPasswordResetRequest, + schemaResetPasswordRequest, + schemaSignInWithCredentialsRequest, + schemaSignupRequest, + schemaVerifyEmailChangeRequest, + schemaVerifyEmailRequest, + SESSION_COOKIE_NAME, + SESSION_SECURE, +} from "./auth.client"; + +// ============================================================================ +// Providers +// ============================================================================ + +const providers = { + credentials: { + id: "credentials", + name: "Credentials", + type: "credentials" as const, + }, + github: { + id: "github", + name: "GitHub", + type: "oauth" as const, + authUrl: "https://github.com/login/oauth/authorize", + tokenUrl: "https://github.com/login/oauth/access_token", + userUrl: "https://api.github.com/user", + scope: "user:email", + }, + google: { + id: "google", + name: "Google", + type: "oauth" as const, + authUrl: "https://accounts.google.com/o/oauth2/v2/auth", + tokenUrl: "https://oauth2.googleapis.com/token", + userUrl: "https://www.googleapis.com/oauth2/v2/userinfo", + scope: "openid email profile", + }, +}; + +// ============================================================================ +// Helpers +// ============================================================================ + +const INVITE_COOKIE = "blink_invite_verified"; + +// ============================================================================ +// OAuth +// ============================================================================ + +async function initiateOAuthFlow( + c: Context<{ Bindings: Bindings }>, + provider: "github" | "google" +) { + const config = providers[provider]; + const callbackUrl = new URL( + `/api/auth/callback/${provider}`, + c.env.apiBaseURL + ); + + // Generate state with encoded redirect info + const state = await encode({ + secret: c.env.AUTH_SECRET, + salt: "oauth-state", + token: { + provider, + nonce: crypto.randomUUID(), + callbackUrl: callbackUrl.toString(), + }, + }); + + const authUrl = new URL(config.authUrl); + const clientId = + provider === "github" ? c.env.GITHUB_CLIENT_ID : c.env.GOOGLE_CLIENT_ID; + + authUrl.searchParams.set("client_id", clientId!); + authUrl.searchParams.set("redirect_uri", callbackUrl.toString()); + authUrl.searchParams.set("scope", config.scope); + authUrl.searchParams.set("state", state); + authUrl.searchParams.set("response_type", "code"); + + if (provider === "google") { + authUrl.searchParams.set("access_type", "offline"); + authUrl.searchParams.set("prompt", "consent"); + } + + return c.redirect(authUrl.toString()); +} + +async function handleOAuthCallback( + c: Context<{ Bindings: Bindings }>, + provider: "github" | "google" +) { + const code = c.req.query("code"); + const state = c.req.query("state"); + + if (!code || !state) { + return c.redirect("/login?error=missing_params"); + } + + // Verify state + try { + const decoded = await decode({ + token: state, + secret: c.env.AUTH_SECRET, + salt: "oauth-state", + }); + + if (!decoded || decoded.provider !== provider) { + return c.redirect("/login?error=invalid_state"); + } + } catch { + return c.redirect("/login?error=invalid_state"); + } + + const config = providers[provider]; + const callbackUrl = new URL( + `/api/auth/callback/${provider}`, + c.env.apiBaseURL + ); + + const clientId = + provider === "github" ? c.env.GITHUB_CLIENT_ID : c.env.GOOGLE_CLIENT_ID; + const clientSecret = + provider === "github" + ? c.env.GITHUB_CLIENT_SECRET + : c.env.GOOGLE_CLIENT_SECRET; + + // Exchange code for token + const tokenResponse = await fetch(config.tokenUrl, { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + body: JSON.stringify({ + client_id: clientId, + client_secret: clientSecret, + code, + redirect_uri: callbackUrl.toString(), + grant_type: "authorization_code", + }), + }); + + const tokenData = (await tokenResponse.json()) as any; + const accessToken = tokenData.access_token; + + if (!accessToken) { + return c.redirect("/login?error=no_access_token"); + } + + // Fetch user profile + const userResponse = await fetch(config.userUrl, { + headers: { + Authorization: `Bearer ${accessToken}`, + Accept: "application/json", + "User-Agent": "Blink (https://blink.so)", + }, + }); + + if (!userResponse.ok) { + const responseText = await userResponse.text(); + console.error("Failed to fetch user profile", responseText); + return c.redirect("/login?error=failed_to_fetch_user_profile"); + } + + const profile = (await userResponse.json()) as any; + + // Map profile to user + const userProfile = + provider === "github" + ? { + id: profile.id.toString(), + email: profile.email, + name: profile.name || profile.login, + image: profile.avatar_url, + } + : { + id: profile.id, + email: profile.email, + name: profile.name, + image: profile.picture, + }; + + const db = await c.env.database(); + const inviteCookie = getCookie(c, INVITE_COOKIE); + + // Check if user is already authenticated (for account linking) + const existingSessionToken = getCookie(c, SESSION_COOKIE_NAME); + let authenticatedUserId: string | null = null; + + if (existingSessionToken) { + try { + const decoded = await decode({ + token: existingSessionToken, + secret: c.env.AUTH_SECRET, + salt: SESSION_COOKIE_NAME, + }); + if (decoded?.id) { + authenticatedUserId = decoded.id as string; + } + } catch { + // Invalid token, ignore + } + } + + // Get or create user + const existingAccount = await db.selectUserAccountByProviderAccountID( + provider as UserAccount["provider"], + userProfile.id + ); + + let user: User; + let isLinking = false; + + if (existingAccount?.user) { + user = existingAccount.user; + } else if (authenticatedUserId) { + isLinking = true; + // User is already logged in - link this provider to their account + const existingUser = await db.selectUserByID(authenticatedUserId); + if (!existingUser) { + return c.redirect("/login?error=invalid_session"); + } + + // Check if this provider account is already linked to a different user + const conflictingAccount = await db.selectUserAccountByProviderAccountID( + provider as UserAccount["provider"], + userProfile.id + ); + if ( + conflictingAccount && + conflictingAccount.user.id !== authenticatedUserId + ) { + return c.redirect( + "/login?error=provider_already_linked&provider=" + provider + ); + } + + // Link the provider account to the existing user + await db.upsertUserAccount({ + user_id: authenticatedUserId, + type: "oauth", + provider: provider as UserAccount["provider"], + provider_account_id: userProfile.id, + access_token: accessToken, + refresh_token: tokenData.refresh_token ?? null, + expires_at: tokenData.expires_in + ? Math.floor(Date.now() / 1000) + tokenData.expires_in + : null, + token_type: tokenData.token_type ?? null, + scope: tokenData.scope ?? null, + id_token: null, + session_state: "", + }); + + user = existingUser; + } else { + // Check if email is already in use by another account + if (userProfile.email) { + const existingUserByEmail = await db.selectUserByEmail(userProfile.email); + if (existingUserByEmail) { + return c.redirect( + "/login?error=email_already_in_use&email=" + + encodeURIComponent(userProfile.email) + ); + } + } + // Create new user + let usedInviteId: string | null = null; + + if (inviteCookie) { + // marker is the invite token itself, re-validate before using + const inviteData = + await db.selectOrganizationInviteWithOrganizationByToken(inviteCookie); + if (inviteData) { + const invite = inviteData.organization_invite; + if ( + !(invite.expires_at && new Date() > invite.expires_at) && + (invite.reusable || !invite.last_accepted_at) + ) { + usedInviteId = invite.id; + } + } + } + + user = await db.insertUser({ + email: userProfile.email, + email_verified: new Date(), + display_name: userProfile.name, + password: null, + }); + + // consume single-use invite (mark accepted) + if (usedInviteId) { + try { + await db.updateOrganizationInviteLastAcceptedAtByID(usedInviteId); + } catch {} + } + + // Link account + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: provider as UserAccount["provider"], + provider_account_id: userProfile.id, + access_token: accessToken, + refresh_token: tokenData.refresh_token ?? null, + expires_at: tokenData.expires_in + ? Math.floor(Date.now() / 1000) + tokenData.expires_in + : null, + token_type: tokenData.token_type ?? null, + scope: tokenData.scope ?? null, + id_token: null, + session_state: "", + }); + + // Sync OAuth user to telemetry system (async, don't block) + if (c.env.sendTelemetryEvent && user.email) { + c.env + .sendTelemetryEvent({ + type: "user.oauth_registered", + userId: user.id, + email: user.email, + name: user.display_name, + provider: provider, + }) + .then(() => { + // Attempt to merge any existing invited user record + if (user!.email && c.env.sendTelemetryEvent) { + return c.env.sendTelemetryEvent({ + type: "user.merged", + primaryUserId: user!.id, + secondaryUserId: user!.email, + }); + } + }) + .catch(() => { + // Ignore errors to avoid breaking OAuth flow + }); + } + } + + const token = await encode({ + secret: c.env.AUTH_SECRET, + token: { + sub: user.id, + id: user.id, + email: user.email, + name: user.display_name, + }, + salt: SESSION_COOKIE_NAME, + }); + + // Set cookies and redirect using Hono's setCookie helper + setCookie(c, SESSION_COOKIE_NAME, token, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 30 * 24 * 60 * 60, // 30 days + }); + + setCookie(c, "last_login_provider", provider, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 60 * 60 * 24 * 180, // 180 days + }); + + // If linking an existing account, redirect back with success message + if (isLinking) { + return c.redirect(`/chat?linked=${provider}`); + } + + return c.redirect("/chat"); +} + +// ============================================================================ +// Routes +// ============================================================================ + +export default function mountAuth(server: APIServer) { + // WebSocket token routes (existing functionality) + server.get("/token", async (c) => { + console.log("get /token", c.req.header("Connection")); + if (c.req.header("Connection")?.toLowerCase() !== "upgrade") { + return c.json( + { + message: "Only WebSocket connections are allowed", + }, + 400 + ); + } + const id = c.req.query("id"); + if (!id) { + return c.json( + { + message: "Missing ID", + }, + 400 + ); + } + + return c.env.auth.handleWebSocketTokenRequest(id, c.req.raw); + }); + + // This is a private undocumented endpoint. + // Users should not manually request this. + server.post( + "/token", + withAuth, + validator("json", (value, c) => { + const schema = z.object({ + id: z.string(), + }); + return schema.parse(value); + }), + async (c) => { + const userID = c.get("user_id"); + const { id } = c.req.valid("json"); + const token = await encode({ + secret: c.env.AUTH_SECRET, + token: { + sub: userID, + }, + salt: SESSION_COOKIE_NAME, + }); + await c.env.auth.sendTokenToWebSocket(id, token); + return c.body(null, 204); + } + ); + + // NextAuth-compatible routes + + // GET /session - Return current user session + server.get("/session", async (c) => { + const token = getCookie(c, SESSION_COOKIE_NAME); + + if (!token) { + return c.json({}); + } + + try { + const decoded = await decode({ + token, + secret: c.env.AUTH_SECRET, + salt: SESSION_COOKIE_NAME, + }); + + if (!decoded?.id) { + return c.json({}); + } + + return c.json({ + user: { + id: decoded.id, + email: decoded.email, + name: decoded.name, + image: decoded.avatar_url || null, + organization_id: decoded.organization_id, + }, + expires: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(), + }); + } catch (error) { + return c.json({}); + } + }); + + // GET /csrf - Return CSRF token + server.get("/csrf", (c) => { + return c.json({ csrfToken: crypto.randomUUID() }); + }); + + // GET /providers - List available providers + server.get("/providers", (c) => { + // Return only public fields (id, name, type) for each provider + const publicProviders = Object.fromEntries( + Object.entries(providers).map(([key, provider]) => [ + key, + { + id: provider.id, + name: provider.name, + type: provider.type, + }, + ]) + ); + return c.json(publicProviders); + }); + + // POST /signin/credentials - Email/password login + server.post( + "/signin/credentials", + validator("json", (value) => { + return schemaSignInWithCredentialsRequest.parse(value); + }), + async (c) => { + const { email, password } = c.req.valid("json"); + const db = await c.env.database(); + + // Get user + const user = await db.selectUserByEmail(email); + if (!user) { + return c.json({ error: "Invalid credentials" }, 401); + } + + if (!user.password) { + return c.json({ error: "Invalid credentials" }, 401); + } + + // Verify password + const isValid = await compare(password, user.password); + if (!isValid) { + return c.json({ error: "Invalid credentials" }, 401); + } + + // Check email verified (skip if sendEmail not configured) + if (c.env.sendEmail && !user.email_verified) { + return c.json({ error: "Email not verified" }, 401); + } + + // Generate JWT + const token = await encode({ + secret: c.env.AUTH_SECRET, + token: { + sub: user.id, + id: user.id, + email: user.email, + name: user.display_name, + }, + salt: SESSION_COOKIE_NAME, + }); + + // Set cookies using Hono's setCookie helper + setCookie(c, SESSION_COOKIE_NAME, token, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 30 * 24 * 60 * 60, // 30 days + }); + + setCookie(c, "last_login_provider", "credentials", { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 60 * 60 * 24 * 180, // 180 days + }); + + return c.json({ ok: true, url: "/chat" }); + } + ); + + // POST /verify-email - Verify email with code + server.post( + "/verify-email", + validator("json", (value) => { + return schemaVerifyEmailRequest.parse(value); + }), + async (c) => { + const { code } = c.req.valid("json"); + const db = await c.env.database(); + + // Get token from cookie + const token = getCookie(c, "email_verification_token"); + if (!token) { + return c.json({ error: "Session expired" }, 401); + } + + // Decode the email verification token + const decoded = await decode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token, + }); + + if (!decoded?.email) { + return c.json({ error: "Invalid token" }, 401); + } + + // Verify the code + const emailVerification = await db.selectAndDeleteEmailVerificationByCode( + { + email: decoded.email as string, + code, + } + ); + + if (!emailVerification) { + return c.json({ error: "Invalid code" }, 401); + } + + // Get user + const user = await db.selectUserByEmail(decoded.email as string); + if (!user) { + return c.json({ error: "User not found" }, 404); + } + + // Mark email as verified + await db.updateUserByID({ + id: user.id, + email_verified: new Date(), + }); + + // Generate JWT + const sessionToken = await encode({ + secret: c.env.AUTH_SECRET, + token: { + sub: user.id, + id: user.id, + email: user.email, + name: user.display_name, + }, + salt: SESSION_COOKIE_NAME, + }); + + // Set cookies using Hono's setCookie helper + setCookie(c, SESSION_COOKIE_NAME, sessionToken, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 30 * 24 * 60 * 60, // 30 days + }); + + setCookie(c, "last_login_provider", "credentials", { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 60 * 60 * 24 * 180, // 180 days + }); + + return c.json({ ok: true }); + } + ); + + // GET /signin/github - Initiate GitHub OAuth + server.get("/signin/github", async (c) => { + return initiateOAuthFlow(c, "github"); + }); + + // GET /signin/google - Initiate Google OAuth + server.get("/signin/google", async (c) => { + return initiateOAuthFlow(c, "google"); + }); + + // GET /callback/github - Handle GitHub OAuth callback + server.get("/callback/github", async (c) => { + return handleOAuthCallback(c, "github"); + }); + + // GET /callback/google - Handle Google OAuth callback + server.get("/callback/google", async (c) => { + return handleOAuthCallback(c, "google"); + }); + + // POST /signout - Clear session + server.post("/signout", (c) => { + // Clear session cookie + setCookie(c, SESSION_COOKIE_NAME, "", { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 0, + }); + + return c.json({ ok: true }); + }); + + // POST /reset-password - Reset password with verified token + server.post( + "/reset-password", + validator("json", (value) => { + return schemaResetPasswordRequest.parse(value); + }), + async (c) => { + const { password } = c.req.valid("json"); + const db = await c.env.database(); + + // Get verified token from cookie + const verifiedToken = getCookie(c, "password_reset_verified"); + if (!verifiedToken) { + return c.json({ error: "Session expired" }, 401); + } + + // Decode the verified token + const decoded = await decode({ + secret: c.env.AUTH_SECRET, + salt: "password-reset-verified", + token: verifiedToken, + }); + + if (!decoded?.email) { + return c.json({ error: "Invalid session" }, 401); + } + + // Get user + const user = await db.selectUserByEmail(decoded.email as string); + if (!user) { + return c.json({ error: "User not found" }, 404); + } + + // Hash and update password + const hashedPassword = await hash(password, 12); + await db.updateUserByID({ id: user.id, password: hashedPassword }); + + // Clear cookies + setCookie(c, "password_reset_verified", "", { + path: "/", + maxAge: 0, + secure: SESSION_SECURE, + }); + setCookie(c, "email_verification_token", "", { + path: "/", + maxAge: 0, + secure: SESSION_SECURE, + }); + + return c.json({ ok: true }); + } + ); + + // POST /request-email-change - Request email change + server.post( + "/request-email-change", + withAuth, + validator("json", (value) => { + return schemaRequestEmailChangeRequest.parse(value); + }), + async (c) => { + const { currentPassword, newEmail } = c.req.valid("json"); + const userId = c.get("user_id"); + const db = await c.env.database(); + + // Get current user + const user = await db.selectUserByID(userId); + if (!user) { + return c.json({ error: "User not found" }, 404); + } + + // Check if user has a password + if (!user.password) { + return c.json( + { error: "Password authentication is not enabled for this account" }, + 400 + ); + } + + // Verify current password + const passwordValid = await compare(currentPassword, user.password); + if (!passwordValid) { + return c.json({ error: "Current password is incorrect" }, 401); + } + + // Check if new email is the same as current + if (newEmail.toLowerCase() === user.email?.toLowerCase()) { + return c.json( + { error: "New email must be different from current email" }, + 400 + ); + } + + // Check if email is already in use + const existingUser = await db.selectUserByEmail(newEmail); + if (existingUser) { + return c.json({ error: "This email is already registered" }, 400); + } + + // If sendEmail not configured, update immediately + if (!c.env.sendEmail) { + await db.updateUserByID({ id: userId, email: newEmail }); + return c.json({ ok: true }); + } + + // Generate verification code + const code = Math.floor(100000000 + Math.random() * 900000000).toString(); + + // Insert verification code + await db.insertEmailVerification({ + email: newEmail, + code, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + // Generate token + const token = await encode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email: newEmail, + }, + }); + + // Set cookie + setCookie(c, "email_verification_token", token, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 1000 * 60 * 15, + }); + + // Send verification email + try { + await c.env.sendEmail({ + type: "verification", + email: newEmail, + name: user.display_name || "User", + code, + }); + } catch (err) { + console.error("Failed to send email verification:", err); + } + + return c.json({ ok: true }); + } + ); + + // POST /verify-email-change - Verify email change with code + server.post( + "/verify-email-change", + withAuth, + validator("json", (value) => { + return schemaVerifyEmailChangeRequest.parse(value); + }), + async (c) => { + const { code } = c.req.valid("json"); + const userId = c.get("user_id"); + const db = await c.env.database(); + + // Get token from cookie + const token = getCookie(c, "email_verification_token"); + if (!token) { + return c.json({ error: "Session expired" }, 401); + } + + // Decode the email verification token + const decoded = await decode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token, + }); + + if (!decoded?.email) { + return c.json({ error: "Invalid token" }, 401); + } + + // Verify the code + const emailVerification = await db.selectAndDeleteEmailVerificationByCode( + { + email: decoded.email as string, + code, + } + ); + + if (!emailVerification) { + return c.json({ error: "Invalid or expired code" }, 401); + } + + // Get current user + const user = await db.selectUserByID(userId); + if (!user) { + return c.json({ error: "User not found" }, 404); + } + + // Update user email and reset email_verified + await db.updateUserByID({ + id: userId, + email: decoded.email as string, + email_verified: null, + }); + + // Clear the verification cookie + setCookie(c, "email_verification_token", "", { + path: "/", + maxAge: 0, + secure: SESSION_SECURE, + }); + + return c.json({ ok: true }); + } + ); + + // POST /signup - Create new user with email/password + server.post( + "/signup", + validator("json", (value) => { + return schemaSignupRequest.parse(value); + }), + async (c) => { + const { email, password, redirect: redirectTarget } = c.req.valid("json"); + const db = await c.env.database(); + + // Check if user exists + const existingUser = await db.selectUserByEmail(email); + if (existingUser) { + return c.json({ error: "User with this email already exists" }, 400); + } + + // Hash password and create user + const hashedPassword = await hash(password, 12); + + // If emails are not configured, verify immediately + const emailVerified = c.env.sendEmail ? null : new Date(); + + const user = await db.insertUser({ + display_name: null, + email, + password: hashedPassword, + email_verified: emailVerified, + }); + + // Sync user to telemetry system (async, don't block) + if (c.env.sendTelemetryEvent) { + c.env + .sendTelemetryEvent({ + type: "user.registered", + userId: user.id, + email: user.email, + name: user.display_name, + }) + .then(() => { + // If this user was previously invited, merge the records + if (user.email && c.env.sendTelemetryEvent) { + return c.env.sendTelemetryEvent({ + type: "user.merged", + primaryUserId: user.id, + secondaryUserId: user.email, + }); + } + }) + .catch(() => { + // Ignore errors to avoid breaking user creation + }); + } + + // If emails are configured, send verification email + if (c.env.sendEmail) { + // Generate email verification token + const code = Math.floor( + 100000000 + Math.random() * 900000000 + ).toString(); + await db.insertEmailVerification({ + email, + code, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + const token = await encode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email, + }, + }); + + // Set verification cookie + setCookie(c, "email_verification_token", token, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 1000 * 60 * 15, + }); + + // Send verification email + try { + const user = await db.selectUserByEmail(email); + if (user) { + await c.env.sendEmail({ + type: "verification", + email, + name: user.display_name, + code, + }); + } + } catch (err) { + console.error("Failed to send verification email:", err); + } + + const redirectUrl = redirectTarget + ? `/email-verification?redirect=${encodeURIComponent(redirectTarget)}` + : "/email-verification"; + + return c.json({ ok: true, redirect_url: redirectUrl }); + } else { + // No email verification needed - redirect directly to chat + return c.json({ ok: true, redirect_url: "/chat" }); + } + } + ); + + // POST /resend-email-verification - Resend email verification code + server.post("/resend-email-verification", async (c) => { + const token = getCookie(c, "email_verification_token"); + if (!token) { + return c.json({ error: "No verification session found" }, 400); + } + + // Decode token to get email + const decoded = await decode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token, + }); + + if (!decoded?.email) { + return c.json({ error: "Invalid verification token" }, 400); + } + + const email = decoded.email as string; + const db = await c.env.database(); + + // Generate new code + const code = Math.floor(100000000 + Math.random() * 900000000).toString(); + await db.insertEmailVerification({ + email, + code, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + // Generate new token + const newToken = await encode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email, + }, + }); + + // Update cookie + setCookie(c, "email_verification_token", newToken, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 1000 * 60 * 15, + }); + + // Send new verification email + if (c.env.sendEmail) { + try { + const user = await db.selectUserByEmail(email); + if (user) { + await c.env.sendEmail({ + type: "verification", + email, + name: user.display_name, + code, + }); + } + } catch (err) { + console.error("Failed to resend verification email:", err); + } + } + + return c.json({ ok: true }); + }); + + // POST /request-password-reset - Request password reset + server.post( + "/request-password-reset", + validator("json", (value) => { + return schemaRequestPasswordResetRequest.parse(value); + }), + async (c) => { + const { email } = c.req.valid("json"); + const db = await c.env.database(); + + // Check if sendEmail is configured + if (!c.env.sendEmail) { + return c.json( + { error: "Password reset requires email to be configured" }, + 400 + ); + } + + // Check if user exists + const user = await db.selectUserByEmail(email); + + // Always return success to prevent email enumeration + // But only send email if user exists + if (user) { + // Generate reset code + const code = Math.floor( + 100000000 + Math.random() * 900000000 + ).toString(); + await db.insertEmailVerification({ + email, + code, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + const token = await encode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email, + }, + }); + + // Set cookie + setCookie(c, "email_verification_token", token, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 60 * 15, + }); + + // Send reset email + try { + await c.env.sendEmail({ + type: "password-reset", + email, + name: user.display_name, + code, + }); + } catch (err) { + console.error("Failed to send password reset email:", err); + } + } + + return c.json({ + ok: true, + redirect_url: "/reset-password/verify", + }); + } + ); + + // POST /resend-password-reset - Resend password reset code + server.post("/resend-password-reset", async (c) => { + const token = getCookie(c, "email_verification_token"); + if (!token) { + return c.json({ error: "No reset session found" }, 400); + } + + // Decode token to get email + const decoded = await decode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token, + }); + + if (!decoded?.email) { + return c.json({ error: "Invalid reset token" }, 400); + } + + const email = decoded.email as string; + const db = await c.env.database(); + + // Verify user exists + const user = await db.selectUserByEmail(email); + if (!user) { + return c.json({ error: "User not found" }, 404); + } + + // Generate new code + const code = Math.floor(100000000 + Math.random() * 900000000).toString(); + await db.insertEmailVerification({ + email, + code, + expiresAt: new Date(Date.now() + 1000 * 60 * 15), + }); + + // Generate new token + const newToken = await encode({ + secret: c.env.AUTH_SECRET, + salt: "email-verification", + token: { + id: crypto.randomUUID(), + email, + }, + }); + + // Update cookie + setCookie(c, "email_verification_token", newToken, { + path: "/", + httpOnly: true, + sameSite: "Lax", + secure: SESSION_SECURE, + maxAge: 60 * 15, + }); + + // Send new reset email + if (c.env.sendEmail) { + try { + await c.env.sendEmail({ + type: "password-reset", + email, + name: user.display_name, + code, + }); + } catch (err) { + console.error("Failed to resend password reset email:", err); + } + } + + return c.json({ ok: true }); + }); +} diff --git a/packages/api/src/routes/auth/auth.test.ts b/packages/api/src/routes/auth/auth.test.ts new file mode 100644 index 0000000..4d54690 --- /dev/null +++ b/packages/api/src/routes/auth/auth.test.ts @@ -0,0 +1,30 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("GET+POST /api/auth/token", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + let url: string; + let resolve!: Promise; + const res = await client.auth.token((u, id) => { + url = u; + // When the callback happens, it's listening. + resolve = client.request( + "POST", + "/api/auth/token", + JSON.stringify({ + id, + }), + { + headers: { + "Content-Type": "application/json", + }, + } + ); + }); + expect(res).toBeString(); + + const resolveResp = await resolve; + expect(resolveResp.status).toBe(204); +}); diff --git a/packages/api/src/routes/chats/chats.client.ts b/packages/api/src/routes/chats/chats.client.ts new file mode 100644 index 0000000..588f90e --- /dev/null +++ b/packages/api/src/routes/chats/chats.client.ts @@ -0,0 +1,416 @@ +import type { UIMessageChunk } from "ai"; +import { EventSourceParserStream } from "eventsource-parser/stream"; +import { z } from "zod"; +import { + assertResponseStatus, + createEventStreamFromReadable, + schemaCursorPaginatedRequest, + schemaCursorPaginatedResponse, + schemaMetadata, + streamSSE, +} from "../../client-helper"; +import Client from "../../client.browser"; +import { type AsyncIterableStream } from "../../util/async-iterable-stream"; +import { schemaAgent } from "../agents/agents.client"; +import { + schemaChatMessage, + schemaCreateChatMessage, + type ChatMessage, +} from "../messages.client"; +import ChatRuns from "./runs.client"; +import ChatSteps from "./steps.client"; + +export const schemaChatStatus = z.enum([ + "streaming", + "idle", + "error", + "interrupted", +]); + +export type ChatStatus = z.infer; + +export const schemaChatVisibility = z.enum([ + "private", + "organization", + "public", +]); + +export const schemaChat = z.object({ + id: z.uuid(), + created_at: z.iso.datetime(), + updated_at: z.iso.datetime(), + created_by: z.uuid().nullable(), + organization_id: z.uuid(), + title: z.string().nullable(), + visibility: schemaChatVisibility, + metadata: schemaMetadata, + archived: z.boolean(), + status: schemaChatStatus, + error: z.string().nullable(), + agent_deployment_id: z.uuid().nullable(), + agent: schemaAgent, + expire_ttl: z.number().int().positive().nullable(), + expires_at: z.iso.datetime().nullable(), +}); + +export type Chat = z.infer; + +// Transport options for chat streaming +export const schemaStreamChatTransport = z.enum(["websocket", "sse"]); +export type StreamChatTransport = z.infer; + +// Base request properties for creating a chat +const schemaCreateChatRequestBase = z.object({ + organization_id: z.uuid(), + title: z.string().optional(), + visibility: schemaChatVisibility.default("private").optional(), + metadata: schemaMetadata.optional(), + + agent_id: z.uuid(), + agent_deployment_id: z.uuid().optional(), + messages: z.array(schemaCreateChatMessage).optional(), +}); + +const schemaCreateChatRequestStreaming = schemaCreateChatRequestBase.extend({ + stream: z.literal(true), +}); + +// Non-streaming variant: stream absent or false; transport must be undefined +const schemaCreateChatRequestNonStreaming = schemaCreateChatRequestBase.extend({ + stream: z.literal(false).optional(), +}); + +export const schemaCreateChatRequest = z.union([ + schemaCreateChatRequestStreaming, + schemaCreateChatRequestNonStreaming, +]); + +export type CreateChatRequest = z.infer; + +export const schemaListChatsRequest = z.union([ + schemaCursorPaginatedRequest.extend({ + organization_id: z.uuid(), + }), + schemaCursorPaginatedRequest.extend({ + agent_id: z.uuid(), + }), +]); + +export const schemaCreateChatResponse = schemaChat.extend({ + messages: z.array(schemaChatMessage), +}); + +export type CreateChatResponse = z.infer; + +export type ListChatsRequest = z.infer; + +export const schemaListChatsResponse = + schemaCursorPaginatedResponse(schemaChat); + +export type ListChatsResponse = z.infer; + +export type StreamChatOptions = { + transport?: StreamChatTransport; + signal?: AbortSignal; +}; + +export const schemaStreamChatEvent = z.discriminatedUnion("event", [ + z.strictObject({ + event: z.literal("chat.updated"), + data: schemaChat, + }), + + z.strictObject({ + event: z.literal("message.created"), + data: schemaChatMessage, + }), + z.strictObject({ + event: z.literal("message.updated"), + data: schemaChatMessage, + }), + z.strictObject({ + event: z.literal("message.deleted"), + data: z.object({ + id: z.uuid(), + }), + }), + z.strictObject({ + event: z.literal("message.chunk.added"), + data: z.object({ + id: z.uuid(), + chunk: z.custom(), + }), + }), +]); + +// This event is only sent once when a chat is created, +// so it's not part of the normal chat stream event schema. +export const schemaStreamChatCreatedEvent = z.strictObject({ + event: z.literal("chat.created"), + data: schemaCreateChatResponse, +}); + +export type StreamChatEvent = z.infer; +export type StreamChat = AsyncIterableStream; + +export interface ChatWithStream extends Chat { + readonly id: string; + readonly stream: AsyncIterableStream; + readonly messages: ChatMessage[]; +} + +export default class Chats { + private readonly client: Client; + + /** + * Runs are the execution history of a chat. + */ + public readonly runs: ChatRuns; + public readonly steps: ChatSteps; + + public constructor(client: Client) { + this.client = client; + this.runs = new ChatRuns(client); + this.steps = new ChatSteps(client); + } + + /** + * Create a new chat. + * + * - When `stream: true` is provided, returns an AsyncIterable stream of chat events. + * - Otherwise, returns the created chat. + * + * @param request - The request body. + */ + public async create( + request: z.infer + ): Promise; + public async create( + request: z.infer + ): Promise; + public async create( + request: CreateChatRequest + ): Promise { + const headers: Record = {}; + if (request.stream) { + headers["Accept"] = "text/event-stream"; + } + const resp = await this.client.request( + "POST", + "/api/chats", + JSON.stringify(request), + { + headers, + } + ); + await assertResponseStatus(resp, 201); + if (request.stream) { + const contentType = resp.headers.get("Content-Type"); + if (contentType !== "text/event-stream") { + throw new Error(`Expected text/event-stream, got ${contentType}`); + } + if (!resp.body) { + throw new Error("The stream endpoint did not return a body!"); + } + const stream = streamSSE( + resp, + z.discriminatedUnion("event", [ + schemaStreamChatEvent, + schemaStreamChatCreatedEvent, + ]) + ); + + // Await an initial message with the chat and messages. + // This message never occurs again, it's just a normal + // stream after this. + const reader = stream.getReader(); + const { done, value } = await reader.read(); + if (done) { + throw new Error( + "The stream ended before the chat.created event was received!" + ); + } + if (value.event !== "chat.created") { + throw new Error(`Expected chat.created, got ${value.event}`); + } + reader.releaseLock(); + return { + ...value.data, + messages: value.data.messages, + stream: stream as AsyncIterableStream, + }; + } + return resp.json(); + } + + /** + * Get a chat by ID. + * + * @param id - The ID of the chat. + * @returns The chat. + */ + public async get(id: string): Promise { + const resp = await this.client.request("GET", `/api/chats/${id}`); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * List chats. + * The sort order is descending by created_at. + * + * @param request - The request body. + * @returns The list of chats. + */ + public async list(request: ListChatsRequest): Promise { + const params = new URLSearchParams(); + if ("organization_id" in request && request.organization_id) { + params.set("organization_id", request.organization_id); + } else if ("agent_id" in request && request.agent_id) { + params.set("agent_id", request.agent_id); + } + if (request.cursor) { + params.set("cursor", request.cursor); + } + if (request.limit) { + params.set("limit", request.limit.toString()); + } + const resp = await this.client.request( + "GET", + `/api/chats?${params.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete a chat by ID. + * + * @param id - The ID of the chat. + * @returns The void. + */ + public async delete(id: string): Promise { + const resp = await this.client.request("DELETE", `/api/chats/${id}`); + await assertResponseStatus(resp, 204); + } + + /** + * Idempotently stops a chat. + * + * @param id - The ID of the chat. + * @returns The chat. + */ + public async stop(id: string): Promise { + const resp = await this.client.request("POST", `/api/chats/${id}/stop`); + await assertResponseStatus(resp, 200); + } + + /** + * Stream a chat. + * + * @param request - The request body. + */ + public async stream( + id: string, + options: StreamChatOptions = { + // TODO: Update this to use SSE. + transport: "websocket", + } + ): Promise> { + if (options?.transport === "websocket") { + return this.streamWS(id, options?.signal); + } + + const req = await this.client.request( + "GET", + `/api/chats/${id}/stream`, + undefined, + { + abortSignal: options?.signal, + headers: { + Accept: "text/event-stream", + }, + } + ); + await assertResponseStatus(req, 200); + return streamSSE(req, schemaStreamChatEvent); + } + + /** + * Stream a chat over a WebSocket. + * + * @param id - The ID of the chat. + * @returns The stream of events. + */ + private streamWS( + id: string, + signal?: AbortSignal + ): AsyncIterableStream { + const ws = this.client.websocket(`/api/chats/${id}/stream`); + const parser = new EventSourceParserStream(); + const writer = parser.writable.getWriter(); + let lastWritePromise: Promise | undefined; + const decoder = new TextDecoder(); + let isClosed = false; + + const cleanup = () => { + if (isClosed) { + return; + } + isClosed = true; + + // Wait for any pending writes before closing + if (lastWritePromise) { + lastWritePromise.finally(() => { + writer.close().catch(() => {}); + }); + } else { + writer.close().catch(() => {}); + } + + try { + ws.close(); + } catch {} + }; + + if (signal) { + if (signal.aborted) { + cleanup(); + } else { + signal.addEventListener("abort", cleanup, { once: true }); + } + } + + ws.addEventListener("error", () => { + cleanup(); + }); + ws.addEventListener("close", () => { + cleanup(); + }); + + ws.addEventListener("message", (event) => { + if (isClosed) return; + + let str: string; + if (typeof event.data === "string") { + str = event.data; + } else { + str = decoder.decode(event.data); + } + if (!lastWritePromise) { + lastWritePromise = writer.write(str).catch(() => {}); + } else { + lastWritePromise = lastWritePromise.then(() => { + if (!isClosed) { + return writer.write(str).catch(() => {}); + } + }); + } + }); + + return createEventStreamFromReadable( + parser.readable, + schemaStreamChatEvent + ); + } +} diff --git a/packages/api/src/routes/chats/chats.server.ts b/packages/api/src/routes/chats/chats.server.ts new file mode 100644 index 0000000..b2207da --- /dev/null +++ b/packages/api/src/routes/chats/chats.server.ts @@ -0,0 +1,374 @@ +import * as convert from "@blink.so/database/convert"; +import type { + ChatWithStatusAndAgent, + DBMessage, + OrganizationWithMembership, +} from "@blink.so/database/schema"; +import type { Context, MiddlewareHandler } from "hono"; +import { HTTPException } from "hono/http-exception"; +import type { ContentfulStatusCode } from "hono/utils/http-status"; +import { validator } from "hono/validator"; +import z from "zod"; +import { + authorizeOrganization, + withAuth, + withCursorPagination, +} from "../../middleware"; +import type { APIServer, Bindings } from "../../server"; +import { handleInsertMessages, validateMessages } from "../messages.server"; +import { + schemaCreateChatRequest, + schemaStreamChatCreatedEvent, + type CreateChatResponse, + type ListChatsResponse, +} from "./chats.client"; +import mountChatRuns from "./runs.server"; +import mountChatSteps from "./steps.server"; + +export default function mountChats(app: APIServer) { + // List chats. + app.get("/", withAuth, withCursorPagination, async (c) => { + const db = await c.env.database(); + + let org = c.req.query("organization_id"); + if (org) { + await authorizeOrganization(c, org); + } + const agentID = c.req.query("agent_id"); + let agentPermission: "read" | "write" | "admin" | undefined; + if (agentID) { + const agent = await db.selectAgentByID(agentID); + if (!agent) { + throw new HTTPException(404, { + message: "Agent not found", + }); + } + const agentOrg = await authorizeOrganization(c, agent.organization_id); + + // Check agent permission for filtering + if ( + agentOrg.membership && + (agentOrg.membership.role === "owner" || + agentOrg.membership.role === "admin") + ) { + agentPermission = "admin"; + } else { + agentPermission = await db.getAgentPermissionForUser({ + agentId: agent.id, + userId: c.get("user_id"), + orgRole: agentOrg.membership?.role, + agentVisibility: agent.visibility, + }); + if (agentPermission === undefined) { + throw new HTTPException(403, { + message: + "Access denied: private agent requires explicit permission", + }); + } + } + } + if (!agentID && !org) { + const user = await db.selectUserByID(c.get("user_id")); + if (!user) { + throw new HTTPException(404, { + message: "User not found", + }); + } + org = user.organization_id; + } + + // Read users can only see their own chats + let createdBy: string | undefined; + if (agentPermission === "read") { + createdBy = c.get("user_id"); + } + + const chats = await db.selectChats({ + organizationID: org!, + agentID: agentID!, + createdBy, + cursor: c.get("cursor"), + limit: c.get("limit"), + }); + const resp: ListChatsResponse = { + next_cursor: chats.next_cursor, + items: chats.items.map((chat) => convert.chat(chat)), + }; + return c.json(resp); + }); + + // Get a chat. + app.get("/:chat_id", withAuth, withChatURLParam, async (c) => { + const chat = c.get("chat"); + return c.json(convert.chat(chat)); + }); + + // Delete a chat. + app.delete("/:chat_id", withAuth, withChatURLParam, async (c) => { + const db = await c.env.database(); + const chat = c.get("chat"); + await db.deleteChatByID(chat.id); + return c.body(null, 204); + }); + + // Create a chat. + app.post( + "/", + withAuth, + validator("json", (data) => { + return schemaCreateChatRequest.parse(data); + }), + async (c) => { + const db = await c.env.database(); + const req = c.req.valid("json"); + const org = await authorizeOrganization(c, req.organization_id); + + // Verify the user can access the agent. + const agent = await db.selectAgentByID(req.agent_id); + if (!agent) { + throw new HTTPException(404, { + message: "Agent not found", + }); + } + if (agent.organization_id !== org.id) { + // Ensure the user has access to that organization. + await authorizeOrganization(c, agent.organization_id); + } + + // Check agent visibility permissions + const agentOrg = await db.selectOrganizationForUser({ + organizationID: agent.organization_id, + userID: c.get("user_id"), + }); + const permission = await db.getAgentPermissionForUser({ + agentId: agent.id, + userId: c.get("user_id"), + orgRole: agentOrg?.membership?.role, + agentVisibility: agent.visibility, + }); + if (permission === undefined) { + throw new HTTPException(403, { + message: "You don't have permission to access this agent", + }); + } + + if (!agent.active_deployment_id) { + return c.json( + { + error: + "This agent has no active deployment. Please deploy it first to chat!", + }, + 400 + ); + } + + const chat = await db.insertChat({ + organization_id: org.id, + title: req.title ?? "Untitled Chat", + created_by: c.get("user_id"), + visibility: req.visibility, + metadata: req.metadata, + agent_id: req.agent_id, + agent_deployment_id: req.agent_deployment_id, + expire_ttl: agent.chat_expire_ttl, + }); + + let messages: DBMessage[] = []; + if (req.messages) { + await validateMessages(req.messages); + + messages = await handleInsertMessages(c, { + chat, + messages: req.messages, + behavior: "enqueue", + agent_id: req.agent_id, + agent_deployment_id: req.agent_deployment_id ?? undefined, + }); + } + + // If we have messages and the user did not provide a title, + // we will generate a title from the messages. + if ( + req.messages && + req.messages.length > 0 && + !req.title && + c.env.chat.generateTitle + ) { + // Generate a title for users. + c.env.chat.generateTitle({ + messages: req.messages, + id: chat.id, + }); + } + + const response: CreateChatResponse = { + ...convert.chat({ + ...chat, + updated_at: chat.created_at, + error: null, + agent, + agent_deployment_id: req.agent_deployment_id ?? null, + status: "idle", + expires_at: chat.expire_ttl + ? new Date(chat.created_at.getTime() + chat.expire_ttl * 1000) + : null, + }), + messages: messages.map((message) => convert.message("ai-sdk", message)), + }; + + if (req.stream) { + const response = await c.env.chat.handleStream( + chat.id, + new Request(c.req.url, { + headers: c.req.raw.headers, + method: c.req.raw.method, + }) + ); + if (response.status !== 200) { + const body = await response.text(); + throw new HTTPException(response.status as ContentfulStatusCode, { + message: body, + }); + } + if (!response.body) { + throw new HTTPException(response.status as ContentfulStatusCode, { + message: "No body", + }); + } + const transform = new TransformStream(); + const writer = transform.writable.getWriter(); + const event: z.infer = { + event: "chat.created", + data: { + ...convert.chat({ + ...chat, + updated_at: chat.created_at, + error: null, + agent, + agent_deployment_id: req.agent_deployment_id ?? null, + status: "streaming", + expires_at: chat.expire_ttl + ? new Date(chat.created_at.getTime() + chat.expire_ttl * 1000) + : null, + }), + messages: messages.map((message) => + convert.message("ai-sdk", message) + ), + }, + }; + + // Write the initial event. + c.executionCtx.waitUntil( + (async () => { + await writer.write( + new TextEncoder().encode( + [ + `event: ${event.event}`, + `data: ${JSON.stringify(event.data)}`, + "\n", + ].join("\n") + ) + ); + writer.releaseLock(); + await response.body?.pipeTo(transform.writable).catch((err) => { + // noop - we can ignore. + }); + })().catch((err) => { + // noop - we can ignore. + }) + ); + + return new Response(transform.readable, { + status: 201, + headers: { + "Content-Type": "text/event-stream", + "Cache-Control": "no-cache, no-transform", + "Transfer-Encoding": "chunked", + Connection: "keep-alive", + }, + }); + } + + return c.json(response, 201); + } + ); + + // Stop a chat. + app.post("/:chat_id/stop", withAuth, withChatURLParam, async (c) => { + return c.env.chat.handleStop(c.get("chat").id); + }); + + // Stream a chat. TODO: We need to add auth here! + app.get("/:chat_id/stream", async (c) => { + return c.env.chat.handleStream(c.req.param("chat_id"), c.req.raw); + }); + + mountChatRuns(app.basePath("/:chat_id/runs")); + mountChatSteps(app.basePath("/:chat_id/steps")); +} + +export const authorizeChat = async < + V extends { + user_id: string; + }, +>( + c: Context<{ + Bindings: Bindings; + Variables: V; + }>, + id: string +): Promise<{ + chat: ChatWithStatusAndAgent; + organization: OrganizationWithMembership; +}> => { + const parsed = await z.uuid().safeParseAsync(id); + if (!parsed.success) { + throw new HTTPException(400, { + message: "Invalid chat ID", + }); + } + const db = await c.env.database(); + const chat = await db.selectChatByID({ id: parsed.data }); + if (!chat) { + throw new HTTPException(404, { + message: "Chat not found", + }); + } + + // Check if user owns the agent - if so, they can access regardless of chat org + if (chat.agent.created_by === c.get("user_id")) { + // Agent owner can always access. Return their membership in the agent's org. + const org = await db.selectOrganizationForUser({ + organizationID: chat.agent.organization_id, + userID: c.get("user_id"), + }); + if (!org) { + // Agent owner somehow lost access to agent's org - shouldn't happen but handle it + throw new HTTPException(404, { + message: "Chat not found", + }); + } + return { chat, organization: org }; + } + + const org = await authorizeOrganization(c, chat.organization_id); + return { chat, organization: org }; +}; + +export const withChatURLParam: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + chat: ChatWithStatusAndAgent; + organization: OrganizationWithMembership; + }; +}> = async (c, next) => { + const id = c.req.param("chat_id"); + if (!id) { + return c.json({ message: "Chat ID is required" }, 400); + } + const { chat, organization } = await authorizeChat(c, id); + c.set("chat", chat); + c.set("organization", organization); + await next(); +}; diff --git a/packages/api/src/routes/chats/chats.test.ts b/packages/api/src/routes/chats/chats.test.ts new file mode 100644 index 0000000..bac43ef --- /dev/null +++ b/packages/api/src/routes/chats/chats.test.ts @@ -0,0 +1,439 @@ +import { expect, test } from "bun:test"; +import Client from "../../client.node"; +import { serve } from "../../test"; + +test("CRUD /api/chats", async () => { + const { helpers, bindings } = await serve(); + const { client, user: owner } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + // Create a chat. + let chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + const firstChat = chat; + + // List the chats. + let list = await client.chats.list({ + organization_id: org.id, + limit: 1, + }); + expect(list.items.length).toBe(1); + const { messages, ...rest } = chat; + expect(list.items[0]).toEqual(rest); + expect(list.next_cursor).toBeNull(); + + // Create another chat. + chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + list = await client.chats.list({ + organization_id: org.id, + limit: 1, + }); + expect(list.next_cursor).toBeString(); + expect(list.items.length).toBe(1); + // It should equal the new chat, because we sort by created_at descending. + const { messages: _, ...rest2 } = chat; + expect(list.items[0]).toEqual(rest2); + + // Delete the new chat. + await client.chats.delete(chat.id); + + // List the chats. + list = await client.chats.list({ + organization_id: org.id, + limit: 1, + }); + expect(list.items.length).toBe(1); + const { messages: __, ...rest3 } = firstChat; + expect(list.items[0]).toEqual(rest3); + expect(list.next_cursor).toBeNull(); +}); + +test("create chat with messages", async () => { + const { helpers, bindings } = await serve(); + const { client, user: owner } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + const chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + messages: [ + { + role: "user", + parts: [ + { + type: "text", + text: "Hello, world!", + }, + ], + }, + ], + }); + + const messages = await client.messages.list({ + chat_id: chat.id, + }); + expect(messages.items.length).toBe(1); + + // Since we created the chat with messages, it should immediately + // start streaming. + const runs = await client.chats.runs.list({ + chat_id: chat.id, + }); + expect(runs.items.length).toBe(1); + expect(runs.items[0]!.status).toBe("streaming"); +}); + +test("agent owners can access chats from other orgs", async () => { + const { helpers, bindings } = await serve(); + const { client: agentOwner } = await helpers.createUser(); + const { client: chatCreator, user: chatCreatorUser } = + await helpers.createUser(); + + // Agent owner creates their org and agent + const ownerOrg = await agentOwner.organizations.create({ + name: "owner-org", + }); + + const agent = await agentOwner.agents.create({ + organization_id: ownerOrg.id, + name: "test-agent", + output_files: [ + { + path: "test.js", + data: "console.log('test');", + }, + ], + }); + + const deployments = await agentOwner.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + await agentOwner.agents.update({ + id: agent.id, + active_deployment_id: deployments.items[0]!.id, + }); + + // Chat creator has their own org and joins the agent's org + const creatorOrg = await chatCreator.organizations.create({ + name: "creator-org", + }); + + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: ownerOrg.id, + user_id: chatCreatorUser.id, + role: "member", + }); + + // Chat creator creates a chat (belongs to their personal org) + const chat = await chatCreator.chats.create({ + organization_id: creatorOrg.id, + agent_id: agent.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "test message" }], + }, + ], + }); + + // Agent owner should be able to access the chat + const chatFromOwner = await agentOwner.chats.get(chat.id); + expect(chatFromOwner.id).toBe(chat.id); + + // Agent owner should be able to access messages + const messagesFromOwner = await agentOwner.messages.list({ + chat_id: chat.id, + }); + expect(messagesFromOwner.items.length).toBeGreaterThan(0); + + // Chat creator can also access + const chatFromCreator = await chatCreator.chats.get(chat.id); + expect(chatFromCreator.id).toBe(chat.id); + + const messagesFromCreator = await chatCreator.messages.list({ + chat_id: chat.id, + }); + expect(messagesFromCreator.items.length).toBeGreaterThan(0); +}); + +test("chat listing permissions - read user sees only own chats", async () => { + const { helpers, bindings } = await serve(); + const { user: ownerUser, client: ownerClient } = await helpers.createUser(); + const { user: readUser, client: readClient } = await helpers.createUser(); + const { user: writeUser, client: writeClient } = await helpers.createUser(); + + const org = await ownerClient.organizations.create({ + name: "test-org", + }); + + const db = await bindings.database(); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: readUser.id, + role: "member", + }); + await db.insertOrganizationMembership({ + organization_id: org.id, + user_id: writeUser.id, + role: "member", + }); + + const agent = await ownerClient.agents.create({ + organization_id: org.id, + name: "test-agent", + visibility: "private", + output_files: [ + { + path: "test.js", + data: "console.log('test');", + }, + ], + }); + + const deployments = await ownerClient.agents.deployments.list({ + agent_id: agent.id, + }); + await ownerClient.agents.update({ + id: agent.id, + active_deployment_id: deployments.items[0]!.id, + }); + + // Grant permissions + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: readUser.id, + permission: "read", + }); + await ownerClient.agents.members.grant({ + agent_id: agent.id, + user_id: writeUser.id, + permission: "write", + }); + + // Create chats from different users + const ownerChat = await ownerClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + + const readChat = await readClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + + const writeChat = await writeClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + + // Read user should only see their own chat + const readUserChats = await readClient.chats.list({ + agent_id: agent.id, + }); + expect(readUserChats.items.length).toBe(1); + expect(readUserChats.items[0]!.id).toBe(readChat.id); + + // Write user should see all chats + const writeUserChats = await writeClient.chats.list({ + agent_id: agent.id, + }); + expect(writeUserChats.items.length).toBe(3); + const writeUserChatIds = writeUserChats.items.map((c) => c.id).sort(); + expect(writeUserChatIds).toEqual( + [ownerChat.id, readChat.id, writeChat.id].sort() + ); + + // Owner should see all chats + const ownerChats = await ownerClient.chats.list({ + agent_id: agent.id, + }); + expect(ownerChats.items.length).toBe(3); +}); + +test("API key authentication - CRUD chats", async () => { + const { helpers, bindings, url } = await serve(); + const { client, user: owner } = await helpers.createUser(); + const db = await bindings.database(); + + const org = await client.organizations.create({ + name: "test-org-api-key", + }); + const apiKey = await client.users.createApiKey({ + name: "Test API Key", + }); + const apiKeyClient = new Client({ + baseURL: url.toString(), + authToken: apiKey.key, + }); + + const agent = await apiKeyClient.agents.create({ + organization_id: org.id, + name: "test-agent-api-key", + output_files: [ + { + path: "test.js", + data: "console.log('Hello from API key!');", + }, + ], + }); + + const deployments = await apiKeyClient.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + await apiKeyClient.agents.update({ + id: agent.id, + active_deployment_id: deployments.items[0]!.id, + }); + + const chat = await apiKeyClient.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + expect(chat).toBeDefined(); + expect(chat.id).toBeString(); + expect(chat.organization_id).toBe(org.id); + expect(chat.agent.id).toBe(agent.id); + + const chatsList = await apiKeyClient.chats.list({ + organization_id: org.id, + }); + expect(chatsList.items.length).toBe(1); + expect(chatsList.items[0]!.id).toBe(chat.id); + + const fetchedChat = await apiKeyClient.chats.get(chat.id); + expect(fetchedChat.id).toBe(chat.id); + expect(fetchedChat.organization_id).toBe(org.id); + + await apiKeyClient.chats.delete(chat.id); + + const chatsListAfterDelete = await apiKeyClient.chats.list({ + organization_id: org.id, + }); + expect(chatsListAfterDelete.items.length).toBe(0); +}); + +test("API key authentication - expired key should fail", async () => { + const { helpers, bindings, url } = await serve(); + const { client, user: owner } = await helpers.createUser(); + const db = await bindings.database(); + + const org = await client.organizations.create({ + name: "test-org-expired", + }); + + const apiKey = await client.users.createApiKey({ + name: "Expired API Key", + expires_at: new Date(Date.now() - 24 * 60 * 60 * 1000), + }); + + // Try to use expired API key + const apiKeyClient = new Client({ + baseURL: url.toString(), + authToken: apiKey.key, + }); + + await expect( + apiKeyClient.chats.list({ + organization_id: org.id, + }) + ).rejects.toThrow("API key has expired"); +}); + +test("API key authentication - revoked key should fail", async () => { + const { helpers, bindings, url } = await serve(); + const { client, user: owner } = await helpers.createUser(); + const db = await bindings.database(); + + const org = await client.organizations.create({ + name: "test-org-revoked", + }); + + const apiKey = await client.users.createApiKey({ + name: "Revoked API Key", + }); + + await db.updateApiKey(apiKey.id, { + revoked_at: new Date(), + revoked_by: owner.id, + }); + + // Try to use revoked API key + const apiKeyClient = new Client({ + baseURL: url.toString(), + authToken: apiKey.key, + }); + + await expect( + apiKeyClient.chats.list({ + organization_id: org.id, + }) + ).rejects.toThrow("API key not found"); +}); + +test("API key authentication - invalid key should fail", async () => { + const { url } = await serve(); + + // Use a fake API key + const apiKeyClient = new Client({ + baseURL: url.toString(), + authToken: "bk_invalid_key_that_does_not_exist", + }); + + await expect(apiKeyClient.organizations.list()).rejects.toThrow( + "API key not found" + ); +}); diff --git a/packages/api/src/routes/chats/runs.client.ts b/packages/api/src/routes/chats/runs.client.ts new file mode 100644 index 0000000..a9ed80f --- /dev/null +++ b/packages/api/src/routes/chats/runs.client.ts @@ -0,0 +1,71 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaCursorPaginatedRequest, + schemaCursorPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; +import { schemaChatRunStepStatus } from "./steps.client"; + +const schemaListChatRunsRequest = schemaCursorPaginatedRequest.extend({ + chat_id: z.uuid(), +}); + +export type ListChatRunsRequest = z.infer; + +export const schemaChatRun = z.object({ + id: z.uuid(), + started_at: z.date(), + agent_id: z.uuid(), + agent_deployment_id: z.uuid().nullable(), + chat_id: z.uuid(), + step_count: z.number().int().positive(), + status: schemaChatRunStepStatus.nullable(), + error: z.string().nullable(), +}); + +export type ChatRun = z.infer; + +const schemaListChatRunsResponse = schemaCursorPaginatedResponse(schemaChatRun); + +export type ListChatRunsResponse = z.infer; + +export interface GetChatRunRequest { + chat_id: string; + run_id: string; +} + +export default class ChatRuns { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public async list( + request: ListChatRunsRequest + ): Promise { + const params = new URLSearchParams(); + if (request.cursor) { + params.set("cursor", request.cursor); + } + if (request.limit) { + params.set("limit", request.limit.toString()); + } + const resp = await this.client.request( + "GET", + `/api/chats/${request.chat_id}/runs?${params.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + public async get(request: GetChatRunRequest): Promise { + const resp = await this.client.request( + "GET", + `/api/chats/${request.chat_id}/runs/${request.run_id}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/chats/runs.server.ts b/packages/api/src/routes/chats/runs.server.ts new file mode 100644 index 0000000..ffa0ed1 --- /dev/null +++ b/packages/api/src/routes/chats/runs.server.ts @@ -0,0 +1,48 @@ +import type { ChatRunWithStatus as DBChatRunWithStatus } from "@blink.so/database/schema"; +import { withAuth, withCursorPagination } from "../../middleware"; +import type { APIServer } from "../../server"; +import { withChatURLParam } from "./chats.server"; +import type { ChatRun, ListChatRunsResponse } from "./runs.client"; + +export default function mountChatRuns(app: APIServer) { + // List runs for a chat. + app.get("/", withAuth, withChatURLParam, withCursorPagination, async (c) => { + const db = await c.env.database(); + const runs = await db.selectChatRuns({ + chatID: c.get("chat").id, + cursor: c.get("cursor"), + limit: c.get("limit"), + }); + const resp: ListChatRunsResponse = { + items: runs.items.map(convertChatRun), + next_cursor: runs.next_cursor, + }; + return c.json(resp); + }); + + // Get a run by ID. + app.get("/:id", withAuth, withChatURLParam, async (c) => { + const db = await c.env.database(); + const run = await db.selectChatRun(c.req.param("id")); + if (!run) { + return c.json({ error: "Run not found" }, 404); + } + if (run.chat_id !== c.get("chat").id) { + return c.json({ error: "Run not found" }, 404); + } + return c.json(convertChatRun(run)); + }); +} + +const convertChatRun = (run: DBChatRunWithStatus): ChatRun => { + return { + id: run.id, + started_at: run.created_at, + agent_id: run.agent_id, + agent_deployment_id: run.agent_deployment_id, + chat_id: run.chat_id, + step_count: run.last_step_number, + status: run.status, + error: run.error, + }; +}; diff --git a/packages/api/src/routes/chats/runs.test.ts b/packages/api/src/routes/chats/runs.test.ts new file mode 100644 index 0000000..1a2b511 --- /dev/null +++ b/packages/api/src/routes/chats/runs.test.ts @@ -0,0 +1,117 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("GET /api/chats/:chat_id/runs", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + + output_files: [ + { + data: "console.log('Hello, world!');", + path: "test.js", + }, + ], + }); + + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + const chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + agent_deployment_id: deployment.id, + }); + + await client.messages.send({ + chat_id: chat.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "Hello, world!" }], + }, + ], + }); + + const runs = await client.chats.runs.list({ + chat_id: chat.id, + }); + expect(runs.items.length).toBe(1); + + let run = await client.chats.runs.get({ + chat_id: chat.id, + run_id: runs.items[0]!.id, + }); + expect(run.agent_id).toBe(agent.id); + expect(run.agent_deployment_id).toBe(deployment.id); + expect(run.status).toBe("streaming"); + + const db = await bindings.database(); + + run = await client.chats.runs.get({ + chat_id: chat.id, + run_id: runs.items[0]!.id, + }); + expect(run.status).toBe("streaming"); + + const steps = await client.chats.steps.list({ + chat_id: chat.id, + run_id: runs.items[0]!.id, + }); + expect(steps.items.length).toBe(1); + const step = steps.items[0]!; + + await db.updateChatRunStep({ + id: step.id, + error: "Test error", + }); + + run = await client.chats.runs.get({ + chat_id: chat.id, + run_id: runs.items[0]!.id, + }); + expect(run.status).toBe("error"); + expect(run.error).toBe("Test error"); + + await db.updateChatRunStep({ + id: step.id, + error: null, + completed_at: new Date(), + }); + + run = await client.chats.runs.get({ + chat_id: chat.id, + run_id: runs.items[0]!.id, + }); + expect(run.status).toBe("completed"); + expect(run.error).toBe(null); + expect(run.step_count).toBe(1); + + await db.insertChatRunStep({ + agent_id: agent.id, + agent_deployment_id: deployment.id, + chat_id: chat.id, + chat_run_id: runs.items[0]!.id, + }); + + run = await client.chats.runs.get({ + chat_id: chat.id, + run_id: runs.items[0]!.id, + }); + expect(run.step_count).toBe(2); + expect(run.status).toBe("streaming"); +}); diff --git a/packages/api/src/routes/chats/steps.client.ts b/packages/api/src/routes/chats/steps.client.ts new file mode 100644 index 0000000..520a274 --- /dev/null +++ b/packages/api/src/routes/chats/steps.client.ts @@ -0,0 +1,113 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaCursorPaginatedRequest, + schemaCursorPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; + +export const schemaChatRunStepStatus = z.enum([ + "streaming", + "stalled", + "completed", + "interrupted", + "error", +]); + +const schemaChatRunStepContinuationReason = z.enum([ + "tool_call", + "queued_message", +]); + +export const schemaChatRunStepSummary = z.object({ + id: z.uuid(), + number: z.number().int().positive(), + chat_id: z.uuid(), + chat_run_id: z.uuid(), + agent_id: z.uuid(), + agent_deployment_id: z.uuid(), + started_at: z.string().datetime(), + status: schemaChatRunStepStatus, + + error: z.string().nullable(), + continuation_reason: schemaChatRunStepContinuationReason.nullable(), + response_status: z.number().nullable(), + response_message_id: z.uuid().nullable(), + time_to_first_token_micros: z.number().nullable(), +}); + +export type ChatRunStepSummary = z.infer; + +const schemaChatRunStep = schemaChatRunStepSummary.extend({ + heartbeat_at: z.date(), + completed_at: z.date().nullable(), + interrupted_at: z.date().nullable(), + first_message_id: z.uuid().nullable(), + last_message_id: z.uuid().nullable(), + response_headers: z.record(z.string(), z.string()).nullable(), + response_headers_redacted: z.boolean(), + response_body: z.string().nullable(), + response_body_redacted: z.boolean(), + usage_model: z.string().nullable(), + usage_total_input_tokens: z.number().nullable(), + usage_total_output_tokens: z.number().nullable(), + usage_total_tokens: z.number().nullable(), + usage_total_cached_input_tokens: z.number().nullable(), + usage_cost_usd: z.number().nullable(), +}); + +export type ChatRunStep = z.infer; + +const schemaListChatRunStepsRequest = schemaCursorPaginatedRequest.extend({ + chat_id: z.uuid(), + run_id: z.uuid().optional(), +}); + +export type ListChatRunStepsRequest = z.infer< + typeof schemaListChatRunStepsRequest +>; + +const schemaListChatRunStepsResponse = schemaCursorPaginatedResponse( + schemaChatRunStepSummary +); + +export type ListChatRunStepsResponse = z.infer< + typeof schemaListChatRunStepsResponse +>; + +export interface GetChatRunStepRequest { + chat_id: string; + step_id: string; +} + +export default class ChatSteps { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public async list( + request: ListChatRunStepsRequest + ): Promise { + const query = new URLSearchParams(); + if (request.run_id) { + query.set("run_id", request.run_id); + } + const resp = await this.client.request( + "GET", + `/api/chats/${request.chat_id}/steps?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + public async get(request: GetChatRunStepRequest): Promise { + const resp = await this.client.request( + "GET", + `/api/chats/${request.chat_id}/steps/${request.step_id}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/chats/steps.server.ts b/packages/api/src/routes/chats/steps.server.ts new file mode 100644 index 0000000..2f4b806 --- /dev/null +++ b/packages/api/src/routes/chats/steps.server.ts @@ -0,0 +1,124 @@ +import type { ChatRunStepWithStatus } from "@blink.so/database/schema"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import z from "zod"; +import { withAuth, withCursorPagination } from "../../middleware"; +import type { APIServer } from "../../server"; +import { withChatURLParam } from "./chats.server"; +import type { + ChatRunStep, + ChatRunStepSummary, + ListChatRunStepsResponse, +} from "./steps.client"; + +export default function mountChatSteps(app: APIServer) { + // List steps for a chat. + app.get( + "/", + withAuth, + withChatURLParam, + withCursorPagination, + validator("query", (value) => { + if (Array.isArray(value["run_id"])) { + throw new HTTPException(400, { + message: "run_id must not be supplied multiple times", + }); + } + const run_id = value["run_id"]; + if (run_id && !z.uuid().safeParse(run_id).success) { + throw new HTTPException(400, { + message: "run_id must be a valid UUID", + }); + } + return { run_id }; + }), + async (c) => { + const db = await c.env.database(); + const steps = await db.selectChatSteps({ + chat_id: c.get("chat").id, + run_id: c.req.valid("query").run_id, + cursor: c.get("cursor"), + limit: c.get("limit"), + }); + + const response: ListChatRunStepsResponse = { + next_cursor: steps.next_cursor, + items: steps.items.map(convertChatRunStepToSummary), + }; + + return c.json(response); + } + ); + + // Get a step for a chat. + app.get("/:step_id", withAuth, withChatURLParam, async (c) => { + const id = c.req.param("step_id"); + if (!z.uuid().safeParse(id).success) { + throw new HTTPException(400, { + message: "step_id must be a valid UUID", + }); + } + const db = await c.env.database(); + const step = await db.selectChatRunStepByID(id); + if (!step || step.chat_id !== c.get("chat").id) { + throw new HTTPException(404, { + message: "Step not found", + }); + } + + return c.json(convertChatRunStep(step)); + }); +} + +const convertChatRunStep = (step: ChatRunStepWithStatus): ChatRunStep => { + return { + id: step.id, + number: step.number, + chat_id: step.chat_id, + chat_run_id: step.chat_run_id, + agent_id: step.agent_id!, + agent_deployment_id: step.agent_deployment_id!, + continuation_reason: step.continuation_reason, + error: step.error, + response_status: step.response_status, + response_message_id: step.response_message_id, + started_at: step.started_at.toISOString(), + status: step.status, + heartbeat_at: step.heartbeat_at, + completed_at: step.completed_at, + interrupted_at: step.interrupted_at, + first_message_id: step.first_message_id, + last_message_id: step.last_message_id, + response_headers: step.response_headers, + response_headers_redacted: step.response_headers_redacted, + response_body: step.response_body, + response_body_redacted: step.response_body_redacted, + time_to_first_token_micros: step.time_to_first_token_micros, + usage_model: step.usage_model, + usage_total_input_tokens: step.usage_total_input_tokens, + usage_total_output_tokens: step.usage_total_output_tokens, + usage_total_tokens: step.usage_total_tokens, + usage_total_cached_input_tokens: step.usage_total_cached_input_tokens, + usage_cost_usd: step.usage_cost_usd, + }; +}; + +const convertChatRunStepToSummary = ( + step: ChatRunStepWithStatus +): ChatRunStepSummary => { + return { + id: step.id, + number: step.number, + chat_id: step.chat_id, + chat_run_id: step.chat_run_id, + agent_id: step.agent_id!, + agent_deployment_id: step.agent_deployment_id!, + continuation_reason: step.continuation_reason, + error: step.error, + response_status: step.response_status, + response_message_id: step.response_message_id, + started_at: step.started_at.toISOString(), + status: step.status, + time_to_first_token_micros: step.time_to_first_token_micros, + }; +}; diff --git a/packages/api/src/routes/chats/steps.test.ts b/packages/api/src/routes/chats/steps.test.ts new file mode 100644 index 0000000..f552880 --- /dev/null +++ b/packages/api/src/routes/chats/steps.test.ts @@ -0,0 +1,68 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("GET /api/chats/:chat_id/steps", async () => { + const { bindings, helpers } = await serve(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + + output_files: [ + { + data: "console.log('Hello, world!');", + path: "test.js", + }, + ], + }); + + const deployments = await client.agents.deployments.list({ + agent_id: agent.id, + }); + expect(deployments.items.length).toBe(1); + const deployment = deployments.items[0]!; + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + const chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + agent_deployment_id: deployment.id, + }); + + await client.messages.send({ + chat_id: chat.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "Hello, world!" }], + }, + ], + }); + + const runs = await client.chats.runs.list({ + chat_id: chat.id, + }); + expect(runs.items.length).toBe(1); + const run = runs.items[0]!; + + const resp = await client.chats.steps.list({ + chat_id: chat.id, + run_id: run.id, + }); + expect(resp.items.length).toBe(1); + expect(resp.items[0]!.status).toBe("streaming"); + + const step = await client.chats.steps.get({ + chat_id: chat.id, + step_id: resp.items[0]!.id, + }); + expect(step.status).toBe("streaming"); +}); diff --git a/packages/api/src/routes/devhook.client.ts b/packages/api/src/routes/devhook.client.ts new file mode 100644 index 0000000..36320f6 --- /dev/null +++ b/packages/api/src/routes/devhook.client.ts @@ -0,0 +1,158 @@ +import type { Disposable } from "@blink-sdk/events"; +import Client from "../client.node"; + +export interface DevhookListenOptions { + readonly id: string; + + readonly onRequest: (req: Request) => Promise; + readonly onConnect?: () => void; + readonly onDisconnect?: () => void; + readonly onError?: (error: unknown) => void; +} + +export default class Devhook { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public listen(options: DevhookListenOptions): Disposable { + let socket: WebSocket | undefined; + let reconnectTimeout: ReturnType | undefined; + let disposed = false; + + // Exponential backoff with jitter + const baseDelayMS = 250; + const maxDelayMS = 10_000; + let currentDelayMS = baseDelayMS; + + const clearReconnectTimer = () => { + if (reconnectTimeout) { + clearTimeout(reconnectTimeout); + reconnectTimeout = undefined; + } + }; + + const scheduleReconnect = () => { + if (disposed) return; + clearReconnectTimer(); + const jitter = currentDelayMS * 0.2 * Math.random(); + const delay = Math.min(maxDelayMS, Math.floor(currentDelayMS + jitter)); + reconnectTimeout = setTimeout(() => { + openSocket(); + }, delay); + currentDelayMS = Math.min(maxDelayMS, Math.floor(currentDelayMS * 1.5)); + }; + + const resetBackoff = () => { + currentDelayMS = baseDelayMS; + }; + + // This is an optional dependency, so we need to require it + // here instead of above. It's optional because using the + // compute protocol is nice, but it takes up a lot of space in the bundle. + const { Server } = + require("@blink-sdk/compute-protocol/server") as typeof import("@blink-sdk/compute-protocol/server"); + + const server = new Server({ + send: (data) => { + const ws = socket; + if (!ws || ws.readyState !== WebSocket.OPEN) { + // If the socket disconnects mid-request, we'll have problems right now. + return; + } + ws.send(data); + }, + fetchProxyRequest(url, init) { + return options.onRequest( + new Request(url, { + ...init, + // @ts-expect-error - This is required for NodeJS: + // https://github.com/nodejs/node/issues/46221 + duplex: init.body ? "half" : undefined, + }) + ); + }, + }); + + const attachListeners = (ws: WebSocket) => { + ws.binaryType = "arraybuffer"; + + ws.addEventListener("open", () => { + if (disposed) return; + resetBackoff(); + options.onConnect?.(); + }); + + ws.addEventListener("close", () => { + if (disposed) return; + options.onDisconnect?.(); + scheduleReconnect(); + }); + + ws.addEventListener("error", (err) => { + try { + options.onError?.(err); + } catch {} + // Ensure we eventually reconnect; some environments may not emit close. + try { + ws.close(); + } catch {} + }); + + ws.addEventListener("message", (event) => { + if (typeof event.data === "string") { + console.warn("Message skipped because it is not a buffer."); + return; + } + try { + server.handleMessage(new Uint8Array(event.data as ArrayBuffer)); + } catch (err) { + console.error("message handler error", err); + try { + ws.close(1011); + } catch {} + } + }); + }; + + const openSocket = () => { + if (disposed) return; + try { + const ws = this.client.websocket(`/api/devhook/${options.id}`); + socket = ws; + attachListeners(ws); + } catch (err) { + // If construction itself fails, surface error and retry + try { + options.onError?.(err); + } catch {} + scheduleReconnect(); + } + }; + + openSocket(); + + return { + dispose: () => { + if (disposed) { + return; + } + disposed = true; + clearReconnectTimer(); + const ws = socket; + socket = undefined; + try { + if ( + ws && + (ws.readyState === WebSocket.OPEN || + ws.readyState === WebSocket.CONNECTING) + ) { + ws.close(1000); + } + } catch {} + }, + }; + } +} diff --git a/packages/api/src/routes/devhook.server.ts b/packages/api/src/routes/devhook.server.ts new file mode 100644 index 0000000..0c83118 --- /dev/null +++ b/packages/api/src/routes/devhook.server.ts @@ -0,0 +1,21 @@ +import { validate } from "uuid"; +import type { APIServer } from "../server"; + +export default function mountDevhook(server: APIServer) { + server.get("/:devhook", async (c) => { + const id = c.req.param("devhook"); + if (!validate(id)) { + return c.json({ message: "Invalid devhook ID" }, 400); + } + if (!c.env.devhook) { + return c.json({ message: "Devhook not enabled" }, 500); + } + // Check if it's already used by an agent. + const db = await c.env.database(); + const agent = await db.selectAgentDeploymentByRequestID(id); + if (agent) { + return c.json({ message: "Devhook already used by an agent" }, 400); + } + return c.env.devhook.handleListen(id, c.req.raw); + }); +} diff --git a/packages/api/src/routes/devhook.test.ts b/packages/api/src/routes/devhook.test.ts new file mode 100644 index 0000000..0b8147d --- /dev/null +++ b/packages/api/src/routes/devhook.test.ts @@ -0,0 +1,44 @@ +import { expect, test } from "bun:test"; +import { serve } from "../test"; + +test("devhook", async () => { + const { helpers, bindings, url } = await serve(); + // This endpoint doesn't actually need auth, we just + // create a user to easily get a client. + const { client } = await helpers.createUser(); + + const id = crypto.randomUUID(); + + let resolveConnect: () => void; + const connectPromise = new Promise((resolve) => { + resolveConnect = resolve; + }); + + let requestReceived = false; + client.devhook.listen({ + id, + onError: (err) => { + console.error("Error", err); + }, + onRequest: async (req) => { + requestReceived = true; + // Verify the request URL is correct. + return new Response("Hello from devhook!"); + }, + onConnect: () => { + resolveConnect?.(); + }, + }); + + // Ensure connection works. + await connectPromise; + + // Test wildcard hostname routing. + // We need to make the request go through the test server with the correct Host header. + const devhookURL = bindings.createRequestURL!(id); + const testURL = new URL("/test/path", devhookURL); + const response = await fetch(testURL); + expect(response.status).toBe(200); + expect(await response.text()).toBe("Hello from devhook!"); + expect(requestReceived).toBe(true); +}); diff --git a/packages/api/src/routes/files.client.ts b/packages/api/src/routes/files.client.ts new file mode 100644 index 0000000..ce60886 --- /dev/null +++ b/packages/api/src/routes/files.client.ts @@ -0,0 +1,29 @@ +import { assertResponseStatus } from "../client-helper"; +import Client from "../client.browser"; + +export interface UploadFileResponse { + id: string; + url: string; +} + +export default class Files { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + public async upload(file: File): Promise { + const formData = new FormData(); + formData.append("file", file); + const resp = await this.client.request("POST", "/api/files", formData); + await assertResponseStatus(resp, 201); + return resp.json(); + } + + public async get(id: string): Promise { + const resp = await this.client.request("GET", `/api/files/${id}`); + await assertResponseStatus(resp, 200); + return new File([await resp.blob()], ""); + } +} diff --git a/packages/api/src/routes/files.server.ts b/packages/api/src/routes/files.server.ts new file mode 100644 index 0000000..f2ebcbd --- /dev/null +++ b/packages/api/src/routes/files.server.ts @@ -0,0 +1,50 @@ +import { validator } from "hono/validator"; +import { MESSAGE_LIMITS } from "../constants"; +import type { APIServer } from "../server"; +import { withToolsAuth } from "./tools/tools.server"; + +export default function mountFiles(server: APIServer) { + // Upload file. + server.post( + "/", + withToolsAuth(), + validator("form", (value, c) => { + const file = value["file"]; + if (!file) { + return c.json({ message: "No file provided" }, 400); + } + if (!(file instanceof File)) { + return c.json({ message: "File is not a File" }, 400); + } + if (file.size > MESSAGE_LIMITS.MAX_FILE_UPLOAD_SIZE_BYTES) { + return c.json( + { + message: `File is too large (${Math.round(file.size / 1024 / 1024)}MB). Maximum allowed: ${Math.round(MESSAGE_LIMITS.MAX_FILE_UPLOAD_SIZE_BYTES / 1024 / 1024)}MB`, + }, + 413 + ); + } + return file; + }), + async (c) => { + const file = c.req.valid("form"); + const { id, url } = await c.env.files.upload({ + user_id: c.get("user_id"), + agent_id: c.get("agent_id"), + file, + }); + return c.json({ id, url }, 201); + } + ); + + server.get("/:id", async (c) => { + const id = c.req.param("id"); + const file = await c.env.files.download(id); + return c.body(file.stream, 200, { + "Content-Type": file.type, + "Content-Length": file.size.toString(), + // Inline to prevent the browser from downloading the file. + "Content-Disposition": `inline; filename="${file.name}"`, + }); + }); +} diff --git a/packages/api/src/routes/files.test.ts b/packages/api/src/routes/files.test.ts new file mode 100644 index 0000000..11eff82 --- /dev/null +++ b/packages/api/src/routes/files.test.ts @@ -0,0 +1,14 @@ +import { expect, test } from "bun:test"; +import { serve } from "../test"; + +test("POST+GET /api/files", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + const file = new File(["Hello, world!"], "test.txt"); + const resp = await client.files.upload(file); + expect(resp.id).toBeString(); + expect(resp.url).toBeString(); + + const fileResp = await client.files.get(resp.id); + expect(await fileResp.text()).toBe("Hello, world!"); +}); diff --git a/packages/api/src/routes/invites.client.ts b/packages/api/src/routes/invites.client.ts new file mode 100644 index 0000000..641c8e7 --- /dev/null +++ b/packages/api/src/routes/invites.client.ts @@ -0,0 +1,141 @@ +import { z } from "zod"; +import { assertResponseStatus } from "../client-helper"; +import Client from "../client.browser"; +import { + schemaOrganizationRole, + type OrganizationMembership, +} from "./organizations/members.client"; + +export const schemaOrganizationInvite = z.object({ + id: z.uuid(), + organization_id: z.uuid(), + role: schemaOrganizationRole, + invited_by: z.uuid(), + expires_at: z.date(), + created_at: z.date(), + updated_at: z.date(), + reusable: z.boolean(), + accepted_at: z.date().nullable(), + email: z.string().email().nullable(), +}); + +export type OrganizationInvite = z.infer; + +export type OrganizationInviteWithCode = OrganizationInvite & { + code: string; +}; + +export const schemaCreateOrganizationInviteRequest = z.object({ + organization_id: z.uuid(), + role: schemaOrganizationRole, + email: z.string().email().optional(), + reusable: z.boolean().optional(), +}); + +export type CreateOrganizationInviteRequest = z.infer< + typeof schemaCreateOrganizationInviteRequest +>; + +export const schemaListOrganizationInvitesRequest = z.object({ + organization_id: z.uuid(), +}); + +export type ListOrganizationInvitesRequest = z.infer< + typeof schemaListOrganizationInvitesRequest +>; + +export const schemaDeleteOrganizationInviteRequest = z.object({ + organization_id: z.uuid(), + invite_id: z.uuid(), +}); + +export type DeleteOrganizationInviteRequest = z.infer< + typeof schemaDeleteOrganizationInviteRequest +>; + +export const schemaAcceptOrganizationInviteRequestBody = z.object({ + code: z.string(), +}); + +export const schemaAcceptOrganizationInviteRequest = + schemaAcceptOrganizationInviteRequestBody.extend({ + invite_id: z.uuid(), + }); + +export type AcceptOrganizationInviteRequest = z.infer< + typeof schemaAcceptOrganizationInviteRequest +>; + +export default class Invites { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * Invite a user to an organization. + * + * @param request - The request body. + * @returns The created invite. + */ + public async create( + request: CreateOrganizationInviteRequest + ): Promise { + const resp = await this.client.request( + "POST", + `/api/invites`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 201); + return resp.json(); + } + + /** + * List invites for an organization. + * + * @param request - The request body. + * @returns The list of invites with codes. + */ + public async list( + request: ListOrganizationInvitesRequest + ): Promise { + const resp = await this.client.request( + "GET", + `/api/invites?organization_id=${request.organization_id}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete an invite for an organization. + * + * @param request - The request body. + * @returns The deleted invite. + */ + public async delete(request: DeleteOrganizationInviteRequest): Promise { + const resp = await this.client.request( + "DELETE", + `/api/invites/${request.invite_id}` + ); + await assertResponseStatus(resp, 204); + } + + /** + * Accept an invite for the current authenticated user. + */ + public async accept( + request: AcceptOrganizationInviteRequest + ): Promise { + const resp = await this.client.request( + "POST", + `/api/invites/${request.invite_id}/accept`, + JSON.stringify({ code: request.code } as z.infer< + typeof schemaAcceptOrganizationInviteRequestBody + >) + ); + await assertResponseStatus(resp, 201); + return resp.json(); + } +} diff --git a/packages/api/src/routes/invites.server.ts b/packages/api/src/routes/invites.server.ts new file mode 100644 index 0000000..2cb5bb1 --- /dev/null +++ b/packages/api/src/routes/invites.server.ts @@ -0,0 +1,233 @@ +import type { + OrganizationInvite as DBOrganizationInvite, + OrganizationMembership as DBOrganizationMembership, +} from "@blink.so/database/schema"; +import type { MiddlewareHandler } from "hono"; +import { validator } from "hono/validator"; +import { z } from "zod"; +import { + authorizeOrganization, + withAuth, + withOrganizationIDQueryParam, +} from "../middleware"; +import type { APIServer, Bindings } from "../server"; +import { + schemaAcceptOrganizationInviteRequestBody, + schemaCreateOrganizationInviteRequest, + type OrganizationInvite, + type OrganizationInviteWithCode, +} from "./invites.client"; +import type { OrganizationMembership } from "./organizations/members.client"; + +export default function mountInvites(server: APIServer) { + // List invites for an organization. + server.get("/", withAuth, withOrganizationIDQueryParam, async (c) => { + const db = await c.env.database(); + const org = c.get("organization"); + const invites = await db.selectOrganizationInvitesByOrganizationID(org.id); + return c.json(invites.map(convertInviteWithCode)); + }); + + // Create an invite for an organization. + server.post( + "/", + withAuth, + validator("json", (value, c) => { + return schemaCreateOrganizationInviteRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const req = c.req.valid("json"); + const organization = await authorizeOrganization(c, req.organization_id); + + // Only owners and admins can create invites. + if ( + !organization.membership || + (organization.membership.role !== "owner" && + organization.membership.role !== "admin") + ) { + return c.json({ message: "Forbidden" }, 403); + } + + const invite = await db.insertOrganizationInvite({ + organization_id: organization.id, + email: req.email, + role: req.role, + invited_by: c.get("user_id"), + reusable: req.reusable, + }); + + // Sync invited user to telemetry system (async, don't block) + if (c.env.sendTelemetryEvent && invite.email) { + db.selectOrganizationByID(organization.id) + .then((org) => { + if (!invite.email || !c.env.sendTelemetryEvent) return; + return c.env.sendTelemetryEvent({ + type: "user.invited", + email: invite.email, + }); + }) + .catch(() => { + // Ignore errors to avoid breaking invite creation + }); + } + + // Trigger email notification for non-reusable invites + if (!req.reusable && req.email && c.env.sendEmail) { + try { + const [inviter, org] = await Promise.all([ + db.selectUserByID(c.get("user_id")), + db.selectOrganizationByID(organization.id), + ]); + + if (inviter && org) { + const baseUrl = c.env.apiBaseURL.origin; + await c.env.sendEmail({ + type: "invite", + email: req.email, + inviterName: + inviter.display_name || inviter.username || "Someone", + inviterEmail: inviter.email || "", + teamName: org.name, + role: req.role, + inviteUrl: `${baseUrl}/invite/${invite.code}`, + }); + } + } catch (error) { + console.error("Failed to send invite email:", error); + // Don't fail the request if email fails + } + } + + const inviteWithCode: OrganizationInviteWithCode = { + ...convertInvite(invite), + code: invite.code, + }; + + return c.json(inviteWithCode, 201); + } + ); + + // Delete an invite for an organization. + server.delete("/:invite_id", withAuth, withInviteIDParam, async (c) => { + const db = await c.env.database(); + const invite = c.get("invite"); + const org = await authorizeOrganization(c, invite.organization_id); + // Only the user who created the invite or owners and admins can delete it. + if ( + invite.invited_by !== c.get("user_id") && + (!org.membership || + (org.membership.role !== "owner" && org.membership.role !== "admin")) + ) { + return c.json({ message: "Forbidden" }, 403); + } + await db.deleteOrganizationInvite(invite.id); + return c.body(null, 204); + }); + + // Accept an invite for the authenticated user. + server.post( + "/:invite_id/accept", + withAuth, + withInviteIDParam, + validator("json", (value, c) => { + return schemaAcceptOrganizationInviteRequestBody.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const invite = c.get("invite"); + const req = c.req.valid("json"); + + // First check if the invite is expired. + if (invite.expires_at && new Date() > invite.expires_at) { + return c.json({ message: "Invite has expired" }, 400); + } + + // Check if the invite has already been accepted, and is not reusable. + if (invite.last_accepted_at && !invite.reusable) { + return c.json({ message: "Invite has already been used" }, 400); + } + + // Check if the code is correct. + if (invite.code !== req.code) { + return c.json({ message: "Invalid code" }, 400); + } + + const userId = c.get("user_id"); + + const membership = await db.tx(async (tx) => { + const membership = await tx.insertOrganizationMembership({ + organization_id: invite.organization_id, + user_id: userId, + role: invite.role, + }); + await tx.updateOrganizationInvite(invite.id, { + last_accepted_at: new Date(), + }); + return membership; + }); + + return c.json(convertOrganizationMembership(membership), 201); + } + ); +} + +const withInviteIDParam: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + invite_id: string; + invite: DBOrganizationInvite; + }; +}> = async (c, next) => { + const inviteID = c.req.param("invite_id"); + if (!inviteID) { + return c.json({ message: "Invite ID is required" }, 400); + } + const parsed = await z.uuid().safeParseAsync(inviteID); + if (!parsed.success) { + return c.json({ message: "Invalid invite ID" }, 400); + } + const db = await c.env.database(); + const invite = await db.selectOrganizationInviteByID(parsed.data); + if (!invite) { + return c.json({ message: "Invite not found" }, 404); + } + c.set("invite", invite); + await next(); +}; + +const convertInvite = (invite: DBOrganizationInvite): OrganizationInvite => { + return { + id: invite.id, + organization_id: invite.organization_id, + email: invite.email!, + role: invite.role, + invited_by: invite.invited_by, + expires_at: invite.expires_at!, + created_at: invite.created_at, + updated_at: invite.updated_at, + accepted_at: invite.last_accepted_at ?? null, + reusable: invite.reusable, + }; +}; + +const convertInviteWithCode = ( + invite: DBOrganizationInvite +): OrganizationInviteWithCode => { + return { + ...convertInvite(invite), + code: invite.code, + }; +}; + +const convertOrganizationMembership = ( + membership: DBOrganizationMembership +): OrganizationMembership => { + return { + organization_id: membership.organization_id, + user_id: membership.user_id, + role: membership.role, + created_at: membership.created_at, + updated_at: membership.updated_at, + }; +}; diff --git a/packages/api/src/routes/invites.test.ts b/packages/api/src/routes/invites.test.ts new file mode 100644 index 0000000..7216b46 --- /dev/null +++ b/packages/api/src/routes/invites.test.ts @@ -0,0 +1,104 @@ +import { expect, test } from "bun:test"; +import { serve } from "../test"; + +test("CRUD /api/invites", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + expect(org.membership?.user_id).toBe(user.id); + expect(org.membership?.role).toBe("owner"); + + // No initial invites. + let invites = await client.invites.list({ + organization_id: org.id, + }); + expect(invites).toEqual([]); + + // Create an invite. + const invite = await client.invites.create({ + organization_id: org.id, + email: "member@example.com", + role: "member", + }); + expect(invite.organization_id).toBe(org.id); + expect(invite.email).toBe("member@example.com"); + expect(invite.role).toBe("member"); + expect(invite.id).toBeString(); + + // List invites. + invites = await client.invites.list({ + organization_id: org.id, + }); + expect(invites.length).toBe(1); + expect(invites[0]!.id).toBe(invite.id); + + // Delete the invite. + await client.invites.delete({ + organization_id: org.id, + invite_id: invite.id, + }); + + // Ensure it's gone. + invites = await client.invites.list({ + organization_id: org.id, + }); + expect(invites).toEqual([]); +}); + +// Non-reusable invite can only be accepted once and sets accepted_at +test("Single-use invite: first accept succeeds, second accept fails; accepted_at set", async () => { + const { helpers } = await serve(); + + const { client: ownerClient } = await helpers.createUser(); + const org = await ownerClient.organizations.create({ name: "test-org" }); + + const { client: firstInvitee } = await helpers.createUser(); + const { client: secondInvitee } = await helpers.createUser(); + + // Create a non-reusable (single-use) invite explicitly + const invite = await ownerClient.invites.create({ + organization_id: org.id, + role: "member", + reusable: false, + }); + + // First invitee accepts successfully + await firstInvitee.invites.accept({ + invite_id: invite.id, + code: invite.code, + }); + + // accepted_at should now be set when listing invites + const invites = await ownerClient.invites.list({ organization_id: org.id }); + const listed = invites.find((i) => i.id === invite.id); + expect(listed).toBeTruthy(); + expect(listed!.accepted_at).toBeTruthy(); + + // Second invitee attempting to accept the same single-use invite should fail + await expect( + secondInvitee.invites.accept({ invite_id: invite.id, code: invite.code }) + ).rejects.toThrow("Invite has already been used"); +}); + +// Invalid invite code results in 400 +test("Invite accept with invalid code returns 400", async () => { + const { helpers } = await serve(); + + const { client: ownerClient } = await helpers.createUser(); + const org = await ownerClient.organizations.create({ name: "test-org" }); + + const { client: invitee } = await helpers.createUser(); + + const invite = await ownerClient.invites.create({ + organization_id: org.id, + role: "member", + reusable: false, + }); + + await expect( + invitee.invites.accept({ invite_id: invite.id, code: "WRONG-CODE" }) + ).rejects.toThrow("Invalid code"); +}); diff --git a/packages/api/src/routes/messages.client.ts b/packages/api/src/routes/messages.client.ts new file mode 100644 index 0000000..9a82b0a --- /dev/null +++ b/packages/api/src/routes/messages.client.ts @@ -0,0 +1,194 @@ +import type { UIMessagePart } from "ai"; +import { z } from "zod"; +import { + assertResponseStatus, + schemaCursorPaginatedRequest, + schemaCursorPaginatedResponse, + schemaMetadata, +} from "../client-helper"; +import Client from "../client.browser"; + +export const schemaChatMessageFormat = z.enum(["ai-sdk"]); +export const schemaAISDKMessageParts = z.array( + z.custom>() +); +export const schemaChatMessageRole = z.enum(["user", "assistant", "system"]); +export type ChatMessageRole = z.infer; +export type AISDKMessageParts = z.infer; +export type ChatMessageFormat = z.infer; + +const schemaChatMessageBase = z.object({ + id: z.uuid(), + created_at: z.string().datetime(), + chat_id: z.uuid(), + metadata: schemaMetadata, +}); + +// Eventually, we may want to provide other formats as well. +const schemaChatMessageFormatAISDK = schemaChatMessageBase.extend({ + format: z.literal("ai-sdk"), + parts: schemaAISDKMessageParts, + role: schemaChatMessageRole, +}); + +export const schemaChatMessage = z.discriminatedUnion("format", [ + schemaChatMessageFormatAISDK, +]); + +export type ChatMessage = z.infer; + +export const schemaListChatMessagesRequest = + schemaCursorPaginatedRequest.extend({ + chat_id: z.uuid(), + format: schemaChatMessageFormat.default("ai-sdk").optional(), + }); + +export type ListChatMessagesRequest = z.infer< + typeof schemaListChatMessagesRequest +>; + +export const schemaListChatMessagesResponse = + schemaCursorPaginatedResponse(schemaChatMessage); + +export type ListChatMessagesResponse = z.infer< + typeof schemaListChatMessagesResponse +>; + +export const schemaDeleteChatMessageRequest = z.object({ + chat_id: z.uuid(), + message_id: z.uuid(), +}); + +export type DeleteChatMessageRequest = z.infer< + typeof schemaDeleteChatMessageRequest +>; + +export const schemaCreateChatMessage = z.object({ + id: z.uuid().optional(), + role: schemaChatMessageRole, + parts: schemaAISDKMessageParts, + metadata: schemaMetadata.optional(), + format: z.literal("ai-sdk").optional(), +}); + +export type CreateChatMessage = z.infer; + +export const schemaUpdateMessageRequest = z.object({ + message_id: z.uuid(), + metadata: schemaMetadata.optional(), + role: schemaChatMessageRole.optional(), + parts: schemaAISDKMessageParts.optional(), + format: z.literal("ai-sdk").optional(), + behavior: z.enum(["interrupt", "enqueue", "none"]).optional(), +}); + +export type UpdateMessageRequest = z.infer; + +export const schemaSendMessagesBehavior = z.enum([ + // Add messages and start eventually. + "enqueue", + // Add messages and start instantly. + "interrupt", + // Add only. Don't start. + "append", +]); + +export type SendMessagesBehavior = z.infer; + +export const schemaSendMessagesRequest = z.object({ + chat_id: z.uuid(), + behavior: schemaSendMessagesBehavior.optional(), + messages: z.array(schemaCreateChatMessage).min(1), +}); + +export type SendMessagesRequest = z.infer; + +export const schemaSendMessagesResponse = z.object({ + messages: z.array(schemaChatMessage), +}); + +export type SendMessagesResponse = z.infer; + +export default class Messages { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * List messages for a chat. + * + * @param request - The request body. + * @returns The list of messages. + */ + public async list( + request: ListChatMessagesRequest + ): Promise { + const query = new URLSearchParams(); + query.set("chat_id", request.chat_id); + if (request.limit) { + query.set("limit", request.limit.toString()); + } + if (request.cursor) { + query.set("cursor", request.cursor); + } + if (request.format) { + query.set("format", request.format); + } + const resp = await this.client.request( + "GET", + `/api/messages?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete a message. + * + * @param request - The request body. + */ + public async delete(id: string): Promise { + const resp = await this.client.request("DELETE", `/api/messages/${id}`); + await assertResponseStatus(resp, 204); + } + + /** + * Get a message. + * + * @param id - The ID of the message. + * @returns The message. + */ + public async get(id: string): Promise { + const resp = await this.client.request("GET", `/api/messages/${id}`); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + public async update(request: UpdateMessageRequest): Promise { + const resp = await this.client.request( + "PUT", + `/api/messages/${request.message_id}`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + } + + /** + * Send messages to a chat. + * + * @param request - The request body. + */ + public async send( + request: SendMessagesRequest + ): Promise { + const resp = await this.client.request( + "POST", + `/api/messages`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 201); + return resp.json(); + } +} diff --git a/packages/api/src/routes/messages.server.ts b/packages/api/src/routes/messages.server.ts new file mode 100644 index 0000000..7125990 --- /dev/null +++ b/packages/api/src/routes/messages.server.ts @@ -0,0 +1,441 @@ +import * as convert from "@blink.so/database/convert"; +import type { + Chat as DBChat, + DBMessage, + OrganizationWithMembership, +} from "@blink.so/database/schema"; +import { TypeValidationError, validateUIMessages } from "ai"; +import type { Context, MiddlewareHandler } from "hono"; +import { HTTPException } from "hono/http-exception"; +import { validator } from "hono/validator"; +import { MESSAGE_LIMITS } from "../constants"; +import { withAuth, withCursorPagination } from "../middleware"; +import type { APIServer, Bindings } from "../server"; +import { authorizeChat } from "./chats/chats.server"; +import { + schemaChatMessageFormat, + schemaSendMessagesRequest, + schemaUpdateMessageRequest, + type AISDKMessageParts, + type ChatMessageRole, + type ListChatMessagesResponse, + type SendMessagesBehavior, + type SendMessagesRequest, + type SendMessagesResponse, +} from "./messages.client"; + +export default function mountMessages(server: APIServer) { + // Debug message - redirects to traces page with appropriate filters + server.get("/:message_id/debug", withAuth, withMessageURLParam, async (c) => { + const message = c.get("message"); + const chat = c.get("chat"); + const organization = c.get("organization"); + const db = await c.env.database(); + + if (!chat.agent_id) { + throw new HTTPException(400, { + message: "Chat does not have an associated agent!", + }); + } + + const agent = await db.selectAgentByID(chat.agent_id); + if (!agent) { + throw new HTTPException(404, { message: "Agent not found!" }); + } + + // Build filters JSON based on available IDs + const filters: { + type: "and"; + filters: Array<{ type: "eq"; key: string; value: string }>; + } = { + type: "and", + filters: [ + { + type: "eq", + key: "span.parent_span_id", + value: "", + }, + ], + }; + filters.filters.push({ + type: "eq", + key: "resource.attributes.blink.chat_id", + value: message.chat_id, + }); + if (message.chat_run_step_id) { + filters.filters.push({ + type: "eq", + key: "resource.attributes.blink.step_id", + value: message.chat_run_step_id, + }); + } + if (message.chat_run_id) { + filters.filters.push({ + type: "eq", + key: "resource.attributes.blink.run_id", + value: message.chat_run_id, + }); + } + + // Calculate start_time and end_time (±15 minutes from message time) + // Using a short time range will result in a quick ClickHouse query, since + // spans are indexed by start_time. + const messageTime = new Date(message.created_at); + let startTime = new Date(messageTime.getTime() - 15 * 60 * 1000); // 15 minutes before + const endTime = new Date(messageTime.getTime() + 15 * 60 * 1000); // 15 minutes after + if (message.role === "user") { + // user messages will only contain the chat id filter, so they may contain spans + // unrelated to the actual user message. we limit the time range to 30 seconds before + // to avoid showing too many irrelevant spans. + startTime = new Date(messageTime.getTime() - 30 * 1000); + } + + // Build the redirect URL + const redirectUrl = `/${organization.name}/${agent.name}/traces?filters=${encodeURIComponent(JSON.stringify(filters))}&start_time=${encodeURIComponent(startTime.toISOString())}&end_time=${encodeURIComponent(endTime.toISOString())}`; + + return c.redirect(redirectUrl); + }); + + // List messages. + server.get( + "/", + withAuth, + withChatQueryParam, + withCursorPagination, + validator("query", (data) => { + return { + format: schemaChatMessageFormat.parse(data.format ?? "ai-sdk"), + }; + }), + async (c) => { + const chat = c.get("chat"); + const db = await c.env.database(); + const req = c.req.valid("query"); + const messages = await db.selectChatMessages({ + chatID: chat.id, + cursor: c.get("cursor"), + limit: c.get("limit"), + }); + + const resp: ListChatMessagesResponse = { + next_cursor: messages.next_cursor, + items: messages.items.map((message) => + convert.message(req.format, message) + ), + }; + return c.json(resp); + } + ); + + // Delete a message. + server.delete("/:message_id", withAuth, withMessageURLParam, async (c) => { + const db = await c.env.database(); + const message = c.get("message"); + await db.deleteChatMessage(message.id); + return c.body(null, 204); + }); + + // Get a message. + server.get("/:message_id", withAuth, withMessageURLParam, async (c) => { + const message = c.get("message"); + return c.json(convert.message("ai-sdk", message)); + }); + + // Update a message. + server.put( + "/:message_id", + withAuth, + withMessageURLParam, + validator("json", (data) => { + return schemaUpdateMessageRequest.parse(data); + }), + async (c) => { + const db = await c.env.database(); + const req = c.req.valid("json"); + const message = c.get("message"); + + await validateMessages([ + { + role: req.role ?? message.role, + parts: req.parts ?? message.parts, + }, + ]); + + const updates: Partial = {}; + if (req.role) { + updates.role = req.role; + } + if (req.parts) { + updates.parts = req.parts; + } + if (req.metadata) { + updates.metadata = req.metadata; + } + + const updated = await db.updateChatMessage({ + id: message.id, + ...updates, + }); + + await c.env.chat.handleMessagesChanged( + "message.updated", + message.chat_id, + [updated] + ); + + if (req.behavior && req.behavior !== "none") { + await c.env.chat.handleStart({ + id: message.chat_id, + interrupt: req.behavior === "interrupt", + }); + } + + return c.json(convert.message(req.format ?? "ai-sdk", updated), 200); + } + ); + + // Send a message. + server.post( + "/", + withAuth, + validator("json", (data) => { + return schemaSendMessagesRequest.parse(data); + }), + async (c) => { + const req = c.req.valid("json"); + const { chat } = await authorizeChat(c, req.chat_id); + + await validateMessages(req.messages); + + if (!chat.agent_id) { + throw new HTTPException(400, { + message: "Chat has no agent. Legacy chats cannot use this endpoint.", + }); + } + + const messages = await handleInsertMessages(c, { + chat, + messages: req.messages, + // By default, we enqueue messages. + behavior: req.behavior ?? "enqueue", + agent_id: chat.agent_id, + agent_deployment_id: chat.agent_deployment_id ?? undefined, + }); + + const resp: SendMessagesResponse = { + messages: messages.map((message) => convert.message("ai-sdk", message)), + }; + + return c.json(resp, 201); + } + ); +} + +// Estimate the size of a message part in bytes +function estimatePartSize(part: AISDKMessageParts[number]): number { + const json = JSON.stringify(part); + return Buffer.byteLength(json, "utf-8"); +} + +// Extract data URL content length +function getDataUrlSize(url: string): number { + if (!url.startsWith("data:")) { + return 0; + } + + const commaIndex = url.indexOf(","); + if (commaIndex === -1) { + return 0; + } + + const data = url.slice(commaIndex + 1); + const isBase64 = url.slice(0, commaIndex).includes("base64"); + + if (isBase64) { + // Base64 encoded: 4 chars = 3 bytes + const base64Data = data.replace(/=/g, ""); + return Math.floor((base64Data.length * 3) / 4); + } else { + return Buffer.byteLength(decodeURIComponent(data), "utf-8"); + } +} + +export function validateMessageSizes( + messages: Array<{ + role: ChatMessageRole; + parts: AISDKMessageParts; + }> +): void { + for (const message of messages) { + if (message.parts.length > MESSAGE_LIMITS.MAX_PARTS_PER_MESSAGE) { + throw new HTTPException(413, { + message: `Message has too many parts (${message.parts.length}). Maximum allowed: ${MESSAGE_LIMITS.MAX_PARTS_PER_MESSAGE}`, + }); + } + + let totalMessageSize = 0; + + for (const part of message.parts) { + const partSize = estimatePartSize(part); + + if (part.type === "file" && part.url) { + const dataUrlSize = getDataUrlSize(part.url); + if (dataUrlSize > MESSAGE_LIMITS.MAX_PART_SIZE_BYTES) { + throw new HTTPException(413, { + message: `File data URL is too large (${Math.round(dataUrlSize / 1024 / 1024)}MB). Maximum allowed: ${Math.round(MESSAGE_LIMITS.MAX_PART_SIZE_BYTES / 1024 / 1024)}MB. Use the /api/files endpoint for large files.`, + }); + } + } + + if (partSize > MESSAGE_LIMITS.MAX_PART_SIZE_BYTES) { + throw new HTTPException(413, { + message: `Message part is too large (${Math.round(partSize / 1024 / 1024)}MB). Maximum allowed: ${Math.round(MESSAGE_LIMITS.MAX_PART_SIZE_BYTES / 1024 / 1024)}MB`, + }); + } + + totalMessageSize += partSize; + } + + if (totalMessageSize > MESSAGE_LIMITS.MAX_MESSAGE_SIZE_BYTES) { + throw new HTTPException(413, { + message: `Total message size is too large (${Math.round(totalMessageSize / 1024 / 1024)}MB). Maximum allowed: ${Math.round(MESSAGE_LIMITS.MAX_MESSAGE_SIZE_BYTES / 1024 / 1024)}MB`, + }); + } + } +} + +export const validateMessages = async ( + messages: Array<{ + role: ChatMessageRole; + parts: AISDKMessageParts; + }> +): Promise => { + // Validate message sizes first + validateMessageSizes(messages); + + try { + await validateUIMessages({ + messages: messages.map((message, index) => { + return { + // It needs an index to validate the schema. + id: `${index}`, + role: message.role, + parts: message.parts, + }; + }), + }); + } catch (error) { + if (error instanceof TypeValidationError) { + throw new HTTPException(400, { + message: "Invalid message parts", + cause: error.message, + }); + } + throw error; + } +}; + +const withMessageURLParam: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + chat: DBChat; + message: DBMessage; + organization: OrganizationWithMembership; + }; +}> = async (c, next) => { + const id = c.req.param("message_id"); + if (!id) { + return c.json({ message: "Message ID is required" }, 400); + } + const db = await c.env.database(); + const message = await db.selectMessageByID({ id }); + if (!message) { + return c.json({ message: "Message not found" }, 404); + } + // Use authorizeChat to properly check permissions. + const { chat, organization } = await authorizeChat(c, message.chat_id); + c.set("chat", chat); + c.set("organization", organization); + c.set("message", message); + await next(); +}; + +const withChatQueryParam: MiddlewareHandler<{ + Bindings: Bindings; + Variables: { + user_id: string; + chat: DBChat; + organization: OrganizationWithMembership; + }; +}> = async (c, next) => { + const id = c.req.query("chat_id"); + if (!id) { + return c.json( + { message: `The \"chat_id\" query parameter is required` }, + 400 + ); + } + // Use authorizeChat to properly check permissions. + const { chat, organization } = await authorizeChat(c, id); + c.set("chat", chat); + c.set("organization", organization); + await next(); +}; + +// handleInsertMessages is a helper function that anywhere in the codebase +// can use to properly insert messages and maybe start a chat run. +export const handleInsertMessages = async ( + c: Context<{ + Bindings: Bindings; + Variables: any; + }>, + req: { + chat: Pick; + messages: SendMessagesRequest["messages"]; + behavior: SendMessagesBehavior; + agent_id: string; + agent_deployment_id?: string; + } +) => { + const db = await c.env.database(); + + const messages = await db.insertMessages({ + messages: req.messages.map((message) => ({ + chat_id: req.chat.id, + role: message.role, + parts: message.parts, + metadata: message.metadata, + })), + }); + + if (req.behavior !== "append") { + await db.reconcileChatRun({ + behavior: req.behavior, + chat_id: req.chat.id, + agent_id: req.agent_id, + agent_deployment_id: req.agent_deployment_id, + }); + + await c.env.chat.handleStart({ + id: req.chat.id, + interrupt: req.behavior === "interrupt", + }); + } + + // Publish these messages to the chat. + // We can do this in the background so we don't block the request. + c.executionCtx.waitUntil( + c.env.chat.handleMessagesChanged("message.created", req.chat.id, messages) + ); + + // Generate title from first message(s) if chat has no title + if (!req.chat.title && c.env.chat.generateTitle) { + c.env.chat.generateTitle({ + messages: req.messages, + id: req.chat.id, + }); + } + + return messages; +}; diff --git a/packages/api/src/routes/messages.test.ts b/packages/api/src/routes/messages.test.ts new file mode 100644 index 0000000..0e4a370 --- /dev/null +++ b/packages/api/src/routes/messages.test.ts @@ -0,0 +1,252 @@ +import { describe, expect, test } from "bun:test"; +import { HTTPException } from "hono/http-exception"; +import { MESSAGE_LIMITS } from "../constants"; +import { serve } from "../test"; +import { validateMessageSizes } from "./messages.server"; + +test("CRUD /api/messages", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + const agent = await client.agents.create({ + organization_id: org.id, + name: "test-agent", + }); + + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + entrypoint: "test.js", + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + await client.agents.update({ + id: agent.id, + active_deployment_id: deployment.id, + }); + + const chat = await client.chats.create({ + organization_id: org.id, + agent_id: agent.id, + }); + + // Send a message. + const sendResp = await client.messages.send({ + chat_id: chat.id, + messages: [ + { + role: "user", + parts: [{ type: "text", text: "Hello, world!" }], + metadata: { + foo: "bar", + }, + }, + ], + }); + expect(sendResp.messages.length).toBe(1); + const created = sendResp.messages[0]!; + expect(created.chat_id).toBe(chat.id); + expect(created.role).toBe("user"); + expect(created.parts[0]).toEqual({ type: "text", text: "Hello, world!" }); + expect(created.metadata).toEqual({ foo: "bar" }); + + // List messages. + let list = await client.messages.list({ + chat_id: chat.id, + }); + expect(list.items.length).toBe(1); + expect(list.items[0]).toEqual(created); + expect(list.next_cursor).toBeNull(); + + await client.messages.update({ + message_id: created.id, + role: "assistant" as const, + parts: [{ type: "text", text: "Updated" }], + metadata: { baz: "qux" }, + }); + + // Verify the update via list. + list = await client.messages.list({ chat_id: chat.id }); + expect(list.items.length).toBe(1); + const updated = list.items[0]!; + expect(updated.id).toBe(created.id); + expect(updated.role).toBe("assistant"); + expect(updated.parts[0]).toEqual({ type: "text", text: "Updated" }); + expect(updated.metadata).toEqual({ baz: "qux" }); + + // Delete the message. + await client.messages.delete(updated.id); + + // List again. + list = await client.messages.list({ chat_id: chat.id }); + expect(list.items.length).toBe(0); + expect(list.next_cursor).toBeNull(); +}); + +describe("validateMessageSizes", () => { + test("accepts valid small messages", () => { + expect(() => + validateMessageSizes([ + { + role: "user", + parts: [ + { type: "text", text: "Hello world" }, + { type: "text", text: "How are you?" }, + ], + }, + ]) + ).not.toThrow(); + }); + + test("rejects message with too many parts", () => { + const parts = Array.from( + { length: MESSAGE_LIMITS.MAX_PARTS_PER_MESSAGE + 1 }, + (_, i) => ({ + type: "text" as const, + text: `Part ${i}`, + }) + ); + + expect(() => + validateMessageSizes([ + { + role: "user", + parts, + }, + ]) + ).toThrow(HTTPException); + }); + + test("rejects file with oversized data URL", () => { + const size = MESSAGE_LIMITS.MAX_PART_SIZE_BYTES + 1024; + const data = "A".repeat(size); + const base64 = Buffer.from(data).toString("base64"); + const dataUrl = `data:text/plain;base64,${base64}`; + + expect(() => + validateMessageSizes([ + { + role: "user", + parts: [ + { + type: "file", + mediaType: "text/plain", + url: dataUrl, + }, + ], + }, + ]) + ).toThrow(HTTPException); + }); + + test("accepts file with data URL under size limit", () => { + const data = "Hello, this is a small file"; + const base64 = Buffer.from(data).toString("base64"); + const dataUrl = `data:text/plain;base64,${base64}`; + + expect(() => + validateMessageSizes([ + { + role: "user", + parts: [ + { + type: "file", + mediaType: "text/plain", + url: dataUrl, + }, + ], + }, + ]) + ).not.toThrow(); + }); + + test("rejects single part that is too large", () => { + const hugeText = "X".repeat(MESSAGE_LIMITS.MAX_PART_SIZE_BYTES + 1024); + + expect(() => + validateMessageSizes([ + { + role: "user", + parts: [ + { + type: "text", + text: hugeText, + }, + ], + }, + ]) + ).toThrow(HTTPException); + }); + + test("rejects message where total size exceeds limit", () => { + const partSize = MESSAGE_LIMITS.MAX_MESSAGE_SIZE_BYTES / 10; + const parts = Array.from({ length: 12 }, (_, i) => ({ + type: "text" as const, + text: "X".repeat(partSize), + })); + + expect(() => + validateMessageSizes([ + { + role: "user", + parts, + }, + ]) + ).toThrow(HTTPException); + }); + + test("accepts hosted file URLs without size checking", () => { + expect(() => + validateMessageSizes([ + { + role: "user", + parts: [ + { + type: "file", + mediaType: "image/png", + url: "https://example.com/huge-file.png", + }, + ], + }, + ]) + ).not.toThrow(); + }); + + test("provides helpful error message for oversized data URL", () => { + const size = MESSAGE_LIMITS.MAX_PART_SIZE_BYTES + 1024; + const data = "A".repeat(size); + const base64 = Buffer.from(data).toString("base64"); + const dataUrl = `data:text/plain;base64,${base64}`; + + try { + validateMessageSizes([ + { + role: "user", + parts: [ + { + type: "file", + mediaType: "text/plain", + url: dataUrl, + }, + ], + }, + ]); + expect(false).toBe(true); // Should not reach here + } catch (error) { + expect(error).toBeInstanceOf(HTTPException); + if (error instanceof HTTPException) { + expect(error.status).toBe(413); + expect(error.message).toContain("File data URL is too large"); + expect(error.message).toContain("/api/files"); + } + } + }); +}); diff --git a/packages/api/src/routes/organizations/agents.client.ts b/packages/api/src/routes/organizations/agents.client.ts new file mode 100644 index 0000000..9719e1c --- /dev/null +++ b/packages/api/src/routes/organizations/agents.client.ts @@ -0,0 +1,31 @@ +import { assertResponseStatus } from "../../client-helper"; +import Client from "../../client.browser"; +import type { Agent } from "../agents/agents.client"; + +export interface GetOrganizationAgentRequest { + organization_id: string; + agent_name: string; +} + +export default class OrganizationAgents { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * Get an agent by name. + * + * @param request - The request object. + * @returns The agent. + */ + public async get(request: GetOrganizationAgentRequest): Promise { + const resp = await this.client.request( + "GET", + `/api/organizations/${request.organization_id}/agents/${request.agent_name}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/organizations/agents.server.ts b/packages/api/src/routes/organizations/agents.server.ts new file mode 100644 index 0000000..6fb3882 --- /dev/null +++ b/packages/api/src/routes/organizations/agents.server.ts @@ -0,0 +1,28 @@ +import * as convert from "@blink.so/database/convert"; +import { withAuth, withOrganizationURLParam } from "../../middleware"; +import type { APIServer } from "../../server"; +import { + createAgentRequestURL, + getAgentUserPermission, +} from "../agents/agents.server"; + +export default function mountAgents(app: APIServer) { + app.get("/:agent_name", withAuth, withOrganizationURLParam, async (c) => { + const name = c.req.param("agent_name"); + const db = await c.env.database(); + const agent = await db.selectAgentByOrganizationIDAndName({ + organizationID: c.get("organization").id, + name, + }); + if (!agent) { + return c.body(null, 404); + } + return c.json( + convert.agent( + agent, + await createAgentRequestURL(c, agent), + await getAgentUserPermission(c, agent) + ) + ); + }); +} diff --git a/packages/api/src/routes/organizations/agents.test.ts b/packages/api/src/routes/organizations/agents.test.ts new file mode 100644 index 0000000..d8a9932 --- /dev/null +++ b/packages/api/src/routes/organizations/agents.test.ts @@ -0,0 +1,31 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("GET /api/organizations/:organization_id/agents/:agent_name", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create an organization. + const org = await client.organizations.create({ + name: "test-org", + }); + + // Create an agent. + const createdAgent = await client.agents.create({ + name: "test-agent", + organization_id: org.id, + }); + + // Get the agent. + const agent = await client.organizations.agents.get({ + organization_id: org.id, + agent_name: createdAgent.name, + }); + + // Both should have the same core properties + expect(createdAgent.id).toEqual(agent.id); + expect(createdAgent.name).toEqual(agent.name); + expect(createdAgent.organization_id).toEqual(agent.organization_id); + expect(createdAgent.user_permission).toEqual("admin"); + expect(agent.user_permission).toEqual("admin"); +}); diff --git a/packages/api/src/routes/organizations/members.client.ts b/packages/api/src/routes/organizations/members.client.ts new file mode 100644 index 0000000..ad50eb2 --- /dev/null +++ b/packages/api/src/routes/organizations/members.client.ts @@ -0,0 +1,156 @@ +import { z } from "zod"; +import { + assertResponseStatus, + schemaPaginatedRequest, + schemaPaginatedResponse, +} from "../../client-helper"; +import Client from "../../client.browser"; + +export const schemaOrganizationRole = z.enum([ + "owner", + "admin", + "billing_admin", + "member", +]); + +export const schemaOrganizationMembership = z.object({ + user_id: z.uuid(), + organization_id: z.uuid(), + role: schemaOrganizationRole, + created_at: z.date(), + updated_at: z.date(), +}); + +export type OrganizationMembership = z.infer< + typeof schemaOrganizationMembership +>; + +const schemaOrganizationUser = z.object({ + id: z.uuid(), + created_at: z.date(), + updated_at: z.date(), + display_name: z.string().nullable(), + email: z.email(), + avatar_url: z.url().nullable(), + username: z.string(), + organization_id: z.uuid(), +}); + +const schemaOrganizationMember = schemaOrganizationMembership.extend({ + user: schemaOrganizationUser, +}); + +export type OrganizationMember = z.infer; + +const schemaListOrganizationMembersRequest = schemaPaginatedRequest.extend({ + organization_id: z.uuid(), + query: z.string().optional(), +}); + +export type ListOrganizationMembersRequest = z.infer< + typeof schemaListOrganizationMembersRequest +>; + +const schemaListOrganizationMembersResponse = schemaPaginatedResponse( + schemaOrganizationMember +); + +export type ListOrganizationMembersResponse = z.infer< + typeof schemaListOrganizationMembersResponse +>; + +const schemaDeleteOrganizationMemberRequest = z.object({ + organization_id: z.uuid(), + user_id: z.uuid(), +}); + +export type DeleteOrganizationMemberRequest = z.infer< + typeof schemaDeleteOrganizationMemberRequest +>; + +export const schemaUpdateOrganizationMemberRequestBody = z.object({ + role: z.enum(["owner", "admin", "member", "billing_admin"]).optional(), +}); + +const schemaUpdateOrganizationMemberRequest = + schemaUpdateOrganizationMemberRequestBody.extend({ + organization_id: z.uuid(), + user_id: z.uuid(), + }); + +export type UpdateOrganizationMemberRequest = z.infer< + typeof schemaUpdateOrganizationMemberRequest +>; + +export interface GetOrganizationMemberRequest { + organization_id: string; + user_id: string; +} + +export default class OrganizationMembers { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * List members of an organization. + * + * @param request - The request body. + * @returns The list of members. + */ + public async list( + request: ListOrganizationMembersRequest + ): Promise { + const query = new URLSearchParams(); + if (request.per_page) { + query.set("per_page", request.per_page.toString()); + } + if (request.page) { + query.set("page", request.page.toString()); + } + if (request.query) { + query.set("query", request.query); + } + const resp = await this.client.request( + "GET", + `/api/organizations/${request.organization_id}/members?${query.toString()}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + public async get( + request: GetOrganizationMemberRequest + ): Promise { + const resp = await this.client.request( + "GET", + `/api/organizations/${request.organization_id}/members/${request.user_id}` + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + public async delete(request: DeleteOrganizationMemberRequest): Promise { + const resp = await this.client.request( + "DELETE", + `/api/organizations/${request.organization_id}/members/${request.user_id}` + ); + await assertResponseStatus(resp, 204); + } + + public async update( + request: UpdateOrganizationMemberRequest + ): Promise { + const resp = await this.client.request( + "PUT", + `/api/organizations/${request.organization_id}/members/${request.user_id}`, + JSON.stringify({ role: request.role } as z.infer< + typeof schemaUpdateOrganizationMemberRequestBody + >) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } +} diff --git a/packages/api/src/routes/organizations/members.server.ts b/packages/api/src/routes/organizations/members.server.ts new file mode 100644 index 0000000..cb83ae8 --- /dev/null +++ b/packages/api/src/routes/organizations/members.server.ts @@ -0,0 +1,171 @@ +import type { + OrganizationMembership as DBOrganizationMembership, + UserWithPersonalOrganization, +} from "@blink.so/database/schema"; +import { validator } from "hono/validator"; +import { + withAuth, + withOrganizationURLParam, + withPagination, +} from "../../middleware"; +import type { APIServer } from "../../server"; +import { + schemaUpdateOrganizationMemberRequestBody, + type ListOrganizationMembersResponse, + type OrganizationMember, +} from "./members.client"; + +export default function mountMembers(server: APIServer) { + // List organization members. + server.get( + "/", + withAuth, + withOrganizationURLParam, + withPagination, + async (c) => { + const db = await c.env.database(); + const query = c.req.query("query"); + const members = await db.selectOrganizationMembers({ + organizationID: c.get("organization").id, + page: c.get("page"), + per_page: c.get("per_page"), + query: query || undefined, + }); + const resp: ListOrganizationMembersResponse = { + has_more: members.has_more, + items: members.items.map((m) => + convertOrganizationMember({ + organization_membership: m, + user: m.user, + }) + ), + }; + return c.json(resp); + } + ); + + // Update a member's role. + server.put( + "/:user_id", + withAuth, + withOrganizationURLParam, + validator("json", (value) => { + return schemaUpdateOrganizationMemberRequestBody.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const org = c.get("organization"); + const membership = org.membership; + + // Only owners and admins can update roles. + if ( + !membership || + (membership.role !== "owner" && membership.role !== "admin") + ) { + return c.json({ message: "Forbidden" }, 403); + } + + const userId = c.req.param("user_id"); + const { role } = c.req.valid("json"); + + const updated = await db.updateOrganizationMembership({ + user_id: userId, + organization_id: org.id, + role: role, + }); + if (!updated) { + return c.json({ message: "Member not found" }, 404); + } + const user = await db.selectUserByID(userId); + if (!user) { + return c.json({ message: "User not found" }, 404); + } + return c.json( + convertOrganizationMember({ + organization_membership: + updated as unknown as DBOrganizationMembership, + user: user, + }) + ); + } + ); + + // Remove a member from the organization. + server.delete("/:user_id", withAuth, withOrganizationURLParam, async (c) => { + const db = await c.env.database(); + const org = c.get("organization"); + const membership = org.membership; + + // Only owners and admins can remove members. + if ( + !membership || + (membership.role !== "owner" && membership.role !== "admin") + ) { + return c.json({ message: "Forbidden" }, 403); + } + + const userId = c.req.param("user_id"); + + await db.deleteOrganizationMembershipByUserIDAndOrganizationID( + userId, + org.id + ); + return c.body(null, 204); + }); + + // Get a member of an organization. + server.get("/:user_id", withAuth, withOrganizationURLParam, async (c) => { + const db = await c.env.database(); + const org = c.get("organization"); + const membership = await db.selectOrganizationMembership({ + userID: c.req.param("user_id"), + organizationID: org.id, + }); + if (!membership) { + return c.json({ message: "Member not found" }, 404); + } + const user = await db.selectUserByID(membership.user_id); + if (!user) { + return c.json({ message: "User not found" }, 404); + } + return c.json( + convertOrganizationMember({ + organization_membership: membership, + user: user, + }) + ); + }); +} + +const convertOrganizationMember = (membership: { + organization_membership: DBOrganizationMembership; + user: Pick< + UserWithPersonalOrganization, + | "id" + | "created_at" + | "updated_at" + | "display_name" + | "email" + | "avatar_url" + | "username" + | "organization_id" + >; +}): OrganizationMember => { + return { + organization_id: membership.organization_membership.organization_id, + user_id: membership.user.id, + created_at: membership.organization_membership.created_at, + updated_at: membership.organization_membership.updated_at, + role: membership.organization_membership.role, + user: { + id: membership.user.id, + created_at: membership.user.created_at, + updated_at: membership.user.updated_at, + display_name: membership.user.display_name, + email: membership.user.email!, + avatar_url: membership.user.avatar_url, + username: membership.user.username, + organization_id: membership.user.organization_id, + }, + }; +}; diff --git a/packages/api/src/routes/organizations/members.test.ts b/packages/api/src/routes/organizations/members.test.ts new file mode 100644 index 0000000..e79daef --- /dev/null +++ b/packages/api/src/routes/organizations/members.test.ts @@ -0,0 +1,158 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("CRUD /api/organizations/:id/members", async () => { + const { helpers, bindings } = await serve(); + const { client, user: owner } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + // Initially, only the owner is listed. + let members = await client.organizations.members.list({ + organization_id: org.id, + }); + expect(members.items.map((m) => m.user_id)).toEqual([owner.id]); + + const { client: invitedClient, user: invitedUser } = + await helpers.createUser(); + + // Create an invite as owner via API + const invite = await client.invites.create({ + organization_id: org.id, + email: invitedUser.email!, + role: "member", + }); + + await invitedClient.invites.accept({ + invite_id: invite.id, + code: invite.code, + }); + + // Verify both members are present now. + members = await client.organizations.members.list({ + organization_id: org.id, + }); + expect(members.items.length).toBe(2); + const userIds = members.items.map((m) => m.user_id).sort(); + expect(userIds).toEqual([invitedUser.id, owner.id].sort()); + + // Get the invited user's membership via API + const member = await client.organizations.members.get({ + organization_id: org.id, + user_id: invitedUser.id, + }); + expect(member.user_id).toBe(invitedUser.id); + expect(member.role).toBe("member"); + + // Update the invited user's role via API + const updated = await client.organizations.members.update({ + organization_id: org.id, + user_id: invitedUser.id, + role: "admin", + }); + expect(updated.user_id).toBe(invitedUser.id); + expect(updated.role).toBe("admin"); + + // Remove the invited user via API + await client.organizations.members.delete({ + organization_id: org.id, + user_id: invitedUser.id, + }); + + // Ensure they are gone + members = await client.organizations.members.list({ + organization_id: org.id, + }); + expect(members.items.map((m) => m.user_id)).toEqual([owner.id]); +}); + +test("Search organization members by query", async () => { + const { helpers } = await serve(); + const { client, user: owner } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + + // Create multiple users with different attributes + const { client: client1, user: user1 } = await helpers.createUser({ + username: "alice", + display_name: "Alice Smith", + email: "alice@example.com", + }); + + const { client: client2, user: user2 } = await helpers.createUser({ + username: "bob", + display_name: "Bob Johnson", + email: "bob@example.com", + }); + + const { client: client3, user: user3 } = await helpers.createUser({ + username: "charlie", + display_name: "Charlie Brown", + email: "charlie@test.com", + }); + + // Invite all users to the organization + for (const user of [user1, user2, user3]) { + const invite = await client.invites.create({ + organization_id: org.id, + email: user.email!, + role: "member", + }); + const userClient = + user.id === user1.id ? client1 : user.id === user2.id ? client2 : client3; + await userClient.invites.accept({ + invite_id: invite.id, + code: invite.code, + }); + } + + // Search by username + let members = await client.organizations.members.list({ + organization_id: org.id, + query: "alice", + }); + expect(members.items.length).toBe(1); + expect(members.items[0].user.username).toBe("alice"); + + // Search by display name + members = await client.organizations.members.list({ + organization_id: org.id, + query: "Johnson", + }); + expect(members.items.length).toBe(1); + expect(members.items[0].user.display_name).toBe("Bob Johnson"); + + // Search by email + members = await client.organizations.members.list({ + organization_id: org.id, + query: "charlie@test.com", + }); + expect(members.items.length).toBe(1); + expect(members.items[0].user.email).toBe("charlie@test.com"); + + // Search with partial match + members = await client.organizations.members.list({ + organization_id: org.id, + query: "example", + }); + expect(members.items.length).toBe(2); + const emails = members.items.map((m) => m.user.email).sort(); + expect(emails).toEqual(["alice@example.com", "bob@example.com"]); + + // Search with no matches + members = await client.organizations.members.list({ + organization_id: org.id, + query: "nonexistent", + }); + expect(members.items.length).toBe(0); + + // No query returns all members + members = await client.organizations.members.list({ + organization_id: org.id, + }); + expect(members.items.length).toBe(4); // owner + 3 invited users +}); diff --git a/packages/api/src/routes/organizations/organizations.client.ts b/packages/api/src/routes/organizations/organizations.client.ts new file mode 100644 index 0000000..514dc9e --- /dev/null +++ b/packages/api/src/routes/organizations/organizations.client.ts @@ -0,0 +1,129 @@ +import { z } from "zod"; +import { assertResponseStatus, nameFormat } from "../../client-helper"; +import Client from "../../client.browser"; +import OrganizationAgents from "./agents.client"; +import OrganizationMembers, { + schemaOrganizationMembership, +} from "./members.client"; + +// Re-export member types +export type { OrganizationMember } from "./members.client"; + +export const schemaOrganization = z.object({ + id: z.uuid(), + name: z.string(), + created_at: z.date(), + updated_at: z.date(), + membership: schemaOrganizationMembership.nullable(), + + members_url: z.url(), + invites_url: z.url(), + avatar_url: z.url().nullable(), +}); + +export type Organization = z.infer; + +export const schemaCreateOrganizationRequest = z.object({ + name: z.string().regex(nameFormat), +}); + +export type CreateOrganizationRequest = z.infer< + typeof schemaCreateOrganizationRequest +>; + +export const schemaUpdateOrganizationRequest = z.object({ + name: z.string().max(100).optional(), + avatar_file_id: z.string().nullable().optional(), + avatar_url: z.string().url().nullable().optional(), +}); + +export type UpdateOrganizationRequest = z.infer< + typeof schemaUpdateOrganizationRequest +>; + +export default class Organizations { + private readonly client: Client; + public readonly members: OrganizationMembers; + public readonly agents: OrganizationAgents; + + public constructor(client: Client) { + this.client = client; + this.members = new OrganizationMembers(client); + this.agents = new OrganizationAgents(client); + } + + /** + * List all organizations the user is a member of. + * + * @returns A list of organizations. + */ + public async list(): Promise { + const resp = await this.client.request("GET", "/api/organizations"); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Get an organization by ID. + * + * @param id - The ID of the organization. + * @returns The organization. + */ + public async get(id: string): Promise { + const resp = await this.client.request("GET", `/api/organizations/${id}`); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Create a new organization. + * + * @param request - The request body. + * @returns The created organization. + */ + public async create( + request: CreateOrganizationRequest + ): Promise { + const resp = await this.client.request( + "POST", + "/api/organizations", + JSON.stringify(request) + ); + await assertResponseStatus(resp, 201); + return resp.json(); + } + + /** + * Update an organization by ID. + * + * @param id - The ID of the organization. + * @param request - The update request. + * @returns The updated organization. + */ + public async update( + id: string, + request: UpdateOrganizationRequest + ): Promise { + const resp = await this.client.request( + "PATCH", + `/api/organizations/${id}`, + JSON.stringify(request) + ); + await assertResponseStatus(resp, 200); + return resp.json(); + } + + /** + * Delete an organization by ID. + * + * @param id - The ID of the organization. + * @returns The deleted organization. + */ + public async delete(id: string): Promise { + const resp = await this.client.request( + "DELETE", + `/api/organizations/${id}` + ); + await assertResponseStatus(resp, 204); + } +} diff --git a/packages/api/src/routes/organizations/organizations.server.ts b/packages/api/src/routes/organizations/organizations.server.ts new file mode 100644 index 0000000..2123bea --- /dev/null +++ b/packages/api/src/routes/organizations/organizations.server.ts @@ -0,0 +1,175 @@ +import * as convert from "@blink.so/database/convert"; +import { validator } from "hono/validator"; +import { withAuth } from "../../middleware"; +import type { APIServer } from "../../server"; +import { isUniqueConstraintError } from "../../server-helper"; +import mountAgents from "./agents.server"; +import mountMembers from "./members.server"; +import { + schemaCreateOrganizationRequest, + schemaUpdateOrganizationRequest, +} from "./organizations.client"; + +export default function mountOrganizations(server: APIServer) { + // List organizations for the user. + server.get("/", withAuth, async (c) => { + const db = await c.env.database(); + const organizations = await db.selectOrganizationsForUser({ + userID: c.get("user_id"), + }); + return c.json( + organizations.map((org) => convert.organization(c.env.apiBaseURL, org)) + ); + }); + + // Create a new organization. + server.post( + "/", + withAuth, + validator("json", (value, c) => { + return schemaCreateOrganizationRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const { name } = c.req.valid("json"); + try { + const organization = await db.insertOrganizationWithMembership({ + name, + created_by: c.get("user_id"), + }); + return c.json( + convert.organization(c.env.apiBaseURL, organization), + 201 + ); + } catch (error) { + if ( + isUniqueConstraintError(error, "organization_name_unique") || + isUniqueConstraintError(error, "organization_lower_idx") + ) { + return c.json({ message: "That name is already taken!" }, 400); + } + throw error; + } + } + ); + + // Get an organization by ID. + server.get("/:id", withAuth, async (c) => { + const db = await c.env.database(); + const organization = await db.selectOrganizationForUser({ + organizationID: c.req.param("id"), + userID: c.get("user_id"), + }); + if (!organization) { + return c.json({ message: "Organization not found" }, 404); + } + return c.json(convert.organization(c.env.apiBaseURL, organization)); + }); + + // Update an organization by ID. + server.patch( + "/:id", + withAuth, + validator("json", (value, c) => { + return schemaUpdateOrganizationRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const organizationID = c.req.param("id"); + const userID = c.get("user_id"); + const { name, avatar_file_id, avatar_url } = c.req.valid("json"); + + const organization = await db.selectOrganizationForUser({ + organizationID, + userID, + }); + + if (!organization) { + return c.json({ message: "Organization not found" }, 404); + } + + if ( + !organization.membership || + (organization.membership.role !== "admin" && + organization.membership.role !== "owner") + ) { + return c.json( + { message: "You must be an admin of the organization to update it" }, + 403 + ); + } + + try { + // Update name if provided + if (name !== undefined) { + await db.updateOrganizationByID(organizationID, { + name: name.trim(), + }); + } + + // Update avatar if provided + if (avatar_file_id !== undefined) { + const newUrl = + avatar_file_id && avatar_file_id.trim().length > 0 + ? `/api/files/${avatar_file_id.trim()}` + : null; + await db.updateOrganizationByID(organizationID, { + avatar_url: newUrl, + }); + } else if (avatar_url !== undefined) { + // Support direct avatar URL (e.g., GitHub avatars) + await db.updateOrganizationByID(organizationID, { avatar_url }); + } + + // Fetch updated organization + const updatedOrganization = await db.selectOrganizationForUser({ + organizationID, + userID, + }); + + if (!updatedOrganization) { + return c.json( + { message: "Organization not found after update" }, + 404 + ); + } + + return c.json( + convert.organization(c.env.apiBaseURL, updatedOrganization) + ); + } catch (error) { + if ( + isUniqueConstraintError(error, "organization_name_unique") || + isUniqueConstraintError(error, "organization_lower_idx") + ) { + return c.json({ message: "That name is already taken!" }, 400); + } + throw error; + } + } + ); + + server.delete("/:id", withAuth, async (c) => { + const db = await c.env.database(); + const organization = await db.selectOrganizationForUser({ + organizationID: c.req.param("id"), + userID: c.get("user_id"), + }); + if (!organization) { + return c.json({ message: "Organization not found" }, 404); + } + if (!organization.membership || organization.membership.role !== "owner") { + return c.json( + { message: "You must be an owner of the organization to delete it" }, + 403 + ); + } + await db.deleteOrganization({ + id: organization.id, + }); + return c.body(null, 204); + }); + + mountMembers(server.basePath("/:organization_id/members")); + mountAgents(server.basePath("/:organization_id/agents")); +} diff --git a/packages/api/src/routes/organizations/organizations.test.ts b/packages/api/src/routes/organizations/organizations.test.ts new file mode 100644 index 0000000..ef0c7b7 --- /dev/null +++ b/packages/api/src/routes/organizations/organizations.test.ts @@ -0,0 +1,68 @@ +import { expect, test } from "bun:test"; +import { serve } from "../../test"; + +test("CRUD /api/organizations", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + // No initial organizations. + let orgs = await client.organizations.list(); + expect(orgs).toHaveLength(1); + const personal = orgs[0]!; + + // Create an organization. + let org = await client.organizations.create({ + name: "test-org", + }); + expect(org.name).toBe("test-org"); + expect(org.membership).toBeDefined(); + expect(org.membership?.user_id).toBe(user.id); + expect(org.membership?.role).toBe("owner"); + + // List organizations. + orgs = await client.organizations.list(); + expect(orgs).toEqual([personal, org]); + + // Get the organization. + org = await client.organizations.get(org.id); + expect(org.name).toBe("test-org"); + + // Delete the organization. + await client.organizations.delete(org.id); + orgs = await client.organizations.list(); + expect(orgs).toEqual([personal]); +}); + +test("create organization with duplicate name", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + await client.organizations.create({ + name: "test-org", + }); + + await expect( + client.organizations.create({ + name: "test-ORG", + }) + ).rejects.toThrow("That name is already taken!"); +}); + +test("update organization name", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "original-name", + }); + + const updated = await client.organizations.update(org.id, { + name: "updated-name", + }); + + expect(updated.name).toBe("updated-name"); + expect(updated.id).toBe(org.id); + + const fetched = await client.organizations.get(org.id); + expect(fetched.name).toBe("updated-name"); +}); diff --git a/packages/api/src/routes/otlp/README.md b/packages/api/src/routes/otlp/README.md new file mode 100644 index 0000000..9167814 --- /dev/null +++ b/packages/api/src/routes/otlp/README.md @@ -0,0 +1 @@ +The `gen` folder was generated by running `bun buf generate` configured in [`buf.gen.yaml`](buf.gen.yaml). diff --git a/packages/api/src/routes/otlp/buf.gen.yaml b/packages/api/src/routes/otlp/buf.gen.yaml new file mode 100644 index 0000000..96b7521 --- /dev/null +++ b/packages/api/src/routes/otlp/buf.gen.yaml @@ -0,0 +1,10 @@ +version: v2 + +plugins: + - remote: buf.build/bufbuild/es + out: gen + opt: target=ts + +inputs: + - git_repo: https://github.com/open-telemetry/opentelemetry-proto.git + ref: c0a98a1847d3124ac5f9ecd02d0e2d2732bbb590 # v1.8.0 diff --git a/packages/api/src/routes/otlp/convert.test.ts b/packages/api/src/routes/otlp/convert.test.ts new file mode 100644 index 0000000..af40995 --- /dev/null +++ b/packages/api/src/routes/otlp/convert.test.ts @@ -0,0 +1,1172 @@ +import { create } from "@bufbuild/protobuf"; +import { describe, expect, test } from "bun:test"; + +import { ExportTraceServiceRequestSchema } from "./gen/opentelemetry/proto/collector/trace/v1/trace_service_pb"; +import { + AnyValueSchema, + ArrayValueSchema, + InstrumentationScopeSchema, + KeyValueListSchema, + KeyValueSchema, +} from "./gen/opentelemetry/proto/common/v1/common_pb"; +import { ResourceSchema } from "./gen/opentelemetry/proto/resource/v1/resource_pb"; +import { + ResourceSpansSchema, + ScopeSpansSchema, + SpanSchema, + Span_EventSchema, + Span_LinkSchema, + Span_SpanKind, + StatusSchema, + Status_StatusCode, +} from "./gen/opentelemetry/proto/trace/v1/trace_pb"; + +import { + mapExportTraceServiceRequestToOtelSpans, + parseOtlpHttpTraces, + type TraceOptions, +} from "./convert"; + +// Helper function to create mock Uint8Array IDs +function createMockId(hexString: string): Uint8Array { + const bytes = + hexString.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) ?? []; + return new Uint8Array(bytes); +} + +// Helper function to create mock KeyValue attributes +function createMockAttribute(key: string, value: string) { + return create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { + case: "stringValue", + value, + }, + }), + }); +} + +// Helper function to create mock TraceOptions +function createMockOptions(): TraceOptions { + return { + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + run_id: "test-run-789", + step_id: "test-step-abc", + }; +} + +// Helper function to create mock ExportTraceServiceRequest +function createMockTraceRequest() { + const mockEvent = create(Span_EventSchema, { + timeUnixNano: BigInt("1640995200500000000"), + name: "test-event", + attributes: [createMockAttribute("event.type", "log")], + droppedAttributesCount: 0, + }); + + const mockLink = create(Span_LinkSchema, { + traceId: createMockId("deadbeefcafebabe1234567890abcdef"), + spanId: createMockId("cafebabe12345678"), + attributes: [createMockAttribute("link.type", "reference")], + traceState: "vendor=test", + flags: 1, + droppedAttributesCount: 0, + }); + + const mockSpan = create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + parentSpanId: createMockId("fedcba0987654321"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), // 2022-01-01 00:00:00 UTC + endTimeUnixNano: BigInt("1640995201000000000"), // 2022-01-01 00:00:01 UTC + attributes: [ + createMockAttribute("service.name", "test-service"), + createMockAttribute("span.kind", "internal"), + ], + events: [mockEvent], + links: [mockLink], + status: create(StatusSchema, { + code: Status_StatusCode.OK, + message: "Success", + }), + droppedAttributesCount: 0, + droppedEventsCount: 0, + droppedLinksCount: 0, + flags: 0, + traceState: "", + }); + + const mockScopeSpans = create(ScopeSpansSchema, { + scope: create(InstrumentationScopeSchema, { + name: "test-instrumentation", + version: "1.0.0", + attributes: [createMockAttribute("library.language", "typescript")], + droppedAttributesCount: 0, + }), + spans: [mockSpan], + schemaUrl: "https://opentelemetry.io/schemas/1.9.0", + }); + + const mockResourceSpans = create(ResourceSpansSchema, { + resource: create(ResourceSchema, { + attributes: [ + createMockAttribute("service.name", "test-app"), + createMockAttribute("service.version", "1.0.0"), + ], + droppedAttributesCount: 0, + }), + scopeSpans: [mockScopeSpans], + schemaUrl: "https://opentelemetry.io/schemas/1.9.0", + }); + + return create(ExportTraceServiceRequestSchema, { + resourceSpans: [mockResourceSpans], + }); +} + +describe("OTEL Conversion Functions", () => { + test("parseOtlpHttpTraces handles OTLP/JSON hex IDs (span + links)", async () => { + const hexTraceId = "664e67a4c7b9917582df5246701a186a"; + const hexSpanId = "abcdef1234567890"; + const hexLinkTraceId = "a1b2c3d4e5f67890fedcba0987654321"; + const hexLinkSpanId = "1234567890abcdef"; + + const jsonBody = { + resourceSpans: [ + { + resource: { attributes: [] }, + scopeSpans: [ + { + scope: {}, + spans: [ + { + traceId: hexTraceId, + spanId: hexSpanId, + parentSpanId: "", + name: "test-span-json", + kind: "SPAN_KIND_INTERNAL", + startTimeUnixNano: "1640995200000000000", + endTimeUnixNano: "1640995200103524564", + events: [], + links: [ + { + traceId: hexLinkTraceId, + spanId: hexLinkSpanId, + attributes: [], + droppedAttributesCount: 0, + flags: 0, + }, + ], + }, + ], + }, + ], + }, + ], + } as const; + + const req = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(jsonBody), + }); + + const parsed = await parseOtlpHttpTraces(req); + const opts: TraceOptions = { + agent_id: "agent-json-1", + deployment_id: "deploy-json-1", + deployment_target_id: "target-json-1", + }; + const spans = mapExportTraceServiceRequestToOtelSpans(parsed, opts); + expect(spans).toHaveLength(1); + const span = spans[0]; + expect(span.payload.span.trace_id).toBe(hexTraceId); + expect(span.payload.span.id).toBe(hexSpanId); + expect(span.payload.span.links[0]?.linked_trace_id).toBe(hexLinkTraceId); + expect(span.payload.span.links[0]?.linked_span_id).toBe(hexLinkSpanId); + }); + + describe("mapExportTraceServiceRequestToOtelSpans", () => { + test("should convert a basic trace request to OtelSpan array", () => { + const mockRequest = createMockTraceRequest(); + const options = createMockOptions(); + + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + options + ); + + expect(result).toHaveLength(1); + + const span = result[0]; + expect(span.agent_id).toBe(options.agent_id); + expect(span.payload.span.name).toBe("test-span"); + expect(span.payload.span.kind).toBe("INTERNAL"); + expect(span.payload.span.status_code).toBe("OK"); + expect(span.payload.span.status_message).toBe("Success"); + expect(span.payload.span.trace_id).toBe( + "a1b2c3d4e5f67890fedcba0987654321" + ); + expect(span.payload.span.id).toBe("1234567890abcdef"); + expect(span.payload.span.parent_span_id).toBe("fedcba0987654321"); + }); + + test("should convert timestamps correctly", () => { + const mockRequest = createMockTraceRequest(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + createMockOptions() + ); + + const span = result[0]; + expect(span.start_time).toBe("2022-01-01 00:00:00.000000000"); + expect(span.end_time).toBe("2022-01-01 00:00:01.000000000"); + expect(span.payload.span.duration_ns).toBe("1000000000"); // 1 second in nanoseconds + }); + + test("should convert span attributes correctly", () => { + const mockRequest = createMockTraceRequest(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + createMockOptions() + ); + + const span = result[0]; + expect(span.payload.span.attributes).toEqual({ + "service.name": "test-service", + "span.kind": "internal", + }); + }); + + test("should convert resource attributes correctly", () => { + const mockRequest = createMockTraceRequest(); + const options = createMockOptions(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + options + ); + + const span = result[0]; + expect(span.payload.resource.attributes).toEqual({ + "service.name": "test-app", + "service.version": "1.0.0", + blink: { + agent_id: options.agent_id, + deployment_id: options.deployment_id, + deployment_target_id: options.deployment_target_id, + run_id: options.run_id, + step_id: options.step_id, + }, + }); + }); + + test("should add blink object to resource attributes with provided options", () => { + const customOptions: TraceOptions = { + agent_id: "custom-agent-999", + deployment_id: "custom-deploy-888", + deployment_target_id: "custom-target-555", + run_id: "custom-run-777", + step_id: "custom-step-666", + }; + + const mockRequest = createMockTraceRequest(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + customOptions + ); + + const span = result[0]; + expect(span.payload.resource.attributes.blink).toEqual({ + agent_id: "custom-agent-999", + deployment_id: "custom-deploy-888", + deployment_target_id: "custom-target-555", + run_id: "custom-run-777", + step_id: "custom-step-666", + }); + }); + + test("should handle optional runId and stepId in blink object", () => { + const mockRequest = createMockTraceRequest(); + + // Test with only required fields + const optionsWithoutOptional: TraceOptions = { + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + }; + + const resultWithoutOptional = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + optionsWithoutOptional + ); + + const spanWithoutOptional = resultWithoutOptional[0]; + expect(spanWithoutOptional.payload.resource.attributes.blink).toEqual({ + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + }); + + // Should not have runId or stepId properties + expect( + spanWithoutOptional.payload.resource.attributes.blink + ).not.toHaveProperty("run_id"); + expect( + spanWithoutOptional.payload.resource.attributes.blink + ).not.toHaveProperty("step_id"); + + // Test with only runId + const optionsWithRunId: TraceOptions = { + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + run_id: "test-run-789", + }; + + const resultWithRunId = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + optionsWithRunId + ); + + const spanWithRunId = resultWithRunId[0]; + expect(spanWithRunId.payload.resource.attributes.blink).toEqual({ + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + run_id: "test-run-789", + }); + expect( + spanWithRunId.payload.resource.attributes.blink + ).not.toHaveProperty("step_id"); + + // Test with only stepId + const optionsWithStepId: TraceOptions = { + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + step_id: "test-step-abc", + }; + + const resultWithStepId = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + optionsWithStepId + ); + + const spanWithStepId = resultWithStepId[0]; + expect(spanWithStepId.payload.resource.attributes.blink).toEqual({ + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-def", + step_id: "test-step-abc", + }); + expect( + spanWithStepId.payload.resource.attributes.blink + ).not.toHaveProperty("run_id"); + }); + + test("should replace existing blink object in resource attributes", () => { + const existingBlinkAttr = create(KeyValueSchema, { + key: "blink", + value: create(AnyValueSchema, { + value: { + case: "kvlistValue", + value: create(KeyValueListSchema, { + values: [ + create(KeyValueSchema, { + key: "oldAgentId", + value: create(AnyValueSchema, { + value: { case: "stringValue", value: "old-agent-123" }, + }), + }), + create(KeyValueSchema, { + key: "oldDeploymentId", + value: create(AnyValueSchema, { + value: { case: "stringValue", value: "old-deploy-456" }, + }), + }), + ], + }), + }, + }), + }); + + const requestWithExistingBlink = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + resource: create(ResourceSchema, { + attributes: [ + createMockAttribute("service.name", "test-app"), + createMockAttribute("service.version", "1.0.0"), + existingBlinkAttr, // This should be replaced + ], + droppedAttributesCount: 0, + }), + scopeSpans: [ + create(ScopeSpansSchema, { + scope: create(InstrumentationScopeSchema, { + name: "test-instrumentation", + version: "1.0.0", + }), + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + }), + ], + }), + ], + }), + ], + }); + + const options = createMockOptions(); + const result = mapExportTraceServiceRequestToOtelSpans( + requestWithExistingBlink, + options + ); + + const span = result[0]; + + // Should have our new blink object, not the old one + expect(span.payload.resource.attributes.blink).toEqual({ + agent_id: options.agent_id, + deployment_id: options.deployment_id, + deployment_target_id: options.deployment_target_id, + run_id: options.run_id, + step_id: options.step_id, + }); + + // Should not contain the old blink properties + expect(span.payload.resource.attributes.blink).not.toHaveProperty( + "oldAgentId" + ); + expect(span.payload.resource.attributes.blink).not.toHaveProperty( + "oldDeploymentId" + ); + + // Other attributes should remain unchanged + expect(span.payload.resource.attributes["service.name"]).toBe("test-app"); + expect(span.payload.resource.attributes["service.version"]).toBe("1.0.0"); + }); + + test("should convert scope attributes correctly", () => { + const mockRequest = createMockTraceRequest(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + createMockOptions() + ); + + const span = result[0]; + expect(span.payload.scope.attributes).toEqual({ + "library.language": "typescript", + }); + expect(span.payload.scope.name).toBe("test-instrumentation"); + expect(span.payload.scope.version).toBe("1.0.0"); + }); + + test("should convert events to array of objects", () => { + const mockRequest = createMockTraceRequest(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + createMockOptions() + ); + + const span = result[0]; + expect(span.payload.span.events).toHaveLength(1); + expect(span.payload.span.events[0]).toEqual({ + time: "2022-01-01 00:00:00.500000000", + name: "test-event", + dropped_attributes_count: 0, + attributes: { + "event.type": "log", + }, + }); + }); + + test("should convert links to array of objects", () => { + const mockRequest = createMockTraceRequest(); + const result = mapExportTraceServiceRequestToOtelSpans( + mockRequest, + createMockOptions() + ); + + const span = result[0]; + expect(span.payload.span.links).toHaveLength(1); + expect(span.payload.span.links[0]).toEqual({ + linked_trace_id: "deadbeefcafebabe1234567890abcdef", + linked_span_id: "cafebabe12345678", + trace_state: "vendor=test", + flags: 1, + dropped_attributes_count: 0, + attributes: { + "link.type": "reference", + }, + }); + }); + + test("should handle empty arrays gracefully", () => { + const emptyRequest = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + resource: create(ResourceSchema, { + attributes: [createMockAttribute("service.name", "test-app")], + droppedAttributesCount: 0, + }), + scopeSpans: [ + create(ScopeSpansSchema, { + scope: create(InstrumentationScopeSchema, { + name: "test-instrumentation", + version: "1.0.0", + }), + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + events: [], // Empty events + links: [], // Empty links + attributes: [], + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + emptyRequest, + createMockOptions() + ); + + const span = result[0]; + expect(span.payload.span.events).toEqual([]); + expect(span.payload.span.links).toEqual([]); + }); + + test("should handle missing optional fields", () => { + const minimalRequest = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + resource: create(ResourceSchema, { + attributes: [], + }), + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + parentSpanId: new Uint8Array(), // Empty parent span ID + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + traceState: "", // Empty trace state + // No status field - should default to UNSET + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + minimalRequest, + createMockOptions() + ); + + const resultSpan = result[0]; + expect(resultSpan.payload.span.parent_span_id).toBe(""); + expect(resultSpan.payload.span.trace_state).toBe(""); + expect(resultSpan.payload.span.status_code).toBe("UNSET"); + expect(resultSpan.payload.span.status_message).toBe(""); + }); + + test("should handle multiple spans", () => { + const multiSpanRequest = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + resource: create(ResourceSchema, { + attributes: [createMockAttribute("service.name", "test-app")], + }), + scopeSpans: [ + create(ScopeSpansSchema, { + scope: create(InstrumentationScopeSchema, { + name: "test-instrumentation", + version: "1.0.0", + }), + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "first-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + }), + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("abcdef1234567890"), + name: "second-span", + kind: Span_SpanKind.SERVER, + startTimeUnixNano: BigInt("1640995201000000000"), + endTimeUnixNano: BigInt("1640995202000000000"), + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + multiSpanRequest, + createMockOptions() + ); + + expect(result).toHaveLength(2); + expect(result[0].payload.span.name).toBe("first-span"); + expect(result[0].payload.span.kind).toBe("INTERNAL"); + expect(result[1].payload.span.name).toBe("second-span"); + expect(result[1].payload.span.kind).toBe("SERVER"); + }); + + test("should handle different span kinds", () => { + const spanKinds = [ + { kind: Span_SpanKind.INTERNAL, expected: "INTERNAL" }, + { kind: Span_SpanKind.SERVER, expected: "SERVER" }, + { kind: Span_SpanKind.CLIENT, expected: "CLIENT" }, + { kind: Span_SpanKind.PRODUCER, expected: "PRODUCER" }, + { kind: Span_SpanKind.CONSUMER, expected: "CONSUMER" }, + { kind: Span_SpanKind.UNSPECIFIED, expected: "UNSPECIFIED" }, + ]; + + spanKinds.forEach(({ kind, expected }) => { + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + expect(result[0].payload.span.kind).toBe(expected); + }); + }); + + test("should handle different status codes", () => { + const statusCodes = [ + { code: Status_StatusCode.OK, expected: "OK" }, + { code: Status_StatusCode.ERROR, expected: "ERROR" }, + { code: Status_StatusCode.UNSET, expected: "UNSET" }, + ]; + + statusCodes.forEach(({ code, expected }) => { + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + status: create(StatusSchema, { + code, + message: "Test message", + }), + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + expect(result[0].payload.span.status_code).toBe(expected); + expect(result[0].payload.span.status_message).toBe("Test message"); + }); + }); + + test("should handle empty trace request", () => { + const emptyRequest = create(ExportTraceServiceRequestSchema, { + resourceSpans: [], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + emptyRequest, + createMockOptions() + ); + expect(result).toEqual([]); + }); + + test("should calculate duration correctly", () => { + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995200000000000"), // Same time = 0 duration + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + expect(result[0].payload.span.duration_ns).toBe("0"); + }); + + test("should handle negative duration by returning 0", () => { + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + startTimeUnixNano: BigInt("1640995202000000000"), // End before start + endTimeUnixNano: BigInt("1640995200000000000"), + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + expect(result[0].payload.span.duration_ns).toBe("0"); + }); + + test("should convert different attribute value types correctly", () => { + // Helper to create AnyValue with different types + const createStringAttr = (key: string, value: string) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "stringValue", value }, + }), + }); + + const createBoolAttr = (key: string, value: boolean) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "boolValue", value }, + }), + }); + + const createIntAttr = (key: string, value: bigint) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "intValue", value }, + }), + }); + + const createDoubleAttr = (key: string, value: number) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "doubleValue", value }, + }), + }); + + const createBytesAttr = (key: string, bytes: Uint8Array) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "bytesValue", value: bytes }, + }), + }); + + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + attributes: [ + createStringAttr("str_attr", "hello world"), + createStringAttr("empty_str", ""), + createStringAttr("unicode", "🚀 测试"), + createBoolAttr("bool_true", true), + createBoolAttr("bool_false", false), + createIntAttr("small_int", BigInt(42)), + createIntAttr("large_int", BigInt("9007199254740992")), // Larger than MAX_SAFE_INTEGER + createIntAttr("negative_int", BigInt(-123)), + createDoubleAttr("double_val", 3.14159), + createDoubleAttr("negative_double", -2.718), + createDoubleAttr("zero_double", 0.0), + createDoubleAttr("inf_double", Infinity), + createDoubleAttr("neg_inf_double", -Infinity), + createBytesAttr( + "bytes_attr", + new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f]) + ), // "Hello" + createBytesAttr("empty_bytes", new Uint8Array()), + createBytesAttr( + "binary_data", + new Uint8Array([0x00, 0x01, 0xff, 0xab, 0xcd]) + ), + ], + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + const attrs = result[0].payload.span.attributes; + + // String values + expect(attrs["str_attr"]).toBe("hello world"); + expect(attrs["empty_str"]).toBe(""); + expect(attrs["unicode"]).toBe("🚀 测试"); + + // Boolean values + expect(attrs["bool_true"]).toBe(true); + expect(attrs["bool_false"]).toBe(false); + + // Integer values + expect(attrs["small_int"]).toBe(42); + expect(attrs["large_int"]).toBe("9007199254740992"); // Should be string for large numbers + expect(attrs["negative_int"]).toBe(-123); + + // Double values + expect(attrs["double_val"]).toBe(3.14159); + expect(attrs["negative_double"]).toBe(-2.718); + expect(attrs["zero_double"]).toBe(0.0); + expect(attrs["inf_double"]).toBe(Infinity); + expect(attrs["neg_inf_double"]).toBe(-Infinity); + + // Bytes values (should be base64 encoded) + expect(attrs["bytes_attr"]).toBe("SGVsbG8="); // "Hello" in base64 + expect(attrs["empty_bytes"]).toBe(""); // Empty bytes should be empty string + expect(attrs["binary_data"]).toBe("AAH/q80="); // Binary data in base64 + }); + + test("should handle array and nested object attributes", () => { + // Create array attribute + const createArrayAttr = (key: string, values: any[]) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { + case: "arrayValue", + value: create(ArrayValueSchema, { + values: values.map((v) => + typeof v === "string" + ? create(AnyValueSchema, { + value: { case: "stringValue", value: v }, + }) + : typeof v === "number" + ? create(AnyValueSchema, { + value: { case: "doubleValue", value: v }, + }) + : typeof v === "boolean" + ? create(AnyValueSchema, { + value: { case: "boolValue", value: v }, + }) + : create(AnyValueSchema, { + value: { case: "stringValue", value: String(v) }, + }) + ), + }), + }, + }), + }); + + // Create nested object attribute + const createObjectAttr = (key: string, obj: Record) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { + case: "kvlistValue", + value: create(KeyValueListSchema, { + values: Object.entries(obj).map(([k, v]) => + create(KeyValueSchema, { + key: k, + value: create(AnyValueSchema, { + value: { case: "stringValue", value: v }, + }), + }) + ), + }), + }, + }), + }); + + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + attributes: [ + createArrayAttr("string_array", ["one", "two", "three"]), + createArrayAttr("mixed_array", ["string", 42, true]), + createArrayAttr("empty_array", []), + createObjectAttr("nested_obj", { + inner_key1: "value1", + inner_key2: "value2", + }), + ], + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + const attrs = result[0].payload.span.attributes; + + // Array attributes + expect(attrs["string_array"]).toEqual(["one", "two", "three"]); + expect(attrs["mixed_array"]).toEqual(["string", 42, true]); + expect(attrs["empty_array"]).toEqual([]); + + // Nested object attributes + expect(attrs["nested_obj"]).toEqual({ + inner_key1: "value1", + inner_key2: "value2", + }); + }); + + test("should handle null and undefined attribute values", () => { + // Create attribute with undefined value + const createNullAttr = (key: string) => + create(KeyValueSchema, { + key, + value: undefined, // This should result in null + }); + + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + attributes: [ + createNullAttr("null_attr"), + // Empty key should be filtered out + create(KeyValueSchema, { + key: "", + value: create(AnyValueSchema, { + value: { + case: "stringValue", + value: "should_be_filtered", + }, + }), + }), + ], + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + const attrs = result[0].payload.span.attributes; + + // Should handle null/undefined values + expect(attrs["null_attr"]).toBe(null); + + // Empty keys should be filtered out + expect(attrs[""]).toBeUndefined(); + expect(Object.keys(attrs)).not.toContain(""); + }); + + test("should handle extremely large numbers and edge cases", () => { + const createIntAttr = (key: string, value: bigint) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "intValue", value }, + }), + }); + + const createDoubleAttr = (key: string, value: number) => + create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { case: "doubleValue", value }, + }), + }); + + const request = create(ExportTraceServiceRequestSchema, { + resourceSpans: [ + create(ResourceSpansSchema, { + scopeSpans: [ + create(ScopeSpansSchema, { + spans: [ + create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + attributes: [ + // Edge cases for integers + createIntAttr( + "max_safe_int", + BigInt(Number.MAX_SAFE_INTEGER) + ), + createIntAttr( + "max_safe_int_plus_one", + BigInt(Number.MAX_SAFE_INTEGER + 1) + ), + createIntAttr( + "min_safe_int", + BigInt(Number.MIN_SAFE_INTEGER) + ), + createIntAttr( + "min_safe_int_minus_one", + BigInt(Number.MIN_SAFE_INTEGER - 1) + ), + createIntAttr( + "very_large_positive", + BigInt("18446744073709551615") + ), // 2^64-1 + createIntAttr( + "very_large_negative", + BigInt("-18446744073709551615") + ), + + // Edge cases for doubles + createDoubleAttr("nan_double", NaN), + createDoubleAttr("max_value", Number.MAX_VALUE), + createDoubleAttr("min_value", Number.MIN_VALUE), + createDoubleAttr("epsilon", Number.EPSILON), + ], + }), + ], + }), + ], + }), + ], + }); + + const result = mapExportTraceServiceRequestToOtelSpans( + request, + createMockOptions() + ); + const attrs = result[0].payload.span.attributes; + + // Safe integers should remain as numbers + expect(attrs["max_safe_int"]).toBe(Number.MAX_SAFE_INTEGER); + expect(attrs["min_safe_int"]).toBe(Number.MIN_SAFE_INTEGER); + + // Unsafe integers should become strings + expect(attrs["max_safe_int_plus_one"]).toBe( + (Number.MAX_SAFE_INTEGER + 1).toString() + ); + expect(attrs["min_safe_int_minus_one"]).toBe( + (Number.MIN_SAFE_INTEGER - 1).toString() + ); + expect(attrs["very_large_positive"]).toBe("18446744073709551615"); + expect(attrs["very_large_negative"]).toBe("-18446744073709551615"); + + // Special double values + expect(Number.isNaN(attrs["nan_double"])).toBe(true); + expect(attrs["max_value"]).toBe(Number.MAX_VALUE); + expect(attrs["min_value"]).toBe(Number.MIN_VALUE); + expect(attrs["epsilon"]).toBe(Number.EPSILON); + }); + }); +}); diff --git a/packages/api/src/routes/otlp/convert.ts b/packages/api/src/routes/otlp/convert.ts new file mode 100644 index 0000000..506102e --- /dev/null +++ b/packages/api/src/routes/otlp/convert.ts @@ -0,0 +1,497 @@ +import { fromBinary, fromJsonString } from "@bufbuild/protobuf"; +import { HTTPException } from "hono/http-exception"; +import { Buffer } from "node:buffer"; +import { + type ExportTraceServiceRequest, + ExportTraceServiceRequestSchema, +} from "./gen/opentelemetry/proto/collector/trace/v1/trace_service_pb"; +import type { + AnyValue, + KeyValue, +} from "./gen/opentelemetry/proto/common/v1/common_pb"; +import type { + ResourceSpans, + ScopeSpans, + Span, + Span_Event, + Span_Link, + Status, +} from "./gen/opentelemetry/proto/trace/v1/trace_pb"; +import { + Span_SpanKind, + Status_StatusCode, +} from "./gen/opentelemetry/proto/trace/v1/trace_pb"; + +type JsonPrimitive = string | number | boolean | null; + +export type JsonValue = + | JsonPrimitive + | JsonValue[] + | { [key: string]: JsonValue }; + +export interface OtelEvent { + time: string; + name: string; + dropped_attributes_count: number; + attributes: Record; +} + +export interface OtelLink { + linked_trace_id: string; + linked_span_id: string; + trace_state: string; + flags: number; + dropped_attributes_count: number; + attributes: Record; +} + +export interface Resource { + attributes: Record; + dropped_attributes_count: number; + schema_url?: string | undefined; +} + +export interface Scope { + name: string | undefined; + version: string | undefined; + attributes: Record; + dropped_attributes_count: number; + schema_url?: string | undefined; +} + +export interface OtelSpanData { + duration_ns: string; + trace_id: string; + id: string; + parent_span_id: string; + name: string; + kind: string; + status_code: string; + status_message: string; + trace_state: string; + flags: number; + dropped_attributes_count: number; + dropped_events_count: number; + dropped_links_count: number; + attributes: Record; + events: OtelEvent[]; + links: OtelLink[]; +} + +export interface OtelPayload { + span: OtelSpanData; + resource: Resource; + scope: Scope; +} + +export interface OtelSpan { + agent_id: string; + start_time: string; + end_time: string; + payload: OtelPayload; +} + +export interface TraceOptions { + agent_id: string; + deployment_id: string; + deployment_target_id: string; + run_id?: string; + step_id?: string; + chat_id?: string; +} + +export function mapExportTraceServiceRequestToOtelSpans( + request: ExportTraceServiceRequest, + options: TraceOptions +): OtelSpan[] { + const rows: OtelSpan[] = []; + + for (const resourceSpans of request.resourceSpans) { + rows.push(...mapResourceSpans(resourceSpans, options)); + } + + return rows; +} + +function mapResourceSpans( + resourceSpans: ResourceSpans, + options: TraceOptions +): OtelSpan[] { + const resourceAttrs = keyValuesToRecord( + resourceSpans.resource?.attributes ?? [] + ); + + resourceAttrs.blink = { + agent_id: options.agent_id, + deployment_id: options.deployment_id, + deployment_target_id: options.deployment_target_id, + ...(options.run_id ? { run_id: options.run_id } : {}), + ...(options.step_id ? { step_id: options.step_id } : {}), + ...(options.chat_id ? { chat_id: options.chat_id } : {}), + }; + + const rows: OtelSpan[] = []; + + for (const scopeSpans of resourceSpans.scopeSpans) { + rows.push( + ...mapScopeSpans({ + scopeSpans, + agentId: options.agent_id, + resourceAttributes: resourceAttrs, + resourceDroppedAttributesCount: + resourceSpans.resource?.droppedAttributesCount ?? 0, + resourceSchemaUrl: normalizeSchemaUrl(resourceSpans.schemaUrl), + }) + ); + } + + return rows; +} + +function mapScopeSpans(args: { + scopeSpans: ScopeSpans; + agentId: string; + + resourceAttributes: Record; + resourceDroppedAttributesCount: number; + resourceSchemaUrl?: string | undefined; +}): OtelSpan[] { + const { + scopeSpans, + agentId, + resourceAttributes, + resourceSchemaUrl, + resourceDroppedAttributesCount, + } = args; + + const scope = scopeSpans.scope; + const scopeAttributes = keyValuesToRecord(scope?.attributes ?? []); + + const scopeName = normalizeEmpty(scope?.name); + const scopeVersion = normalizeEmpty(scope?.version); + const scopeDroppedAttributesCount = scope?.droppedAttributesCount ?? 0; + const scopeSchemaUrl = normalizeSchemaUrl(scopeSpans.schemaUrl); + + const spanRows: OtelSpan[] = []; + + for (const span of scopeSpans.spans) { + spanRows.push( + mapSpan({ + span, + agentId, + resourceAttributes, + resourceDroppedAttributesCount, + resourceSchemaUrl, + scopeAttributes, + scopeName, + scopeVersion, + scopeDroppedAttributesCount, + scopeSchemaUrl, + }) + ); + } + + return spanRows; +} + +function mapSpan(args: { + span: Span; + agentId: string; + resourceAttributes: Record; + resourceDroppedAttributesCount: number; + resourceSchemaUrl?: string | undefined; + scopeAttributes: Record; + scopeName: string | undefined; + scopeVersion: string | undefined; + scopeDroppedAttributesCount: number; + scopeSchemaUrl?: string | undefined; +}): OtelSpan { + const { + span, + agentId, + resourceAttributes, + resourceDroppedAttributesCount, + resourceSchemaUrl, + scopeAttributes, + scopeName, + scopeVersion, + scopeDroppedAttributesCount, + scopeSchemaUrl, + } = args; + + const spanAttributes = keyValuesToRecord(span.attributes ?? []); + + const statusCode = normalizeStatusCode(span.status); + const statusMessage = normalizeEmpty(span.status?.message) ?? ""; + + const startTime = formatUnixNano(span.startTimeUnixNano); + const endTime = formatUnixNano(span.endTimeUnixNano); + const durationNs = bigIntToUnsignedString( + span.endTimeUnixNano > span.startTimeUnixNano + ? span.endTimeUnixNano - span.startTimeUnixNano + : BigInt(0) + ); + + return { + agent_id: agentId, + start_time: startTime, + end_time: endTime, + payload: { + span: { + duration_ns: durationNs, + trace_id: uint8ArrayToHexString(span.traceId), + id: uint8ArrayToHexString(span.spanId), + parent_span_id: uint8ArrayToHexString(span.parentSpanId), + name: span.name, + kind: spanKindLabel(span.kind), + status_code: statusCodeLabel(statusCode), + status_message: statusMessage, + trace_state: span.traceState ?? "", + flags: span.flags ?? 0, + dropped_attributes_count: span.droppedAttributesCount ?? 0, + dropped_events_count: span.droppedEventsCount ?? 0, + dropped_links_count: span.droppedLinksCount ?? 0, + attributes: spanAttributes, + events: mapEvents(span.events ?? []), + links: mapLinks(span.links ?? []), + }, + resource: { + attributes: resourceAttributes, + dropped_attributes_count: resourceDroppedAttributesCount, + schema_url: resourceSchemaUrl, + }, + scope: { + name: scopeName, + version: scopeVersion, + attributes: scopeAttributes, + dropped_attributes_count: scopeDroppedAttributesCount, + schema_url: scopeSchemaUrl, + }, + }, + }; +} + +function normalizeStatusCode(status: Status | undefined): Status_StatusCode { + if (!status) { + return Status_StatusCode.UNSET; + } + if (status.code === undefined || status.code === null) { + return Status_StatusCode.UNSET; + } + return status.code; +} + +function mapEvents(events: Span_Event[]): OtelEvent[] { + return events.map((event) => ({ + time: formatUnixNano(event.timeUnixNano), + name: event.name, + dropped_attributes_count: event.droppedAttributesCount ?? 0, + attributes: keyValuesToRecord(event.attributes ?? []), + })); +} + +function mapLinks(links: Span_Link[]): OtelLink[] { + return links.map((link) => ({ + linked_trace_id: uint8ArrayToHexString(link.traceId), + linked_span_id: uint8ArrayToHexString(link.spanId), + trace_state: link.traceState ?? "", + flags: link.flags ?? 0, + dropped_attributes_count: link.droppedAttributesCount ?? 0, + attributes: keyValuesToRecord(link.attributes ?? []), + })); +} + +function keyValuesToRecord(entries: KeyValue[]): Record { + const result: Record = {}; + + for (const entry of entries) { + if (!entry || !entry.key) { + continue; + } + result[entry.key] = anyValueToJson(entry.value); + } + + return result; +} + +function anyValueToJson(value: AnyValue | undefined): unknown { + if (!value || value.value.case === undefined) { + return null; + } + + switch (value.value.case) { + case "stringValue": + return value.value.value; + case "boolValue": + return value.value.value; + case "intValue": { + const bigintValue = value.value.value; + const numberValue = Number(bigintValue); + if (!Number.isSafeInteger(numberValue)) { + return bigintValue.toString(); + } + return numberValue; + } + case "doubleValue": + return value.value.value; + case "arrayValue": + return value.value.value.values.map((item) => anyValueToJson(item)); + case "kvlistValue": + return keyValuesToRecord(value.value.value.values ?? []); + case "bytesValue": + return Buffer.from(value.value.value).toString("base64"); + default: + const _exhaustiveCheck: never = value.value; + console.warn(`Unhandled any value case: ${value.value}`); + return null; + } +} + +function normalizeSchemaUrl(schemaUrl: string | undefined): string | undefined { + return normalizeEmpty(schemaUrl); +} + +function normalizeEmpty(value: string | undefined): string | undefined { + if (!value) { + return undefined; + } + + const trimmed = value.trim(); + return trimmed.length > 0 ? trimmed : undefined; +} + +function formatUnixNano(unixNano: bigint): string { + const seconds = Number(unixNano / BigInt(1_000_000_000)); + const nanos = Number(unixNano % BigInt(1_000_000_000)); + + const date = new Date(seconds * 1000); + + const year = date.getUTCFullYear(); + const month = padNumber(date.getUTCMonth() + 1, 2); + const day = padNumber(date.getUTCDate(), 2); + const hours = padNumber(date.getUTCHours(), 2); + const minutes = padNumber(date.getUTCMinutes(), 2); + const secondsPart = padNumber(date.getUTCSeconds(), 2); + const nanoPart = padNumber(nanos, 9); + + return `${year}-${month}-${day} ${hours}:${minutes}:${secondsPart}.${nanoPart}`; +} + +function padNumber(value: number, length: number): string { + return value.toString().padStart(length, "0"); +} + +function spanKindLabel(kind: Span["kind"]): string { + switch (kind) { + case Span_SpanKind.INTERNAL: + return "INTERNAL"; + case Span_SpanKind.SERVER: + return "SERVER"; + case Span_SpanKind.CLIENT: + return "CLIENT"; + case Span_SpanKind.PRODUCER: + return "PRODUCER"; + case Span_SpanKind.CONSUMER: + return "CONSUMER"; + case Span_SpanKind.UNSPECIFIED: + return "UNSPECIFIED"; + default: + const _exhaustiveCheck: never = kind; + console.warn(`Unhandled span kind: ${kind}`); + return "UNSPECIFIED"; + } +} + +function statusCodeLabel(code: Status_StatusCode): string { + switch (code) { + case Status_StatusCode.OK: + return "OK"; + case Status_StatusCode.ERROR: + return "ERROR"; + case Status_StatusCode.UNSET: + return "UNSET"; + default: + const _exhaustiveCheck: never = code; + console.warn(`Unhandled status code: ${code}`); + return "UNSET"; + } +} + +function bigIntToUnsignedString(value: bigint): string { + return value < BigInt(0) ? "0" : value.toString(); +} + +function uint8ArrayToHexString(value: Uint8Array | undefined): string { + if (!value || value.length === 0) { + return ""; + } + return Array.from(value) + .map((byte) => byte.toString(16).padStart(2, "0")) + .join(""); +} + +export async function parseOtlpHttpTraces( + req: Request +): Promise { + if (!req.body) { + throw new HTTPException(415, { message: "No body" }); + } + + const ctype = (req.headers.get("content-type") ?? "").toLowerCase(); + + if (ctype.includes("application/x-protobuf")) { + const body = new Uint8Array(await req.arrayBuffer()); + return fromBinary(ExportTraceServiceRequestSchema, body); + } + + if (ctype.includes("application/json")) { + const jsonBody = await req.json(); + return fromJsonString( + ExportTraceServiceRequestSchema, + // OTLP/JSON spec encodes traceId/spanId as hex strings, but protobuf's JSON parser + // expects base64 for bytes fields. This mismatch causes incorrect decoding (it tries + // to base64-decode the hex strings). Fix: convert hex to base64 before parsing. + // See: https://github.com/open-telemetry/opentelemetry-proto/blob/84c25afa92b5a242cbac9d0a7bf325b8fbdfda76/docs/specification.md?plain=1#L409 + JSON.stringify(convertOtelHexIds(jsonBody)) + ); + } + + throw new HTTPException(415, { message: "Unsupported Content-Type" }); +} + +function hexToBytes(hex: string): Uint8Array { + const s = hex.startsWith("0x") ? hex.slice(2) : hex; + if (s.length % 2 !== 0) { + throw new Error("invalid hex length"); + } + return Uint8Array.fromHex(s); +} + +function looksHex(v: unknown): v is string { + if (typeof v !== "string") { + return false; + } + const s = v.startsWith("0x") ? v.slice(2) : v; + return s.length % 2 === 0 && /^[0-9a-fA-F]+$/.test(s); +} + +// Recursively convert only OTLP id fields (hex) to base64 +function convertOtelHexIds(input: unknown): unknown { + if (Array.isArray(input)) { + return input.map(convertOtelHexIds); + } + if (input && typeof input === "object" && input !== null) { + const obj = input as Record; + for (const k of Object.keys(obj)) { + if (k === "traceId" || k === "spanId" || k === "parentSpanId") { + const v = obj[k]; + if (looksHex(v)) { + obj[k] = hexToBytes(v).toBase64(); + } + } else { + obj[k] = convertOtelHexIds(obj[k]); + } + } + } + return input; +} diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts new file mode 100644 index 0000000..6b1e178 --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts @@ -0,0 +1,158 @@ +// Copyright 2020, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/collector/logs/v1/logs_service.proto (package opentelemetry.proto.collector.logs.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenFile, + GenMessage, + GenService, +} from "@bufbuild/protobuf/codegenv2"; +import { + fileDesc, + messageDesc, + serviceDesc, +} from "@bufbuild/protobuf/codegenv2"; +import type { ResourceLogs } from "../../../logs/v1/logs_pb"; +import { file_opentelemetry_proto_logs_v1_logs } from "../../../logs/v1/logs_pb"; + +/** + * Describes the file opentelemetry/proto/collector/logs/v1/logs_service.proto. + */ +export const file_opentelemetry_proto_collector_logs_v1_logs_service: GenFile = + /*@__PURE__*/ + fileDesc( + "CjhvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci9sb2dzL3YxL2xvZ3Nfc2VydmljZS5wcm90bxIlb3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubG9ncy52MSJcChhFeHBvcnRMb2dzU2VydmljZVJlcXVlc3QSQAoNcmVzb3VyY2VfbG9ncxgBIAMoCzIpLm9wZW50ZWxlbWV0cnkucHJvdG8ubG9ncy52MS5SZXNvdXJjZUxvZ3MidQoZRXhwb3J0TG9nc1NlcnZpY2VSZXNwb25zZRJYCg9wYXJ0aWFsX3N1Y2Nlc3MYASABKAsyPy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci5sb2dzLnYxLkV4cG9ydExvZ3NQYXJ0aWFsU3VjY2VzcyJPChhFeHBvcnRMb2dzUGFydGlhbFN1Y2Nlc3MSHAoUcmVqZWN0ZWRfbG9nX3JlY29yZHMYASABKAMSFQoNZXJyb3JfbWVzc2FnZRgCIAEoCTKdAQoLTG9nc1NlcnZpY2USjQEKBkV4cG9ydBI/Lm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLmxvZ3MudjEuRXhwb3J0TG9nc1NlcnZpY2VSZXF1ZXN0GkAub3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubG9ncy52MS5FeHBvcnRMb2dzU2VydmljZVJlc3BvbnNlIgBCmAEKKGlvLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLmxvZ3MudjFCEExvZ3NTZXJ2aWNlUHJvdG9QAVowZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2NvbGxlY3Rvci9sb2dzL3YxqgIlT3BlblRlbGVtZXRyeS5Qcm90by5Db2xsZWN0b3IuTG9ncy5WMWIGcHJvdG8z", + [file_opentelemetry_proto_logs_v1_logs] + ); + +/** + * @generated from message opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest + */ +export type ExportLogsServiceRequest = + Message<"opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"> & { + /** + * An array of ResourceLogs. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.logs.v1.ResourceLogs resource_logs = 1; + */ + resourceLogs: ResourceLogs[]; + }; + +/** + * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest. + * Use `create(ExportLogsServiceRequestSchema)` to create a new message. + */ +export const ExportLogsServiceRequestSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 0); + +/** + * @generated from message opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse + */ +export type ExportLogsServiceResponse = + Message<"opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"> & { + /** + * The details of a partially successful export request. + * + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_` with the number of items it rejected. + * + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * + * A `partial_success` message with an empty value (rejected_ = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + * + * @generated from field: opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess partial_success = 1; + */ + partialSuccess?: ExportLogsPartialSuccess; + }; + +/** + * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse. + * Use `create(ExportLogsServiceResponseSchema)` to create a new message. + */ +export const ExportLogsServiceResponseSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 1); + +/** + * @generated from message opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess + */ +export type ExportLogsPartialSuccess = + Message<"opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"> & { + /** + * The number of rejected log records. + * + * A `rejected_` field holding a `0` value indicates that the + * request was fully accepted. + * + * @generated from field: int64 rejected_log_records = 1; + */ + rejectedLogRecords: bigint; + + /** + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + * + * @generated from field: string error_message = 2; + */ + errorMessage: string; + }; + +/** + * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess. + * Use `create(ExportLogsPartialSuccessSchema)` to create a new message. + */ +export const ExportLogsPartialSuccessSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 2); + +/** + * Service that can be used to push logs between one Application instrumented with + * OpenTelemetry and an collector, or between an collector and a central collector (in this + * case logs are sent/received to/from multiple Applications). + * + * @generated from service opentelemetry.proto.collector.logs.v1.LogsService + */ +export const LogsService: GenService<{ + /** + * @generated from rpc opentelemetry.proto.collector.logs.v1.LogsService.Export + */ + export: { + methodKind: "unary"; + input: typeof ExportLogsServiceRequestSchema; + output: typeof ExportLogsServiceResponseSchema; + }; +}> = + /*@__PURE__*/ + serviceDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 0); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.ts new file mode 100644 index 0000000..143385c --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.ts @@ -0,0 +1,158 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/collector/metrics/v1/metrics_service.proto (package opentelemetry.proto.collector.metrics.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenFile, + GenMessage, + GenService, +} from "@bufbuild/protobuf/codegenv2"; +import { + fileDesc, + messageDesc, + serviceDesc, +} from "@bufbuild/protobuf/codegenv2"; +import type { ResourceMetrics } from "../../../metrics/v1/metrics_pb"; +import { file_opentelemetry_proto_metrics_v1_metrics } from "../../../metrics/v1/metrics_pb"; + +/** + * Describes the file opentelemetry/proto/collector/metrics/v1/metrics_service.proto. + */ +export const file_opentelemetry_proto_collector_metrics_v1_metrics_service: GenFile = + /*@__PURE__*/ + fileDesc( + "Cj5vcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci9tZXRyaWNzL3YxL21ldHJpY3Nfc2VydmljZS5wcm90bxIob3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubWV0cmljcy52MSJoChtFeHBvcnRNZXRyaWNzU2VydmljZVJlcXVlc3QSSQoQcmVzb3VyY2VfbWV0cmljcxgBIAMoCzIvLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5SZXNvdXJjZU1ldHJpY3MifgocRXhwb3J0TWV0cmljc1NlcnZpY2VSZXNwb25zZRJeCg9wYXJ0aWFsX3N1Y2Nlc3MYASABKAsyRS5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci5tZXRyaWNzLnYxLkV4cG9ydE1ldHJpY3NQYXJ0aWFsU3VjY2VzcyJSChtFeHBvcnRNZXRyaWNzUGFydGlhbFN1Y2Nlc3MSHAoUcmVqZWN0ZWRfZGF0YV9wb2ludHMYASABKAMSFQoNZXJyb3JfbWVzc2FnZRgCIAEoCTKsAQoOTWV0cmljc1NlcnZpY2USmQEKBkV4cG9ydBJFLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLm1ldHJpY3MudjEuRXhwb3J0TWV0cmljc1NlcnZpY2VSZXF1ZXN0GkYub3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubWV0cmljcy52MS5FeHBvcnRNZXRyaWNzU2VydmljZVJlc3BvbnNlIgBCpAEKK2lvLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLm1ldHJpY3MudjFCE01ldHJpY3NTZXJ2aWNlUHJvdG9QAVozZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2NvbGxlY3Rvci9tZXRyaWNzL3YxqgIoT3BlblRlbGVtZXRyeS5Qcm90by5Db2xsZWN0b3IuTWV0cmljcy5WMWIGcHJvdG8z", + [file_opentelemetry_proto_metrics_v1_metrics] + ); + +/** + * @generated from message opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest + */ +export type ExportMetricsServiceRequest = + Message<"opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"> & { + /** + * An array of ResourceMetrics. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1; + */ + resourceMetrics: ResourceMetrics[]; + }; + +/** + * Describes the message opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest. + * Use `create(ExportMetricsServiceRequestSchema)` to create a new message. + */ +export const ExportMetricsServiceRequestSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_metrics_v1_metrics_service, 0); + +/** + * @generated from message opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse + */ +export type ExportMetricsServiceResponse = + Message<"opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"> & { + /** + * The details of a partially successful export request. + * + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_` with the number of items it rejected. + * + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * + * A `partial_success` message with an empty value (rejected_ = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + * + * @generated from field: opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess partial_success = 1; + */ + partialSuccess?: ExportMetricsPartialSuccess; + }; + +/** + * Describes the message opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse. + * Use `create(ExportMetricsServiceResponseSchema)` to create a new message. + */ +export const ExportMetricsServiceResponseSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_metrics_v1_metrics_service, 1); + +/** + * @generated from message opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess + */ +export type ExportMetricsPartialSuccess = + Message<"opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"> & { + /** + * The number of rejected data points. + * + * A `rejected_` field holding a `0` value indicates that the + * request was fully accepted. + * + * @generated from field: int64 rejected_data_points = 1; + */ + rejectedDataPoints: bigint; + + /** + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + * + * @generated from field: string error_message = 2; + */ + errorMessage: string; + }; + +/** + * Describes the message opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess. + * Use `create(ExportMetricsPartialSuccessSchema)` to create a new message. + */ +export const ExportMetricsPartialSuccessSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_metrics_v1_metrics_service, 2); + +/** + * Service that can be used to push metrics between one Application + * instrumented with OpenTelemetry and a collector, or between a collector and a + * central collector. + * + * @generated from service opentelemetry.proto.collector.metrics.v1.MetricsService + */ +export const MetricsService: GenService<{ + /** + * @generated from rpc opentelemetry.proto.collector.metrics.v1.MetricsService.Export + */ + export: { + methodKind: "unary"; + input: typeof ExportMetricsServiceRequestSchema; + output: typeof ExportMetricsServiceResponseSchema; + }; +}> = + /*@__PURE__*/ + serviceDesc(file_opentelemetry_proto_collector_metrics_v1_metrics_service, 0); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.ts new file mode 100644 index 0000000..880ef4f --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.ts @@ -0,0 +1,179 @@ +// Copyright 2023, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/collector/profiles/v1development/profiles_service.proto (package opentelemetry.proto.collector.profiles.v1development, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenFile, + GenMessage, + GenService, +} from "@bufbuild/protobuf/codegenv2"; +import { + fileDesc, + messageDesc, + serviceDesc, +} from "@bufbuild/protobuf/codegenv2"; +import type { + ProfilesDictionary, + ResourceProfiles, +} from "../../../profiles/v1development/profiles_pb"; +import { file_opentelemetry_proto_profiles_v1development_profiles } from "../../../profiles/v1development/profiles_pb"; + +/** + * Describes the file opentelemetry/proto/collector/profiles/v1development/profiles_service.proto. + */ +export const file_opentelemetry_proto_collector_profiles_v1development_profiles_service: GenFile = + /*@__PURE__*/ + fileDesc( + "CktvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci9wcm9maWxlcy92MWRldmVsb3BtZW50L3Byb2ZpbGVzX3NlcnZpY2UucHJvdG8SNG9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnQiywEKHEV4cG9ydFByb2ZpbGVzU2VydmljZVJlcXVlc3QSVwoRcmVzb3VyY2VfcHJvZmlsZXMYASADKAsyPC5vcGVudGVsZW1ldHJ5LnByb3RvLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnQuUmVzb3VyY2VQcm9maWxlcxJSCgpkaWN0aW9uYXJ5GAIgASgLMj4ub3BlbnRlbGVtZXRyeS5wcm90by5wcm9maWxlcy52MWRldmVsb3BtZW50LlByb2ZpbGVzRGljdGlvbmFyeSKMAQodRXhwb3J0UHJvZmlsZXNTZXJ2aWNlUmVzcG9uc2USawoPcGFydGlhbF9zdWNjZXNzGAEgASgLMlIub3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IucHJvZmlsZXMudjFkZXZlbG9wbWVudC5FeHBvcnRQcm9maWxlc1BhcnRpYWxTdWNjZXNzIlAKHEV4cG9ydFByb2ZpbGVzUGFydGlhbFN1Y2Nlc3MSGQoRcmVqZWN0ZWRfcHJvZmlsZXMYASABKAMSFQoNZXJyb3JfbWVzc2FnZRgCIAEoCTLHAQoPUHJvZmlsZXNTZXJ2aWNlErMBCgZFeHBvcnQSUi5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci5wcm9maWxlcy52MWRldmVsb3BtZW50LkV4cG9ydFByb2ZpbGVzU2VydmljZVJlcXVlc3QaUy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci5wcm9maWxlcy52MWRldmVsb3BtZW50LkV4cG9ydFByb2ZpbGVzU2VydmljZVJlc3BvbnNlIgBCyQEKN2lvLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnRCFFByb2ZpbGVzU2VydmljZVByb3RvUAFaP2dvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC9jb2xsZWN0b3IvcHJvZmlsZXMvdjFkZXZlbG9wbWVudKoCNE9wZW5UZWxlbWV0cnkuUHJvdG8uQ29sbGVjdG9yLlByb2ZpbGVzLlYxRGV2ZWxvcG1lbnRiBnByb3RvMw", + [file_opentelemetry_proto_profiles_v1development_profiles] + ); + +/** + * @generated from message opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceRequest + */ +export type ExportProfilesServiceRequest = + Message<"opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceRequest"> & { + /** + * An array of ResourceProfiles. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.ResourceProfiles resource_profiles = 1; + */ + resourceProfiles: ResourceProfiles[]; + + /** + * The reference table containing all data shared by profiles across the message being sent. + * + * @generated from field: opentelemetry.proto.profiles.v1development.ProfilesDictionary dictionary = 2; + */ + dictionary?: ProfilesDictionary; + }; + +/** + * Describes the message opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceRequest. + * Use `create(ExportProfilesServiceRequestSchema)` to create a new message. + */ +export const ExportProfilesServiceRequestSchema: GenMessage = + /*@__PURE__*/ + messageDesc( + file_opentelemetry_proto_collector_profiles_v1development_profiles_service, + 0 + ); + +/** + * @generated from message opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceResponse + */ +export type ExportProfilesServiceResponse = + Message<"opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceResponse"> & { + /** + * The details of a partially successful export request. + * + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_` with the number of items it rejected. + * + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * + * A `partial_success` message with an empty value (rejected_ = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + * + * @generated from field: opentelemetry.proto.collector.profiles.v1development.ExportProfilesPartialSuccess partial_success = 1; + */ + partialSuccess?: ExportProfilesPartialSuccess; + }; + +/** + * Describes the message opentelemetry.proto.collector.profiles.v1development.ExportProfilesServiceResponse. + * Use `create(ExportProfilesServiceResponseSchema)` to create a new message. + */ +export const ExportProfilesServiceResponseSchema: GenMessage = + /*@__PURE__*/ + messageDesc( + file_opentelemetry_proto_collector_profiles_v1development_profiles_service, + 1 + ); + +/** + * @generated from message opentelemetry.proto.collector.profiles.v1development.ExportProfilesPartialSuccess + */ +export type ExportProfilesPartialSuccess = + Message<"opentelemetry.proto.collector.profiles.v1development.ExportProfilesPartialSuccess"> & { + /** + * The number of rejected profiles. + * + * A `rejected_` field holding a `0` value indicates that the + * request was fully accepted. + * + * @generated from field: int64 rejected_profiles = 1; + */ + rejectedProfiles: bigint; + + /** + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + * + * @generated from field: string error_message = 2; + */ + errorMessage: string; + }; + +/** + * Describes the message opentelemetry.proto.collector.profiles.v1development.ExportProfilesPartialSuccess. + * Use `create(ExportProfilesPartialSuccessSchema)` to create a new message. + */ +export const ExportProfilesPartialSuccessSchema: GenMessage = + /*@__PURE__*/ + messageDesc( + file_opentelemetry_proto_collector_profiles_v1development_profiles_service, + 2 + ); + +/** + * Service that can be used to push profiles between one Application instrumented with + * OpenTelemetry and a collector, or between a collector and a central collector. + * + * @generated from service opentelemetry.proto.collector.profiles.v1development.ProfilesService + */ +export const ProfilesService: GenService<{ + /** + * @generated from rpc opentelemetry.proto.collector.profiles.v1development.ProfilesService.Export + */ + export: { + methodKind: "unary"; + input: typeof ExportProfilesServiceRequestSchema; + output: typeof ExportProfilesServiceResponseSchema; + }; +}> = + /*@__PURE__*/ + serviceDesc( + file_opentelemetry_proto_collector_profiles_v1development_profiles_service, + 0 + ); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts new file mode 100644 index 0000000..0a115e0 --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts @@ -0,0 +1,158 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/collector/trace/v1/trace_service.proto (package opentelemetry.proto.collector.trace.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenFile, + GenMessage, + GenService, +} from "@bufbuild/protobuf/codegenv2"; +import { + fileDesc, + messageDesc, + serviceDesc, +} from "@bufbuild/protobuf/codegenv2"; +import type { ResourceSpans } from "../../../trace/v1/trace_pb"; +import { file_opentelemetry_proto_trace_v1_trace } from "../../../trace/v1/trace_pb"; + +/** + * Describes the file opentelemetry/proto/collector/trace/v1/trace_service.proto. + */ +export const file_opentelemetry_proto_collector_trace_v1_trace_service: GenFile = + /*@__PURE__*/ + fileDesc( + "CjpvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci90cmFjZS92MS90cmFjZV9zZXJ2aWNlLnByb3RvEiZvcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MSJgChlFeHBvcnRUcmFjZVNlcnZpY2VSZXF1ZXN0EkMKDnJlc291cmNlX3NwYW5zGAEgAygLMisub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5SZXNvdXJjZVNwYW5zIngKGkV4cG9ydFRyYWNlU2VydmljZVJlc3BvbnNlEloKD3BhcnRpYWxfc3VjY2VzcxgBIAEoCzJBLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLnRyYWNlLnYxLkV4cG9ydFRyYWNlUGFydGlhbFN1Y2Nlc3MiSgoZRXhwb3J0VHJhY2VQYXJ0aWFsU3VjY2VzcxIWCg5yZWplY3RlZF9zcGFucxgBIAEoAxIVCg1lcnJvcl9tZXNzYWdlGAIgASgJMqIBCgxUcmFjZVNlcnZpY2USkQEKBkV4cG9ydBJBLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLnRyYWNlLnYxLkV4cG9ydFRyYWNlU2VydmljZVJlcXVlc3QaQi5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MS5FeHBvcnRUcmFjZVNlcnZpY2VSZXNwb25zZSIAQpwBCilpby5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MUIRVHJhY2VTZXJ2aWNlUHJvdG9QAVoxZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2NvbGxlY3Rvci90cmFjZS92MaoCJk9wZW5UZWxlbWV0cnkuUHJvdG8uQ29sbGVjdG9yLlRyYWNlLlYxYgZwcm90bzM", + [file_opentelemetry_proto_trace_v1_trace] + ); + +/** + * @generated from message opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest + */ +export type ExportTraceServiceRequest = + Message<"opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"> & { + /** + * An array of ResourceSpans. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1; + */ + resourceSpans: ResourceSpans[]; + }; + +/** + * Describes the message opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest. + * Use `create(ExportTraceServiceRequestSchema)` to create a new message. + */ +export const ExportTraceServiceRequestSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 0); + +/** + * @generated from message opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse + */ +export type ExportTraceServiceResponse = + Message<"opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"> & { + /** + * The details of a partially successful export request. + * + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_` with the number of items it rejected. + * + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * + * A `partial_success` message with an empty value (rejected_ = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + * + * @generated from field: opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess partial_success = 1; + */ + partialSuccess?: ExportTracePartialSuccess; + }; + +/** + * Describes the message opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse. + * Use `create(ExportTraceServiceResponseSchema)` to create a new message. + */ +export const ExportTraceServiceResponseSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 1); + +/** + * @generated from message opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess + */ +export type ExportTracePartialSuccess = + Message<"opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"> & { + /** + * The number of rejected spans. + * + * A `rejected_` field holding a `0` value indicates that the + * request was fully accepted. + * + * @generated from field: int64 rejected_spans = 1; + */ + rejectedSpans: bigint; + + /** + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + * + * @generated from field: string error_message = 2; + */ + errorMessage: string; + }; + +/** + * Describes the message opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess. + * Use `create(ExportTracePartialSuccessSchema)` to create a new message. + */ +export const ExportTracePartialSuccessSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 2); + +/** + * Service that can be used to push spans between one Application instrumented with + * OpenTelemetry and a collector, or between a collector and a central collector (in this + * case spans are sent/received to/from multiple Applications). + * + * @generated from service opentelemetry.proto.collector.trace.v1.TraceService + */ +export const TraceService: GenService<{ + /** + * @generated from rpc opentelemetry.proto.collector.trace.v1.TraceService.Export + */ + export: { + methodKind: "unary"; + input: typeof ExportTraceServiceRequestSchema; + output: typeof ExportTraceServiceResponseSchema; + }; +}> = + /*@__PURE__*/ + serviceDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 0); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/common/v1/common_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/common/v1/common_pb.ts new file mode 100644 index 0000000..8c108cf --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/common/v1/common_pb.ts @@ -0,0 +1,289 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/common/v1/common.proto (package opentelemetry.proto.common.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; + +/** + * Describes the file opentelemetry/proto/common/v1/common.proto. + */ +export const file_opentelemetry_proto_common_v1_common: GenFile = + /*@__PURE__*/ + fileDesc( + "CipvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbW1vbi92MS9jb21tb24ucHJvdG8SHW9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxIowCCghBbnlWYWx1ZRIWCgxzdHJpbmdfdmFsdWUYASABKAlIABIUCgpib29sX3ZhbHVlGAIgASgISAASEwoJaW50X3ZhbHVlGAMgASgDSAASFgoMZG91YmxlX3ZhbHVlGAQgASgBSAASQAoLYXJyYXlfdmFsdWUYBSABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5BcnJheVZhbHVlSAASQwoMa3ZsaXN0X3ZhbHVlGAYgASgLMisub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWVMaXN0SAASFQoLYnl0ZXNfdmFsdWUYByABKAxIAEIHCgV2YWx1ZSJFCgpBcnJheVZhbHVlEjcKBnZhbHVlcxgBIAMoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLkFueVZhbHVlIkcKDEtleVZhbHVlTGlzdBI3CgZ2YWx1ZXMYASADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZSJPCghLZXlWYWx1ZRILCgNrZXkYASABKAkSNgoFdmFsdWUYAiABKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5BbnlWYWx1ZSKUAQoUSW5zdHJ1bWVudGF0aW9uU2NvcGUSDAoEbmFtZRgBIAEoCRIPCgd2ZXJzaW9uGAIgASgJEjsKCmF0dHJpYnV0ZXMYAyADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZRIgChhkcm9wcGVkX2F0dHJpYnV0ZXNfY291bnQYBCABKA0iWAoJRW50aXR5UmVmEhIKCnNjaGVtYV91cmwYASABKAkSDAoEdHlwZRgCIAEoCRIPCgdpZF9rZXlzGAMgAygJEhgKEGRlc2NyaXB0aW9uX2tleXMYBCADKAlCewogaW8ub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjFCC0NvbW1vblByb3RvUAFaKGdvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC9jb21tb24vdjGqAh1PcGVuVGVsZW1ldHJ5LlByb3RvLkNvbW1vbi5WMWIGcHJvdG8z" + ); + +/** + * AnyValue is used to represent any type of attribute value. AnyValue may contain a + * primitive value such as a string or integer or it may contain an arbitrary nested + * object containing arrays, key-value lists and primitives. + * + * @generated from message opentelemetry.proto.common.v1.AnyValue + */ +export type AnyValue = Message<"opentelemetry.proto.common.v1.AnyValue"> & { + /** + * The value is one of the listed fields. It is valid for all values to be unspecified + * in which case this AnyValue is considered to be "empty". + * + * @generated from oneof opentelemetry.proto.common.v1.AnyValue.value + */ + value: + | { + /** + * @generated from field: string string_value = 1; + */ + value: string; + case: "stringValue"; + } + | { + /** + * @generated from field: bool bool_value = 2; + */ + value: boolean; + case: "boolValue"; + } + | { + /** + * @generated from field: int64 int_value = 3; + */ + value: bigint; + case: "intValue"; + } + | { + /** + * @generated from field: double double_value = 4; + */ + value: number; + case: "doubleValue"; + } + | { + /** + * @generated from field: opentelemetry.proto.common.v1.ArrayValue array_value = 5; + */ + value: ArrayValue; + case: "arrayValue"; + } + | { + /** + * @generated from field: opentelemetry.proto.common.v1.KeyValueList kvlist_value = 6; + */ + value: KeyValueList; + case: "kvlistValue"; + } + | { + /** + * @generated from field: bytes bytes_value = 7; + */ + value: Uint8Array; + case: "bytesValue"; + } + | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message opentelemetry.proto.common.v1.AnyValue. + * Use `create(AnyValueSchema)` to create a new message. + */ +export const AnyValueSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_common_v1_common, 0); + +/** + * ArrayValue is a list of AnyValue messages. We need ArrayValue as a message + * since oneof in AnyValue does not allow repeated fields. + * + * @generated from message opentelemetry.proto.common.v1.ArrayValue + */ +export type ArrayValue = Message<"opentelemetry.proto.common.v1.ArrayValue"> & { + /** + * Array of values. The array may be empty (contain 0 elements). + * + * @generated from field: repeated opentelemetry.proto.common.v1.AnyValue values = 1; + */ + values: AnyValue[]; +}; + +/** + * Describes the message opentelemetry.proto.common.v1.ArrayValue. + * Use `create(ArrayValueSchema)` to create a new message. + */ +export const ArrayValueSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_common_v1_common, 1); + +/** + * KeyValueList is a list of KeyValue messages. We need KeyValueList as a message + * since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need + * a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to + * avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches + * are semantically equivalent. + * + * @generated from message opentelemetry.proto.common.v1.KeyValueList + */ +export type KeyValueList = + Message<"opentelemetry.proto.common.v1.KeyValueList"> & { + /** + * A collection of key/value pairs of key-value pairs. The list may be empty (may + * contain 0 elements). + * The keys MUST be unique (it is not allowed to have more than one + * value with the same key). + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue values = 1; + */ + values: KeyValue[]; + }; + +/** + * Describes the message opentelemetry.proto.common.v1.KeyValueList. + * Use `create(KeyValueListSchema)` to create a new message. + */ +export const KeyValueListSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_common_v1_common, 2); + +/** + * KeyValue is a key-value pair that is used to store Span attributes, Link + * attributes, etc. + * + * @generated from message opentelemetry.proto.common.v1.KeyValue + */ +export type KeyValue = Message<"opentelemetry.proto.common.v1.KeyValue"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: opentelemetry.proto.common.v1.AnyValue value = 2; + */ + value?: AnyValue; +}; + +/** + * Describes the message opentelemetry.proto.common.v1.KeyValue. + * Use `create(KeyValueSchema)` to create a new message. + */ +export const KeyValueSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_common_v1_common, 3); + +/** + * InstrumentationScope is a message representing the instrumentation scope information + * such as the fully qualified name and version. + * + * @generated from message opentelemetry.proto.common.v1.InstrumentationScope + */ +export type InstrumentationScope = + Message<"opentelemetry.proto.common.v1.InstrumentationScope"> & { + /** + * An empty instrumentation scope name means the name is unknown. + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: string version = 2; + */ + version: string; + + /** + * Additional attributes that describe the scope. [Optional]. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 3; + */ + attributes: KeyValue[]; + + /** + * @generated from field: uint32 dropped_attributes_count = 4; + */ + droppedAttributesCount: number; + }; + +/** + * Describes the message opentelemetry.proto.common.v1.InstrumentationScope. + * Use `create(InstrumentationScopeSchema)` to create a new message. + */ +export const InstrumentationScopeSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_common_v1_common, 4); + +/** + * A reference to an Entity. + * Entity represents an object of interest associated with produced telemetry: e.g spans, metrics, profiles, or logs. + * + * Status: [Development] + * + * @generated from message opentelemetry.proto.common.v1.EntityRef + */ +export type EntityRef = Message<"opentelemetry.proto.common.v1.EntityRef"> & { + /** + * The Schema URL, if known. This is the identifier of the Schema that the entity data + * is recorded in. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * + * This schema_url applies to the data in this message and to the Resource attributes + * referenced by id_keys and description_keys. + * TODO: discuss if we are happy with this somewhat complicated definition of what + * the schema_url applies to. + * + * This field obsoletes the schema_url field in ResourceMetrics/ResourceSpans/ResourceLogs. + * + * @generated from field: string schema_url = 1; + */ + schemaUrl: string; + + /** + * Defines the type of the entity. MUST not change during the lifetime of the entity. + * For example: "service" or "host". This field is required and MUST not be empty + * for valid entities. + * + * @generated from field: string type = 2; + */ + type: string; + + /** + * Attribute Keys that identify the entity. + * MUST not change during the lifetime of the entity. The Id must contain at least one attribute. + * These keys MUST exist in the containing {message}.attributes. + * + * @generated from field: repeated string id_keys = 3; + */ + idKeys: string[]; + + /** + * Descriptive (non-identifying) attribute keys of the entity. + * MAY change over the lifetime of the entity. MAY be empty. + * These attribute keys are not part of entity's identity. + * These keys MUST exist in the containing {message}.attributes. + * + * @generated from field: repeated string description_keys = 4; + */ + descriptionKeys: string[]; +}; + +/** + * Describes the message opentelemetry.proto.common.v1.EntityRef. + * Use `create(EntityRefSchema)` to create a new message. + */ +export const EntityRefSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_common_v1_common, 5); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/logs/v1/logs_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/logs/v1/logs_pb.ts new file mode 100644 index 0000000..6e15a14 --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/logs/v1/logs_pb.ts @@ -0,0 +1,490 @@ +// Copyright 2020, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/logs/v1/logs.proto (package opentelemetry.proto.logs.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenEnum, + GenFile, + GenMessage, +} from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { + AnyValue, + InstrumentationScope, + KeyValue, +} from "../../common/v1/common_pb"; +import { file_opentelemetry_proto_common_v1_common } from "../../common/v1/common_pb"; +import type { Resource } from "../../resource/v1/resource_pb"; +import { file_opentelemetry_proto_resource_v1_resource } from "../../resource/v1/resource_pb"; + +/** + * Describes the file opentelemetry/proto/logs/v1/logs.proto. + */ +export const file_opentelemetry_proto_logs_v1_logs: GenFile = + /*@__PURE__*/ + fileDesc( + "CiZvcGVudGVsZW1ldHJ5L3Byb3RvL2xvZ3MvdjEvbG9ncy5wcm90bxIbb3BlbnRlbGVtZXRyeS5wcm90by5sb2dzLnYxIkwKCExvZ3NEYXRhEkAKDXJlc291cmNlX2xvZ3MYASADKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLmxvZ3MudjEuUmVzb3VyY2VMb2dzIqMBCgxSZXNvdXJjZUxvZ3MSOwoIcmVzb3VyY2UYASABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxLlJlc291cmNlEjoKCnNjb3BlX2xvZ3MYAiADKAsyJi5vcGVudGVsZW1ldHJ5LnByb3RvLmxvZ3MudjEuU2NvcGVMb2dzEhIKCnNjaGVtYV91cmwYAyABKAlKBgjoBxDpByKgAQoJU2NvcGVMb2dzEkIKBXNjb3BlGAEgASgLMjMub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuSW5zdHJ1bWVudGF0aW9uU2NvcGUSOwoLbG9nX3JlY29yZHMYAiADKAsyJi5vcGVudGVsZW1ldHJ5LnByb3RvLmxvZ3MudjEuTG9nUmVjb3JkEhIKCnNjaGVtYV91cmwYAyABKAkigwMKCUxvZ1JlY29yZBIWCg50aW1lX3VuaXhfbmFubxgBIAEoBhIfChdvYnNlcnZlZF90aW1lX3VuaXhfbmFubxgLIAEoBhJECg9zZXZlcml0eV9udW1iZXIYAiABKA4yKy5vcGVudGVsZW1ldHJ5LnByb3RvLmxvZ3MudjEuU2V2ZXJpdHlOdW1iZXISFQoNc2V2ZXJpdHlfdGV4dBgDIAEoCRI1CgRib2R5GAUgASgLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuQW55VmFsdWUSOwoKYXR0cmlidXRlcxgGIAMoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLktleVZhbHVlEiAKGGRyb3BwZWRfYXR0cmlidXRlc19jb3VudBgHIAEoDRINCgVmbGFncxgIIAEoBxIQCgh0cmFjZV9pZBgJIAEoDBIPCgdzcGFuX2lkGAogASgMEhIKCmV2ZW50X25hbWUYDCABKAlKBAgEEAUqwwUKDlNldmVyaXR5TnVtYmVyEh8KG1NFVkVSSVRZX05VTUJFUl9VTlNQRUNJRklFRBAAEhkKFVNFVkVSSVRZX05VTUJFUl9UUkFDRRABEhoKFlNFVkVSSVRZX05VTUJFUl9UUkFDRTIQAhIaChZTRVZFUklUWV9OVU1CRVJfVFJBQ0UzEAMSGgoWU0VWRVJJVFlfTlVNQkVSX1RSQUNFNBAEEhkKFVNFVkVSSVRZX05VTUJFUl9ERUJVRxAFEhoKFlNFVkVSSVRZX05VTUJFUl9ERUJVRzIQBhIaChZTRVZFUklUWV9OVU1CRVJfREVCVUczEAcSGgoWU0VWRVJJVFlfTlVNQkVSX0RFQlVHNBAIEhgKFFNFVkVSSVRZX05VTUJFUl9JTkZPEAkSGQoVU0VWRVJJVFlfTlVNQkVSX0lORk8yEAoSGQoVU0VWRVJJVFlfTlVNQkVSX0lORk8zEAsSGQoVU0VWRVJJVFlfTlVNQkVSX0lORk80EAwSGAoUU0VWRVJJVFlfTlVNQkVSX1dBUk4QDRIZChVTRVZFUklUWV9OVU1CRVJfV0FSTjIQDhIZChVTRVZFUklUWV9OVU1CRVJfV0FSTjMQDxIZChVTRVZFUklUWV9OVU1CRVJfV0FSTjQQEBIZChVTRVZFUklUWV9OVU1CRVJfRVJST1IQERIaChZTRVZFUklUWV9OVU1CRVJfRVJST1IyEBISGgoWU0VWRVJJVFlfTlVNQkVSX0VSUk9SMxATEhoKFlNFVkVSSVRZX05VTUJFUl9FUlJPUjQQFBIZChVTRVZFUklUWV9OVU1CRVJfRkFUQUwQFRIaChZTRVZFUklUWV9OVU1CRVJfRkFUQUwyEBYSGgoWU0VWRVJJVFlfTlVNQkVSX0ZBVEFMMxAXEhoKFlNFVkVSSVRZX05VTUJFUl9GQVRBTDQQGCpZCg5Mb2dSZWNvcmRGbGFncxIfChtMT0dfUkVDT1JEX0ZMQUdTX0RPX05PVF9VU0UQABImCiFMT0dfUkVDT1JEX0ZMQUdTX1RSQUNFX0ZMQUdTX01BU0sQ/wFCcwoeaW8ub3BlbnRlbGVtZXRyeS5wcm90by5sb2dzLnYxQglMb2dzUHJvdG9QAVomZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2xvZ3MvdjGqAhtPcGVuVGVsZW1ldHJ5LlByb3RvLkxvZ3MuVjFiBnByb3RvMw", + [ + file_opentelemetry_proto_common_v1_common, + file_opentelemetry_proto_resource_v1_resource, + ] + ); + +/** + * LogsData represents the logs data that can be stored in a persistent storage, + * OR can be embedded by other protocols that transfer OTLP logs data but do not + * implement the OTLP protocol. + * + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + * + * @generated from message opentelemetry.proto.logs.v1.LogsData + */ +export type LogsData = Message<"opentelemetry.proto.logs.v1.LogsData"> & { + /** + * An array of ResourceLogs. + * For data coming from a single resource this array will typically contain + * one element. Intermediary nodes that receive data from multiple origins + * typically batch the data before forwarding further and in that case this + * array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.logs.v1.ResourceLogs resource_logs = 1; + */ + resourceLogs: ResourceLogs[]; +}; + +/** + * Describes the message opentelemetry.proto.logs.v1.LogsData. + * Use `create(LogsDataSchema)` to create a new message. + */ +export const LogsDataSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_logs_v1_logs, 0); + +/** + * A collection of ScopeLogs from a Resource. + * + * @generated from message opentelemetry.proto.logs.v1.ResourceLogs + */ +export type ResourceLogs = + Message<"opentelemetry.proto.logs.v1.ResourceLogs"> & { + /** + * The resource for the logs in this message. + * If this field is not set then resource info is unknown. + * + * @generated from field: opentelemetry.proto.resource.v1.Resource resource = 1; + */ + resource?: Resource; + + /** + * A list of ScopeLogs that originate from a resource. + * + * @generated from field: repeated opentelemetry.proto.logs.v1.ScopeLogs scope_logs = 2; + */ + scopeLogs: ScopeLogs[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the resource data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_logs" field which have their own schema_url field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; + }; + +/** + * Describes the message opentelemetry.proto.logs.v1.ResourceLogs. + * Use `create(ResourceLogsSchema)` to create a new message. + */ +export const ResourceLogsSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_logs_v1_logs, 1); + +/** + * A collection of Logs produced by a Scope. + * + * @generated from message opentelemetry.proto.logs.v1.ScopeLogs + */ +export type ScopeLogs = Message<"opentelemetry.proto.logs.v1.ScopeLogs"> & { + /** + * The instrumentation scope information for the logs in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + * + * @generated from field: opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + */ + scope?: InstrumentationScope; + + /** + * A list of log records. + * + * @generated from field: repeated opentelemetry.proto.logs.v1.LogRecord log_records = 2; + */ + logRecords: LogRecord[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the log data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to all logs in the "logs" field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; +}; + +/** + * Describes the message opentelemetry.proto.logs.v1.ScopeLogs. + * Use `create(ScopeLogsSchema)` to create a new message. + */ +export const ScopeLogsSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_logs_v1_logs, 2); + +/** + * A log record according to OpenTelemetry Log Data Model: + * https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md + * + * @generated from message opentelemetry.proto.logs.v1.LogRecord + */ +export type LogRecord = Message<"opentelemetry.proto.logs.v1.LogRecord"> & { + /** + * time_unix_nano is the time when the event occurred. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * Value of 0 indicates unknown or missing timestamp. + * + * @generated from field: fixed64 time_unix_nano = 1; + */ + timeUnixNano: bigint; + + /** + * Time when the event was observed by the collection system. + * For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK) + * this timestamp is typically set at the generation time and is equal to Timestamp. + * For events originating externally and collected by OpenTelemetry (e.g. using + * Collector) this is the time when OpenTelemetry's code observed the event measured + * by the clock of the OpenTelemetry code. This field MUST be set once the event is + * observed by OpenTelemetry. + * + * For converting OpenTelemetry log data to formats that support only one timestamp or + * when receiving OpenTelemetry log data by recipients that support only one timestamp + * internally the following logic is recommended: + * - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * Value of 0 indicates unknown or missing timestamp. + * + * @generated from field: fixed64 observed_time_unix_nano = 11; + */ + observedTimeUnixNano: bigint; + + /** + * Numerical value of the severity, normalized to values described in Log Data Model. + * [Optional]. + * + * @generated from field: opentelemetry.proto.logs.v1.SeverityNumber severity_number = 2; + */ + severityNumber: SeverityNumber; + + /** + * The severity text (also known as log level). The original string representation as + * it is known at the source. [Optional]. + * + * @generated from field: string severity_text = 3; + */ + severityText: string; + + /** + * A value containing the body of the log record. Can be for example a human-readable + * string message (including multi-line) describing the event in a free form or it can + * be a structured data composed of arrays and maps of other values. [Optional]. + * + * @generated from field: opentelemetry.proto.common.v1.AnyValue body = 5; + */ + body?: AnyValue; + + /** + * Additional attributes that describe the specific event occurrence. [Optional]. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 6; + */ + attributes: KeyValue[]; + + /** + * @generated from field: uint32 dropped_attributes_count = 7; + */ + droppedAttributesCount: number; + + /** + * Flags, a bit field. 8 least significant bits are the trace flags as + * defined in W3C Trace Context specification. 24 most significant bits are reserved + * and must be set to 0. Readers must not assume that 24 most significant bits + * will be zero and must correctly mask the bits when reading 8-bit trace flag (use + * flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK). [Optional]. + * + * @generated from field: fixed32 flags = 8; + */ + flags: number; + + /** + * A unique identifier for a trace. All logs from the same trace share + * the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR + * of length other than 16 bytes is considered invalid (empty string in OTLP/JSON + * is zero-length and thus is also invalid). + * + * This field is optional. + * + * The receivers SHOULD assume that the log record is not associated with a + * trace if any of the following is true: + * - the field is not present, + * - the field contains an invalid value. + * + * @generated from field: bytes trace_id = 9; + */ + traceId: Uint8Array; + + /** + * A unique identifier for a span within a trace, assigned when the span + * is created. The ID is an 8-byte array. An ID with all zeroes OR of length + * other than 8 bytes is considered invalid (empty string in OTLP/JSON + * is zero-length and thus is also invalid). + * + * This field is optional. If the sender specifies a valid span_id then it SHOULD also + * specify a valid trace_id. + * + * The receivers SHOULD assume that the log record is not associated with a + * span if any of the following is true: + * - the field is not present, + * - the field contains an invalid value. + * + * @generated from field: bytes span_id = 10; + */ + spanId: Uint8Array; + + /** + * A unique identifier of event category/type. + * All events with the same event_name are expected to conform to the same + * schema for both their attributes and their body. + * + * Recommended to be fully qualified and short (no longer than 256 characters). + * + * Presence of event_name on the log record identifies this record + * as an event. + * + * [Optional]. + * + * @generated from field: string event_name = 12; + */ + eventName: string; +}; + +/** + * Describes the message opentelemetry.proto.logs.v1.LogRecord. + * Use `create(LogRecordSchema)` to create a new message. + */ +export const LogRecordSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_logs_v1_logs, 3); + +/** + * Possible values for LogRecord.SeverityNumber. + * + * @generated from enum opentelemetry.proto.logs.v1.SeverityNumber + */ +export enum SeverityNumber { + /** + * UNSPECIFIED is the default SeverityNumber, it MUST NOT be used. + * + * @generated from enum value: SEVERITY_NUMBER_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: SEVERITY_NUMBER_TRACE = 1; + */ + TRACE = 1, + + /** + * @generated from enum value: SEVERITY_NUMBER_TRACE2 = 2; + */ + TRACE2 = 2, + + /** + * @generated from enum value: SEVERITY_NUMBER_TRACE3 = 3; + */ + TRACE3 = 3, + + /** + * @generated from enum value: SEVERITY_NUMBER_TRACE4 = 4; + */ + TRACE4 = 4, + + /** + * @generated from enum value: SEVERITY_NUMBER_DEBUG = 5; + */ + DEBUG = 5, + + /** + * @generated from enum value: SEVERITY_NUMBER_DEBUG2 = 6; + */ + DEBUG2 = 6, + + /** + * @generated from enum value: SEVERITY_NUMBER_DEBUG3 = 7; + */ + DEBUG3 = 7, + + /** + * @generated from enum value: SEVERITY_NUMBER_DEBUG4 = 8; + */ + DEBUG4 = 8, + + /** + * @generated from enum value: SEVERITY_NUMBER_INFO = 9; + */ + INFO = 9, + + /** + * @generated from enum value: SEVERITY_NUMBER_INFO2 = 10; + */ + INFO2 = 10, + + /** + * @generated from enum value: SEVERITY_NUMBER_INFO3 = 11; + */ + INFO3 = 11, + + /** + * @generated from enum value: SEVERITY_NUMBER_INFO4 = 12; + */ + INFO4 = 12, + + /** + * @generated from enum value: SEVERITY_NUMBER_WARN = 13; + */ + WARN = 13, + + /** + * @generated from enum value: SEVERITY_NUMBER_WARN2 = 14; + */ + WARN2 = 14, + + /** + * @generated from enum value: SEVERITY_NUMBER_WARN3 = 15; + */ + WARN3 = 15, + + /** + * @generated from enum value: SEVERITY_NUMBER_WARN4 = 16; + */ + WARN4 = 16, + + /** + * @generated from enum value: SEVERITY_NUMBER_ERROR = 17; + */ + ERROR = 17, + + /** + * @generated from enum value: SEVERITY_NUMBER_ERROR2 = 18; + */ + ERROR2 = 18, + + /** + * @generated from enum value: SEVERITY_NUMBER_ERROR3 = 19; + */ + ERROR3 = 19, + + /** + * @generated from enum value: SEVERITY_NUMBER_ERROR4 = 20; + */ + ERROR4 = 20, + + /** + * @generated from enum value: SEVERITY_NUMBER_FATAL = 21; + */ + FATAL = 21, + + /** + * @generated from enum value: SEVERITY_NUMBER_FATAL2 = 22; + */ + FATAL2 = 22, + + /** + * @generated from enum value: SEVERITY_NUMBER_FATAL3 = 23; + */ + FATAL3 = 23, + + /** + * @generated from enum value: SEVERITY_NUMBER_FATAL4 = 24; + */ + FATAL4 = 24, +} + +/** + * Describes the enum opentelemetry.proto.logs.v1.SeverityNumber. + */ +export const SeverityNumberSchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_logs_v1_logs, 0); + +/** + * LogRecordFlags represents constants used to interpret the + * LogRecord.flags field, which is protobuf 'fixed32' type and is to + * be used as bit-fields. Each non-zero value defined in this enum is + * a bit-mask. To extract the bit-field, for example, use an + * expression like: + * + * (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK) + * + * + * @generated from enum opentelemetry.proto.logs.v1.LogRecordFlags + */ +export enum LogRecordFlags { + /** + * The zero value for the enum. Should not be used for comparisons. + * Instead use bitwise "and" with the appropriate mask as shown above. + * + * @generated from enum value: LOG_RECORD_FLAGS_DO_NOT_USE = 0; + */ + DO_NOT_USE = 0, + + /** + * Bits 0-7 are used for trace flags. + * + * @generated from enum value: LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255; + */ + TRACE_FLAGS_MASK = 255, +} + +/** + * Describes the enum opentelemetry.proto.logs.v1.LogRecordFlags. + */ +export const LogRecordFlagsSchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_logs_v1_logs, 1); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/metrics/v1/metrics_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/metrics/v1/metrics_pb.ts new file mode 100644 index 0000000..af8209e --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/metrics/v1/metrics_pb.ts @@ -0,0 +1,1326 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/metrics/v1/metrics.proto (package opentelemetry.proto.metrics.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenEnum, + GenFile, + GenMessage, +} from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { InstrumentationScope, KeyValue } from "../../common/v1/common_pb"; +import { file_opentelemetry_proto_common_v1_common } from "../../common/v1/common_pb"; +import type { Resource } from "../../resource/v1/resource_pb"; +import { file_opentelemetry_proto_resource_v1_resource } from "../../resource/v1/resource_pb"; + +/** + * Describes the file opentelemetry/proto/metrics/v1/metrics.proto. + */ +export const file_opentelemetry_proto_metrics_v1_metrics: GenFile = + /*@__PURE__*/ + fileDesc( + "CixvcGVudGVsZW1ldHJ5L3Byb3RvL21ldHJpY3MvdjEvbWV0cmljcy5wcm90bxIeb3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxIlgKC01ldHJpY3NEYXRhEkkKEHJlc291cmNlX21ldHJpY3MYASADKAsyLy5vcGVudGVsZW1ldHJ5LnByb3RvLm1ldHJpY3MudjEuUmVzb3VyY2VNZXRyaWNzIq8BCg9SZXNvdXJjZU1ldHJpY3MSOwoIcmVzb3VyY2UYASABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxLlJlc291cmNlEkMKDXNjb3BlX21ldHJpY3MYAiADKAsyLC5vcGVudGVsZW1ldHJ5LnByb3RvLm1ldHJpY3MudjEuU2NvcGVNZXRyaWNzEhIKCnNjaGVtYV91cmwYAyABKAlKBgjoBxDpByKfAQoMU2NvcGVNZXRyaWNzEkIKBXNjb3BlGAEgASgLMjMub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuSW5zdHJ1bWVudGF0aW9uU2NvcGUSNwoHbWV0cmljcxgCIAMoCzImLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5NZXRyaWMSEgoKc2NoZW1hX3VybBgDIAEoCSLNAwoGTWV0cmljEgwKBG5hbWUYASABKAkSEwoLZGVzY3JpcHRpb24YAiABKAkSDAoEdW5pdBgDIAEoCRI2CgVnYXVnZRgFIAEoCzIlLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5HYXVnZUgAEjIKA3N1bRgHIAEoCzIjLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5TdW1IABI+CgloaXN0b2dyYW0YCSABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLm1ldHJpY3MudjEuSGlzdG9ncmFtSAASVQoVZXhwb25lbnRpYWxfaGlzdG9ncmFtGAogASgLMjQub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLkV4cG9uZW50aWFsSGlzdG9ncmFtSAASOgoHc3VtbWFyeRgLIAEoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5TdW1tYXJ5SAASOQoIbWV0YWRhdGEYDCADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZUIGCgRkYXRhSgQIBBAFSgQIBhAHSgQICBAJIk0KBUdhdWdlEkQKC2RhdGFfcG9pbnRzGAEgAygLMi8ub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLk51bWJlckRhdGFQb2ludCK6AQoDU3VtEkQKC2RhdGFfcG9pbnRzGAEgAygLMi8ub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLk51bWJlckRhdGFQb2ludBJXChdhZ2dyZWdhdGlvbl90ZW1wb3JhbGl0eRgCIAEoDjI2Lm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5BZ2dyZWdhdGlvblRlbXBvcmFsaXR5EhQKDGlzX21vbm90b25pYxgDIAEoCCKtAQoJSGlzdG9ncmFtEkcKC2RhdGFfcG9pbnRzGAEgAygLMjIub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLkhpc3RvZ3JhbURhdGFQb2ludBJXChdhZ2dyZWdhdGlvbl90ZW1wb3JhbGl0eRgCIAEoDjI2Lm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5BZ2dyZWdhdGlvblRlbXBvcmFsaXR5IsMBChRFeHBvbmVudGlhbEhpc3RvZ3JhbRJSCgtkYXRhX3BvaW50cxgBIAMoCzI9Lm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5FeHBvbmVudGlhbEhpc3RvZ3JhbURhdGFQb2ludBJXChdhZ2dyZWdhdGlvbl90ZW1wb3JhbGl0eRgCIAEoDjI2Lm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5BZ2dyZWdhdGlvblRlbXBvcmFsaXR5IlAKB1N1bW1hcnkSRQoLZGF0YV9wb2ludHMYASADKAsyMC5vcGVudGVsZW1ldHJ5LnByb3RvLm1ldHJpY3MudjEuU3VtbWFyeURhdGFQb2ludCKGAgoPTnVtYmVyRGF0YVBvaW50EjsKCmF0dHJpYnV0ZXMYByADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZRIcChRzdGFydF90aW1lX3VuaXhfbmFubxgCIAEoBhIWCg50aW1lX3VuaXhfbmFubxgDIAEoBhITCglhc19kb3VibGUYBCABKAFIABIQCgZhc19pbnQYBiABKBBIABI7CglleGVtcGxhcnMYBSADKAsyKC5vcGVudGVsZW1ldHJ5LnByb3RvLm1ldHJpY3MudjEuRXhlbXBsYXISDQoFZmxhZ3MYCCABKA1CBwoFdmFsdWVKBAgBEAIi5gIKEkhpc3RvZ3JhbURhdGFQb2ludBI7CgphdHRyaWJ1dGVzGAkgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSHAoUc3RhcnRfdGltZV91bml4X25hbm8YAiABKAYSFgoOdGltZV91bml4X25hbm8YAyABKAYSDQoFY291bnQYBCABKAYSEAoDc3VtGAUgASgBSACIAQESFQoNYnVja2V0X2NvdW50cxgGIAMoBhIXCg9leHBsaWNpdF9ib3VuZHMYByADKAESOwoJZXhlbXBsYXJzGAggAygLMigub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLkV4ZW1wbGFyEg0KBWZsYWdzGAogASgNEhAKA21pbhgLIAEoAUgBiAEBEhAKA21heBgMIAEoAUgCiAEBQgYKBF9zdW1CBgoEX21pbkIGCgRfbWF4SgQIARACItoECh1FeHBvbmVudGlhbEhpc3RvZ3JhbURhdGFQb2ludBI7CgphdHRyaWJ1dGVzGAEgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSHAoUc3RhcnRfdGltZV91bml4X25hbm8YAiABKAYSFgoOdGltZV91bml4X25hbm8YAyABKAYSDQoFY291bnQYBCABKAYSEAoDc3VtGAUgASgBSACIAQESDQoFc2NhbGUYBiABKBESEgoKemVyb19jb3VudBgHIAEoBhJXCghwb3NpdGl2ZRgIIAEoCzJFLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MS5FeHBvbmVudGlhbEhpc3RvZ3JhbURhdGFQb2ludC5CdWNrZXRzElcKCG5lZ2F0aXZlGAkgASgLMkUub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLkV4cG9uZW50aWFsSGlzdG9ncmFtRGF0YVBvaW50LkJ1Y2tldHMSDQoFZmxhZ3MYCiABKA0SOwoJZXhlbXBsYXJzGAsgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by5tZXRyaWNzLnYxLkV4ZW1wbGFyEhAKA21pbhgMIAEoAUgBiAEBEhAKA21heBgNIAEoAUgCiAEBEhYKDnplcm9fdGhyZXNob2xkGA4gASgBGjAKB0J1Y2tldHMSDgoGb2Zmc2V0GAEgASgREhUKDWJ1Y2tldF9jb3VudHMYAiADKARCBgoEX3N1bUIGCgRfbWluQgYKBF9tYXgixQIKEFN1bW1hcnlEYXRhUG9pbnQSOwoKYXR0cmlidXRlcxgHIAMoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLktleVZhbHVlEhwKFHN0YXJ0X3RpbWVfdW5peF9uYW5vGAIgASgGEhYKDnRpbWVfdW5peF9uYW5vGAMgASgGEg0KBWNvdW50GAQgASgGEgsKA3N1bRgFIAEoARJZCg9xdWFudGlsZV92YWx1ZXMYBiADKAsyQC5vcGVudGVsZW1ldHJ5LnByb3RvLm1ldHJpY3MudjEuU3VtbWFyeURhdGFQb2ludC5WYWx1ZUF0UXVhbnRpbGUSDQoFZmxhZ3MYCCABKA0aMgoPVmFsdWVBdFF1YW50aWxlEhAKCHF1YW50aWxlGAEgASgBEg0KBXZhbHVlGAIgASgBSgQIARACIsEBCghFeGVtcGxhchJEChNmaWx0ZXJlZF9hdHRyaWJ1dGVzGAcgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSFgoOdGltZV91bml4X25hbm8YAiABKAYSEwoJYXNfZG91YmxlGAMgASgBSAASEAoGYXNfaW50GAYgASgQSAASDwoHc3Bhbl9pZBgEIAEoDBIQCgh0cmFjZV9pZBgFIAEoDEIHCgV2YWx1ZUoECAEQAiqMAQoWQWdncmVnYXRpb25UZW1wb3JhbGl0eRInCiNBR0dSRUdBVElPTl9URU1QT1JBTElUWV9VTlNQRUNJRklFRBAAEiEKHUFHR1JFR0FUSU9OX1RFTVBPUkFMSVRZX0RFTFRBEAESJgoiQUdHUkVHQVRJT05fVEVNUE9SQUxJVFlfQ1VNVUxBVElWRRACKl4KDkRhdGFQb2ludEZsYWdzEh8KG0RBVEFfUE9JTlRfRkxBR1NfRE9fTk9UX1VTRRAAEisKJ0RBVEFfUE9JTlRfRkxBR1NfTk9fUkVDT1JERURfVkFMVUVfTUFTSxABQn8KIWlvLm9wZW50ZWxlbWV0cnkucHJvdG8ubWV0cmljcy52MUIMTWV0cmljc1Byb3RvUAFaKWdvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC9tZXRyaWNzL3YxqgIeT3BlblRlbGVtZXRyeS5Qcm90by5NZXRyaWNzLlYxYgZwcm90bzM", + [ + file_opentelemetry_proto_common_v1_common, + file_opentelemetry_proto_resource_v1_resource, + ] + ); + +/** + * MetricsData represents the metrics data that can be stored in a persistent + * storage, OR can be embedded by other protocols that transfer OTLP metrics + * data but do not implement the OTLP protocol. + * + * MetricsData + * └─── ResourceMetrics + * ├── Resource + * ├── SchemaURL + * └── ScopeMetrics + * ├── Scope + * ├── SchemaURL + * └── Metric + * ├── Name + * ├── Description + * ├── Unit + * └── data + * ├── Gauge + * ├── Sum + * ├── Histogram + * ├── ExponentialHistogram + * └── Summary + * + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + * + * @generated from message opentelemetry.proto.metrics.v1.MetricsData + */ +export type MetricsData = + Message<"opentelemetry.proto.metrics.v1.MetricsData"> & { + /** + * An array of ResourceMetrics. + * For data coming from a single resource this array will typically contain + * one element. Intermediary nodes that receive data from multiple origins + * typically batch the data before forwarding further and in that case this + * array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1; + */ + resourceMetrics: ResourceMetrics[]; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.MetricsData. + * Use `create(MetricsDataSchema)` to create a new message. + */ +export const MetricsDataSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 0); + +/** + * A collection of ScopeMetrics from a Resource. + * + * @generated from message opentelemetry.proto.metrics.v1.ResourceMetrics + */ +export type ResourceMetrics = + Message<"opentelemetry.proto.metrics.v1.ResourceMetrics"> & { + /** + * The resource for the metrics in this message. + * If this field is not set then no resource info is known. + * + * @generated from field: opentelemetry.proto.resource.v1.Resource resource = 1; + */ + resource?: Resource; + + /** + * A list of metrics that originate from a resource. + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.ScopeMetrics scope_metrics = 2; + */ + scopeMetrics: ScopeMetrics[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the resource data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_metrics" field which have their own schema_url field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.ResourceMetrics. + * Use `create(ResourceMetricsSchema)` to create a new message. + */ +export const ResourceMetricsSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 1); + +/** + * A collection of Metrics produced by an Scope. + * + * @generated from message opentelemetry.proto.metrics.v1.ScopeMetrics + */ +export type ScopeMetrics = + Message<"opentelemetry.proto.metrics.v1.ScopeMetrics"> & { + /** + * The instrumentation scope information for the metrics in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + * + * @generated from field: opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + */ + scope?: InstrumentationScope; + + /** + * A list of metrics that originate from an instrumentation library. + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.Metric metrics = 2; + */ + metrics: Metric[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the metric data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to all metrics in the "metrics" field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.ScopeMetrics. + * Use `create(ScopeMetricsSchema)` to create a new message. + */ +export const ScopeMetricsSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 2); + +/** + * Defines a Metric which has one or more timeseries. The following is a + * brief summary of the Metric data model. For more details, see: + * + * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md + * + * The data model and relation between entities is shown in the + * diagram below. Here, "DataPoint" is the term used to refer to any + * one of the specific data point value types, and "points" is the term used + * to refer to any one of the lists of points contained in the Metric. + * + * - Metric is composed of a metadata and data. + * - Metadata part contains a name, description, unit. + * - Data is one of the possible types (Sum, Gauge, Histogram, Summary). + * - DataPoint contains timestamps, attributes, and one of the possible value type + * fields. + * + * Metric + * +------------+ + * |name | + * |description | + * |unit | +------------------------------------+ + * |data |---> |Gauge, Sum, Histogram, Summary, ... | + * +------------+ +------------------------------------+ + * + * Data [One of Gauge, Sum, Histogram, Summary, ...] + * +-----------+ + * |... | // Metadata about the Data. + * |points |--+ + * +-----------+ | + * | +---------------------------+ + * | |DataPoint 1 | + * v |+------+------+ +------+ | + * +-----+ ||label |label |...|label | | + * | 1 |-->||value1|value2|...|valueN| | + * +-----+ |+------+------+ +------+ | + * | . | |+-----+ | + * | . | ||value| | + * | . | |+-----+ | + * | . | +---------------------------+ + * | . | . + * | . | . + * | . | . + * | . | +---------------------------+ + * | . | |DataPoint M | + * +-----+ |+------+------+ +------+ | + * | M |-->||label |label |...|label | | + * +-----+ ||value1|value2|...|valueN| | + * |+------+------+ +------+ | + * |+-----+ | + * ||value| | + * |+-----+ | + * +---------------------------+ + * + * Each distinct type of DataPoint represents the output of a specific + * aggregation function, the result of applying the DataPoint's + * associated function of to one or more measurements. + * + * All DataPoint types have three common fields: + * - Attributes includes key-value pairs associated with the data point + * - TimeUnixNano is required, set to the end time of the aggregation + * - StartTimeUnixNano is optional, but strongly encouraged for DataPoints + * having an AggregationTemporality field, as discussed below. + * + * Both TimeUnixNano and StartTimeUnixNano values are expressed as + * UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * + * # TimeUnixNano + * + * This field is required, having consistent interpretation across + * DataPoint types. TimeUnixNano is the moment corresponding to when + * the data point's aggregate value was captured. + * + * Data points with the 0 value for TimeUnixNano SHOULD be rejected + * by consumers. + * + * # StartTimeUnixNano + * + * StartTimeUnixNano in general allows detecting when a sequence of + * observations is unbroken. This field indicates to consumers the + * start time for points with cumulative and delta + * AggregationTemporality, and it should be included whenever possible + * to support correct rate calculation. Although it may be omitted + * when the start time is truly unknown, setting StartTimeUnixNano is + * strongly encouraged. + * + * @generated from message opentelemetry.proto.metrics.v1.Metric + */ +export type Metric = Message<"opentelemetry.proto.metrics.v1.Metric"> & { + /** + * name of the metric. + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * description of the metric, which can be used in documentation. + * + * @generated from field: string description = 2; + */ + description: string; + + /** + * unit in which the metric value is reported. Follows the format + * described by https://unitsofmeasure.org/ucum.html. + * + * @generated from field: string unit = 3; + */ + unit: string; + + /** + * Data determines the aggregation type (if any) of the metric, what is the + * reported value type for the data points, as well as the relatationship to + * the time interval over which they are reported. + * + * @generated from oneof opentelemetry.proto.metrics.v1.Metric.data + */ + data: + | { + /** + * @generated from field: opentelemetry.proto.metrics.v1.Gauge gauge = 5; + */ + value: Gauge; + case: "gauge"; + } + | { + /** + * @generated from field: opentelemetry.proto.metrics.v1.Sum sum = 7; + */ + value: Sum; + case: "sum"; + } + | { + /** + * @generated from field: opentelemetry.proto.metrics.v1.Histogram histogram = 9; + */ + value: Histogram; + case: "histogram"; + } + | { + /** + * @generated from field: opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10; + */ + value: ExponentialHistogram; + case: "exponentialHistogram"; + } + | { + /** + * @generated from field: opentelemetry.proto.metrics.v1.Summary summary = 11; + */ + value: Summary; + case: "summary"; + } + | { case: undefined; value?: undefined }; + + /** + * Additional metadata attributes that describe the metric. [Optional]. + * Attributes are non-identifying. + * Consumers SHOULD NOT need to be aware of these attributes. + * These attributes MAY be used to encode information allowing + * for lossless roundtrip translation to / from another data model. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue metadata = 12; + */ + metadata: KeyValue[]; +}; + +/** + * Describes the message opentelemetry.proto.metrics.v1.Metric. + * Use `create(MetricSchema)` to create a new message. + */ +export const MetricSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 3); + +/** + * Gauge represents the type of a scalar metric that always exports the + * "current value" for every data point. It should be used for an "unknown" + * aggregation. + * + * A Gauge does not support different aggregation temporalities. Given the + * aggregation is unknown, points cannot be combined using the same + * aggregation, regardless of aggregation temporalities. Therefore, + * AggregationTemporality is not included. Consequently, this also means + * "StartTimeUnixNano" is ignored for all data points. + * + * @generated from message opentelemetry.proto.metrics.v1.Gauge + */ +export type Gauge = Message<"opentelemetry.proto.metrics.v1.Gauge"> & { + /** + * @generated from field: repeated opentelemetry.proto.metrics.v1.NumberDataPoint data_points = 1; + */ + dataPoints: NumberDataPoint[]; +}; + +/** + * Describes the message opentelemetry.proto.metrics.v1.Gauge. + * Use `create(GaugeSchema)` to create a new message. + */ +export const GaugeSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 4); + +/** + * Sum represents the type of a scalar metric that is calculated as a sum of all + * reported measurements over a time interval. + * + * @generated from message opentelemetry.proto.metrics.v1.Sum + */ +export type Sum = Message<"opentelemetry.proto.metrics.v1.Sum"> & { + /** + * @generated from field: repeated opentelemetry.proto.metrics.v1.NumberDataPoint data_points = 1; + */ + dataPoints: NumberDataPoint[]; + + /** + * aggregation_temporality describes if the aggregator reports delta changes + * since last report time, or cumulative changes since a fixed start time. + * + * @generated from field: opentelemetry.proto.metrics.v1.AggregationTemporality aggregation_temporality = 2; + */ + aggregationTemporality: AggregationTemporality; + + /** + * If "true" means that the sum is monotonic. + * + * @generated from field: bool is_monotonic = 3; + */ + isMonotonic: boolean; +}; + +/** + * Describes the message opentelemetry.proto.metrics.v1.Sum. + * Use `create(SumSchema)` to create a new message. + */ +export const SumSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 5); + +/** + * Histogram represents the type of a metric that is calculated by aggregating + * as a Histogram of all reported measurements over a time interval. + * + * @generated from message opentelemetry.proto.metrics.v1.Histogram + */ +export type Histogram = Message<"opentelemetry.proto.metrics.v1.Histogram"> & { + /** + * @generated from field: repeated opentelemetry.proto.metrics.v1.HistogramDataPoint data_points = 1; + */ + dataPoints: HistogramDataPoint[]; + + /** + * aggregation_temporality describes if the aggregator reports delta changes + * since last report time, or cumulative changes since a fixed start time. + * + * @generated from field: opentelemetry.proto.metrics.v1.AggregationTemporality aggregation_temporality = 2; + */ + aggregationTemporality: AggregationTemporality; +}; + +/** + * Describes the message opentelemetry.proto.metrics.v1.Histogram. + * Use `create(HistogramSchema)` to create a new message. + */ +export const HistogramSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 6); + +/** + * ExponentialHistogram represents the type of a metric that is calculated by aggregating + * as a ExponentialHistogram of all reported double measurements over a time interval. + * + * @generated from message opentelemetry.proto.metrics.v1.ExponentialHistogram + */ +export type ExponentialHistogram = + Message<"opentelemetry.proto.metrics.v1.ExponentialHistogram"> & { + /** + * @generated from field: repeated opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint data_points = 1; + */ + dataPoints: ExponentialHistogramDataPoint[]; + + /** + * aggregation_temporality describes if the aggregator reports delta changes + * since last report time, or cumulative changes since a fixed start time. + * + * @generated from field: opentelemetry.proto.metrics.v1.AggregationTemporality aggregation_temporality = 2; + */ + aggregationTemporality: AggregationTemporality; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.ExponentialHistogram. + * Use `create(ExponentialHistogramSchema)` to create a new message. + */ +export const ExponentialHistogramSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 7); + +/** + * Summary metric data are used to convey quantile summaries, + * a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary) + * and OpenMetrics (see: https://github.com/prometheus/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45) + * data type. These data points cannot always be merged in a meaningful way. + * While they can be useful in some applications, histogram data points are + * recommended for new applications. + * Summary metrics do not have an aggregation temporality field. This is + * because the count and sum fields of a SummaryDataPoint are assumed to be + * cumulative values. + * + * @generated from message opentelemetry.proto.metrics.v1.Summary + */ +export type Summary = Message<"opentelemetry.proto.metrics.v1.Summary"> & { + /** + * @generated from field: repeated opentelemetry.proto.metrics.v1.SummaryDataPoint data_points = 1; + */ + dataPoints: SummaryDataPoint[]; +}; + +/** + * Describes the message opentelemetry.proto.metrics.v1.Summary. + * Use `create(SummarySchema)` to create a new message. + */ +export const SummarySchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 8); + +/** + * NumberDataPoint is a single data point in a timeseries that describes the + * time-varying scalar value of a metric. + * + * @generated from message opentelemetry.proto.metrics.v1.NumberDataPoint + */ +export type NumberDataPoint = + Message<"opentelemetry.proto.metrics.v1.NumberDataPoint"> & { + /** + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 7; + */ + attributes: KeyValue[]; + + /** + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 start_time_unix_nano = 2; + */ + startTimeUnixNano: bigint; + + /** + * TimeUnixNano is required, see the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 time_unix_nano = 3; + */ + timeUnixNano: bigint; + + /** + * The value itself. A point is considered invalid when one of the recognized + * value fields is not present inside this oneof. + * + * @generated from oneof opentelemetry.proto.metrics.v1.NumberDataPoint.value + */ + value: + | { + /** + * @generated from field: double as_double = 4; + */ + value: number; + case: "asDouble"; + } + | { + /** + * @generated from field: sfixed64 as_int = 6; + */ + value: bigint; + case: "asInt"; + } + | { case: undefined; value?: undefined }; + + /** + * (Optional) List of exemplars collected from + * measurements that were used to form the data point + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.Exemplar exemplars = 5; + */ + exemplars: Exemplar[]; + + /** + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + * + * @generated from field: uint32 flags = 8; + */ + flags: number; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.NumberDataPoint. + * Use `create(NumberDataPointSchema)` to create a new message. + */ +export const NumberDataPointSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 9); + +/** + * HistogramDataPoint is a single data point in a timeseries that describes the + * time-varying values of a Histogram. A Histogram contains summary statistics + * for a population of values, it may optionally contain the distribution of + * those values across a set of buckets. + * + * If the histogram contains the distribution of values, then both + * "explicit_bounds" and "bucket counts" fields must be defined. + * If the histogram does not contain the distribution of values, then both + * "explicit_bounds" and "bucket_counts" must be omitted and only "count" and + * "sum" are known. + * + * @generated from message opentelemetry.proto.metrics.v1.HistogramDataPoint + */ +export type HistogramDataPoint = + Message<"opentelemetry.proto.metrics.v1.HistogramDataPoint"> & { + /** + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 9; + */ + attributes: KeyValue[]; + + /** + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 start_time_unix_nano = 2; + */ + startTimeUnixNano: bigint; + + /** + * TimeUnixNano is required, see the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 time_unix_nano = 3; + */ + timeUnixNano: bigint; + + /** + * count is the number of values in the population. Must be non-negative. This + * value must be equal to the sum of the "count" fields in buckets if a + * histogram is provided. + * + * @generated from field: fixed64 count = 4; + */ + count: bigint; + + /** + * sum of the values in the population. If count is zero then this field + * must be zero. + * + * Note: Sum should only be filled out when measuring non-negative discrete + * events, and is assumed to be monotonic over the values of these events. + * Negative events *can* be recorded, but sum should not be filled out when + * doing so. This is specifically to enforce compatibility w/ OpenMetrics, + * see: https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#histogram + * + * @generated from field: optional double sum = 5; + */ + sum?: number; + + /** + * bucket_counts is an optional field contains the count values of histogram + * for each bucket. + * + * The sum of the bucket_counts must equal the value in the count field. + * + * The number of elements in bucket_counts array must be by one greater than + * the number of elements in explicit_bounds array. The exception to this rule + * is when the length of bucket_counts is 0, then the length of explicit_bounds + * must also be 0. + * + * @generated from field: repeated fixed64 bucket_counts = 6; + */ + bucketCounts: bigint[]; + + /** + * explicit_bounds specifies buckets with explicitly defined bounds for values. + * + * The boundaries for bucket at index i are: + * + * (-infinity, explicit_bounds[i]] for i == 0 + * (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds) + * (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds) + * + * The values in the explicit_bounds array must be strictly increasing. + * + * Histogram buckets are inclusive of their upper boundary, except the last + * bucket where the boundary is at infinity. This format is intentionally + * compatible with the OpenMetrics histogram definition. + * + * If bucket_counts length is 0 then explicit_bounds length must also be 0, + * otherwise the data point is invalid. + * + * @generated from field: repeated double explicit_bounds = 7; + */ + explicitBounds: number[]; + + /** + * (Optional) List of exemplars collected from + * measurements that were used to form the data point + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.Exemplar exemplars = 8; + */ + exemplars: Exemplar[]; + + /** + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + * + * @generated from field: uint32 flags = 10; + */ + flags: number; + + /** + * min is the minimum value over (start_time, end_time]. + * + * @generated from field: optional double min = 11; + */ + min?: number; + + /** + * max is the maximum value over (start_time, end_time]. + * + * @generated from field: optional double max = 12; + */ + max?: number; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.HistogramDataPoint. + * Use `create(HistogramDataPointSchema)` to create a new message. + */ +export const HistogramDataPointSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 10); + +/** + * ExponentialHistogramDataPoint is a single data point in a timeseries that describes the + * time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains + * summary statistics for a population of values, it may optionally contain the + * distribution of those values across a set of buckets. + * + * + * @generated from message opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint + */ +export type ExponentialHistogramDataPoint = + Message<"opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"> & { + /** + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; + */ + attributes: KeyValue[]; + + /** + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 start_time_unix_nano = 2; + */ + startTimeUnixNano: bigint; + + /** + * TimeUnixNano is required, see the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 time_unix_nano = 3; + */ + timeUnixNano: bigint; + + /** + * count is the number of values in the population. Must be + * non-negative. This value must be equal to the sum of the "bucket_counts" + * values in the positive and negative Buckets plus the "zero_count" field. + * + * @generated from field: fixed64 count = 4; + */ + count: bigint; + + /** + * sum of the values in the population. If count is zero then this field + * must be zero. + * + * Note: Sum should only be filled out when measuring non-negative discrete + * events, and is assumed to be monotonic over the values of these events. + * Negative events *can* be recorded, but sum should not be filled out when + * doing so. This is specifically to enforce compatibility w/ OpenMetrics, + * see: https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#histogram + * + * @generated from field: optional double sum = 5; + */ + sum?: number; + + /** + * scale describes the resolution of the histogram. Boundaries are + * located at powers of the base, where: + * + * base = (2^(2^-scale)) + * + * The histogram bucket identified by `index`, a signed integer, + * contains values that are greater than (base^index) and + * less than or equal to (base^(index+1)). + * + * The positive and negative ranges of the histogram are expressed + * separately. Negative values are mapped by their absolute value + * into the negative range using the same scale as the positive range. + * + * scale is not restricted by the protocol, as the permissible + * values depend on the range of the data. + * + * @generated from field: sint32 scale = 6; + */ + scale: number; + + /** + * zero_count is the count of values that are either exactly zero or + * within the region considered zero by the instrumentation at the + * tolerated degree of precision. This bucket stores values that + * cannot be expressed using the standard exponential formula as + * well as values that have been rounded to zero. + * + * Implementations MAY consider the zero bucket to have probability + * mass equal to (zero_count / count). + * + * @generated from field: fixed64 zero_count = 7; + */ + zeroCount: bigint; + + /** + * positive carries the positive range of exponential bucket counts. + * + * @generated from field: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets positive = 8; + */ + positive?: ExponentialHistogramDataPoint_Buckets; + + /** + * negative carries the negative range of exponential bucket counts. + * + * @generated from field: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets negative = 9; + */ + negative?: ExponentialHistogramDataPoint_Buckets; + + /** + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + * + * @generated from field: uint32 flags = 10; + */ + flags: number; + + /** + * (Optional) List of exemplars collected from + * measurements that were used to form the data point + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.Exemplar exemplars = 11; + */ + exemplars: Exemplar[]; + + /** + * min is the minimum value over (start_time, end_time]. + * + * @generated from field: optional double min = 12; + */ + min?: number; + + /** + * max is the maximum value over (start_time, end_time]. + * + * @generated from field: optional double max = 13; + */ + max?: number; + + /** + * ZeroThreshold may be optionally set to convey the width of the zero + * region. Where the zero region is defined as the closed interval + * [-ZeroThreshold, ZeroThreshold]. + * When ZeroThreshold is 0, zero count bucket stores values that cannot be + * expressed using the standard exponential formula as well as values that + * have been rounded to zero. + * + * @generated from field: double zero_threshold = 14; + */ + zeroThreshold: number; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint. + * Use `create(ExponentialHistogramDataPointSchema)` to create a new message. + */ +export const ExponentialHistogramDataPointSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 11); + +/** + * Buckets are a set of bucket counts, encoded in a contiguous array + * of counts. + * + * @generated from message opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets + */ +export type ExponentialHistogramDataPoint_Buckets = + Message<"opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"> & { + /** + * Offset is the bucket index of the first entry in the bucket_counts array. + * + * Note: This uses a varint encoding as a simple form of compression. + * + * @generated from field: sint32 offset = 1; + */ + offset: number; + + /** + * bucket_counts is an array of count values, where bucket_counts[i] carries + * the count of the bucket at index (offset+i). bucket_counts[i] is the count + * of values greater than base^(offset+i) and less than or equal to + * base^(offset+i+1). + * + * Note: By contrast, the explicit HistogramDataPoint uses + * fixed64. This field is expected to have many buckets, + * especially zeros, so uint64 has been selected to ensure + * varint encoding. + * + * @generated from field: repeated uint64 bucket_counts = 2; + */ + bucketCounts: bigint[]; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets. + * Use `create(ExponentialHistogramDataPoint_BucketsSchema)` to create a new message. + */ +export const ExponentialHistogramDataPoint_BucketsSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 11, 0); + +/** + * SummaryDataPoint is a single data point in a timeseries that describes the + * time-varying values of a Summary metric. The count and sum fields represent + * cumulative values. + * + * @generated from message opentelemetry.proto.metrics.v1.SummaryDataPoint + */ +export type SummaryDataPoint = + Message<"opentelemetry.proto.metrics.v1.SummaryDataPoint"> & { + /** + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 7; + */ + attributes: KeyValue[]; + + /** + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 start_time_unix_nano = 2; + */ + startTimeUnixNano: bigint; + + /** + * TimeUnixNano is required, see the detailed comments above Metric. + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 time_unix_nano = 3; + */ + timeUnixNano: bigint; + + /** + * count is the number of values in the population. Must be non-negative. + * + * @generated from field: fixed64 count = 4; + */ + count: bigint; + + /** + * sum of the values in the population. If count is zero then this field + * must be zero. + * + * Note: Sum should only be filled out when measuring non-negative discrete + * events, and is assumed to be monotonic over the values of these events. + * Negative events *can* be recorded, but sum should not be filled out when + * doing so. This is specifically to enforce compatibility w/ OpenMetrics, + * see: https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#summary + * + * @generated from field: double sum = 5; + */ + sum: number; + + /** + * (Optional) list of values at different quantiles of the distribution calculated + * from the current snapshot. The quantiles must be strictly increasing. + * + * @generated from field: repeated opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile quantile_values = 6; + */ + quantileValues: SummaryDataPoint_ValueAtQuantile[]; + + /** + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + * + * @generated from field: uint32 flags = 8; + */ + flags: number; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.SummaryDataPoint. + * Use `create(SummaryDataPointSchema)` to create a new message. + */ +export const SummaryDataPointSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 12); + +/** + * Represents the value at a given quantile of a distribution. + * + * To record Min and Max values following conventions are used: + * - The 1.0 quantile is equivalent to the maximum value observed. + * - The 0.0 quantile is equivalent to the minimum value observed. + * + * See the following issue for more context: + * https://github.com/open-telemetry/opentelemetry-proto/issues/125 + * + * @generated from message opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile + */ +export type SummaryDataPoint_ValueAtQuantile = + Message<"opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"> & { + /** + * The quantile of a distribution. Must be in the interval + * [0.0, 1.0]. + * + * @generated from field: double quantile = 1; + */ + quantile: number; + + /** + * The value at the given quantile of a distribution. + * + * Quantile values must NOT be negative. + * + * @generated from field: double value = 2; + */ + value: number; + }; + +/** + * Describes the message opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile. + * Use `create(SummaryDataPoint_ValueAtQuantileSchema)` to create a new message. + */ +export const SummaryDataPoint_ValueAtQuantileSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 12, 0); + +/** + * A representation of an exemplar, which is a sample input measurement. + * Exemplars also hold information about the environment when the measurement + * was recorded, for example the span and trace ID of the active span when the + * exemplar was recorded. + * + * @generated from message opentelemetry.proto.metrics.v1.Exemplar + */ +export type Exemplar = Message<"opentelemetry.proto.metrics.v1.Exemplar"> & { + /** + * The set of key/value pairs that were filtered out by the aggregator, but + * recorded alongside the original measurement. Only key/value pairs that were + * filtered out by the aggregator should be included + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue filtered_attributes = 7; + */ + filteredAttributes: KeyValue[]; + + /** + * time_unix_nano is the exact time when this exemplar was recorded + * + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + * + * @generated from field: fixed64 time_unix_nano = 2; + */ + timeUnixNano: bigint; + + /** + * The value of the measurement that was recorded. An exemplar is + * considered invalid when one of the recognized value fields is not present + * inside this oneof. + * + * @generated from oneof opentelemetry.proto.metrics.v1.Exemplar.value + */ + value: + | { + /** + * @generated from field: double as_double = 3; + */ + value: number; + case: "asDouble"; + } + | { + /** + * @generated from field: sfixed64 as_int = 6; + */ + value: bigint; + case: "asInt"; + } + | { case: undefined; value?: undefined }; + + /** + * (Optional) Span ID of the exemplar trace. + * span_id may be missing if the measurement is not recorded inside a trace + * or if the trace is not sampled. + * + * @generated from field: bytes span_id = 4; + */ + spanId: Uint8Array; + + /** + * (Optional) Trace ID of the exemplar trace. + * trace_id may be missing if the measurement is not recorded inside a trace + * or if the trace is not sampled. + * + * @generated from field: bytes trace_id = 5; + */ + traceId: Uint8Array; +}; + +/** + * Describes the message opentelemetry.proto.metrics.v1.Exemplar. + * Use `create(ExemplarSchema)` to create a new message. + */ +export const ExemplarSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_metrics_v1_metrics, 13); + +/** + * AggregationTemporality defines how a metric aggregator reports aggregated + * values. It describes how those values relate to the time interval over + * which they are aggregated. + * + * @generated from enum opentelemetry.proto.metrics.v1.AggregationTemporality + */ +export enum AggregationTemporality { + /** + * UNSPECIFIED is the default AggregationTemporality, it MUST not be used. + * + * @generated from enum value: AGGREGATION_TEMPORALITY_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * DELTA is an AggregationTemporality for a metric aggregator which reports + * changes since last report time. Successive metrics contain aggregation of + * values from continuous and non-overlapping intervals. + * + * The values for a DELTA metric are based only on the time interval + * associated with one measurement cycle. There is no dependency on + * previous measurements like is the case for CUMULATIVE metrics. + * + * For example, consider a system measuring the number of requests that + * it receives and reports the sum of these requests every second as a + * DELTA metric: + * + * 1. The system starts receiving at time=t_0. + * 2. A request is received, the system measures 1 request. + * 3. A request is received, the system measures 1 request. + * 4. A request is received, the system measures 1 request. + * 5. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+1 with a value of 3. + * 6. A request is received, the system measures 1 request. + * 7. A request is received, the system measures 1 request. + * 8. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0+1 to + * t_0+2 with a value of 2. + * + * @generated from enum value: AGGREGATION_TEMPORALITY_DELTA = 1; + */ + DELTA = 1, + + /** + * CUMULATIVE is an AggregationTemporality for a metric aggregator which + * reports changes since a fixed start time. This means that current values + * of a CUMULATIVE metric depend on all previous measurements since the + * start time. Because of this, the sender is required to retain this state + * in some form. If this state is lost or invalidated, the CUMULATIVE metric + * values MUST be reset and a new fixed start time following the last + * reported measurement time sent MUST be used. + * + * For example, consider a system measuring the number of requests that + * it receives and reports the sum of these requests every second as a + * CUMULATIVE metric: + * + * 1. The system starts receiving at time=t_0. + * 2. A request is received, the system measures 1 request. + * 3. A request is received, the system measures 1 request. + * 4. A request is received, the system measures 1 request. + * 5. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+1 with a value of 3. + * 6. A request is received, the system measures 1 request. + * 7. A request is received, the system measures 1 request. + * 8. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+2 with a value of 5. + * 9. The system experiences a fault and loses state. + * 10. The system recovers and resumes receiving at time=t_1. + * 11. A request is received, the system measures 1 request. + * 12. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_1 to + * t_0+1 with a value of 1. + * + * Note: Even though, when reporting changes since last report time, using + * CUMULATIVE is valid, it is not recommended. This may cause problems for + * systems that do not use start_time to determine when the aggregation + * value was reset (e.g. Prometheus). + * + * @generated from enum value: AGGREGATION_TEMPORALITY_CUMULATIVE = 2; + */ + CUMULATIVE = 2, +} + +/** + * Describes the enum opentelemetry.proto.metrics.v1.AggregationTemporality. + */ +export const AggregationTemporalitySchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_metrics_v1_metrics, 0); + +/** + * DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a + * bit-field representing 32 distinct boolean flags. Each flag defined in this + * enum is a bit-mask. To test the presence of a single flag in the flags of + * a data point, for example, use an expression like: + * + * (point.flags & DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK) == DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK + * + * + * @generated from enum opentelemetry.proto.metrics.v1.DataPointFlags + */ +export enum DataPointFlags { + /** + * The zero value for the enum. Should not be used for comparisons. + * Instead use bitwise "and" with the appropriate mask as shown above. + * + * @generated from enum value: DATA_POINT_FLAGS_DO_NOT_USE = 0; + */ + DO_NOT_USE = 0, + + /** + * This DataPoint is valid but has no recorded value. This value + * SHOULD be used to reflect explicitly missing data in a series, as + * for an equivalent to the Prometheus "staleness marker". + * + * @generated from enum value: DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1; + */ + NO_RECORDED_VALUE_MASK = 1, +} + +/** + * Describes the enum opentelemetry.proto.metrics.v1.DataPointFlags. + */ +export const DataPointFlagsSchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_metrics_v1_metrics, 1); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/profiles/v1development/profiles_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/profiles/v1development/profiles_pb.ts new file mode 100644 index 0000000..e2a1cee --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/profiles/v1development/profiles_pb.ts @@ -0,0 +1,897 @@ +// Copyright 2023, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// This file includes work covered by the following copyright and permission notices: +// +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/profiles/v1development/profiles.proto (package opentelemetry.proto.profiles.v1development, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenEnum, + GenFile, + GenMessage, +} from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { AnyValue, InstrumentationScope } from "../../common/v1/common_pb"; +import { file_opentelemetry_proto_common_v1_common } from "../../common/v1/common_pb"; +import type { Resource } from "../../resource/v1/resource_pb"; +import { file_opentelemetry_proto_resource_v1_resource } from "../../resource/v1/resource_pb"; + +/** + * Describes the file opentelemetry/proto/profiles/v1development/profiles.proto. + */ +export const file_opentelemetry_proto_profiles_v1development_profiles: GenFile = + /*@__PURE__*/ + fileDesc( + "CjlvcGVudGVsZW1ldHJ5L3Byb3RvL3Byb2ZpbGVzL3YxZGV2ZWxvcG1lbnQvcHJvZmlsZXMucHJvdG8SKm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudCL2AwoSUHJvZmlsZXNEaWN0aW9uYXJ5EkoKDW1hcHBpbmdfdGFibGUYASADKAsyMy5vcGVudGVsZW1ldHJ5LnByb3RvLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnQuTWFwcGluZxJMCg5sb2NhdGlvbl90YWJsZRgCIAMoCzI0Lm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudC5Mb2NhdGlvbhJMCg5mdW5jdGlvbl90YWJsZRgDIAMoCzI0Lm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudC5GdW5jdGlvbhJECgpsaW5rX3RhYmxlGAQgAygLMjAub3BlbnRlbGVtZXRyeS5wcm90by5wcm9maWxlcy52MWRldmVsb3BtZW50LkxpbmsSFAoMc3RyaW5nX3RhYmxlGAUgAygJElQKD2F0dHJpYnV0ZV90YWJsZRgGIAMoCzI7Lm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudC5LZXlWYWx1ZUFuZFVuaXQSRgoLc3RhY2tfdGFibGUYByADKAsyMS5vcGVudGVsZW1ldHJ5LnByb3RvLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnQuU3RhY2siuwEKDFByb2ZpbGVzRGF0YRJXChFyZXNvdXJjZV9wcm9maWxlcxgBIAMoCzI8Lm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudC5SZXNvdXJjZVByb2ZpbGVzElIKCmRpY3Rpb25hcnkYAiABKAsyPi5vcGVudGVsZW1ldHJ5LnByb3RvLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnQuUHJvZmlsZXNEaWN0aW9uYXJ5Ir4BChBSZXNvdXJjZVByb2ZpbGVzEjsKCHJlc291cmNlGAEgASgLMikub3BlbnRlbGVtZXRyeS5wcm90by5yZXNvdXJjZS52MS5SZXNvdXJjZRJRCg5zY29wZV9wcm9maWxlcxgCIAMoCzI5Lm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudC5TY29wZVByb2ZpbGVzEhIKCnNjaGVtYV91cmwYAyABKAlKBgjoBxDpByKuAQoNU2NvcGVQcm9maWxlcxJCCgVzY29wZRgBIAEoCzIzLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLkluc3RydW1lbnRhdGlvblNjb3BlEkUKCHByb2ZpbGVzGAIgAygLMjMub3BlbnRlbGVtZXRyeS5wcm90by5wcm9maWxlcy52MWRldmVsb3BtZW50LlByb2ZpbGUSEgoKc2NoZW1hX3VybBgDIAEoCSLMAwoHUHJvZmlsZRJKCgtzYW1wbGVfdHlwZRgBIAEoCzI1Lm9wZW50ZWxlbWV0cnkucHJvdG8ucHJvZmlsZXMudjFkZXZlbG9wbWVudC5WYWx1ZVR5cGUSQgoGc2FtcGxlGAIgAygLMjIub3BlbnRlbGVtZXRyeS5wcm90by5wcm9maWxlcy52MWRldmVsb3BtZW50LlNhbXBsZRIWCg50aW1lX3VuaXhfbmFubxgDIAEoBhIVCg1kdXJhdGlvbl9uYW5vGAQgASgEEkoKC3BlcmlvZF90eXBlGAUgASgLMjUub3BlbnRlbGVtZXRyeS5wcm90by5wcm9maWxlcy52MWRldmVsb3BtZW50LlZhbHVlVHlwZRIOCgZwZXJpb2QYBiABKAMSGgoSY29tbWVudF9zdHJpbmRpY2VzGAcgAygFEhIKCnByb2ZpbGVfaWQYCCABKAwSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAkgASgNEh8KF29yaWdpbmFsX3BheWxvYWRfZm9ybWF0GAogASgJEhgKEG9yaWdpbmFsX3BheWxvYWQYCyABKAwSGQoRYXR0cmlidXRlX2luZGljZXMYDCADKAUiKQoETGluaxIQCgh0cmFjZV9pZBgBIAEoDBIPCgdzcGFuX2lkGAIgASgMIp4BCglWYWx1ZVR5cGUSFQoNdHlwZV9zdHJpbmRleBgBIAEoBRIVCg11bml0X3N0cmluZGV4GAIgASgFEmMKF2FnZ3JlZ2F0aW9uX3RlbXBvcmFsaXR5GAMgASgOMkIub3BlbnRlbGVtZXRyeS5wcm90by5wcm9maWxlcy52MWRldmVsb3BtZW50LkFnZ3JlZ2F0aW9uVGVtcG9yYWxpdHkiegoGU2FtcGxlEhMKC3N0YWNrX2luZGV4GAEgASgFEg4KBnZhbHVlcxgCIAMoAxIZChFhdHRyaWJ1dGVfaW5kaWNlcxgDIAMoBRISCgpsaW5rX2luZGV4GAQgASgFEhwKFHRpbWVzdGFtcHNfdW5peF9uYW5vGAUgAygGIoABCgdNYXBwaW5nEhQKDG1lbW9yeV9zdGFydBgBIAEoBBIUCgxtZW1vcnlfbGltaXQYAiABKAQSEwoLZmlsZV9vZmZzZXQYAyABKAQSGQoRZmlsZW5hbWVfc3RyaW5kZXgYBCABKAUSGQoRYXR0cmlidXRlX2luZGljZXMYBSADKAUiIQoFU3RhY2sSGAoQbG9jYXRpb25faW5kaWNlcxgBIAMoBSKNAQoITG9jYXRpb24SFQoNbWFwcGluZ19pbmRleBgBIAEoBRIPCgdhZGRyZXNzGAIgASgEEj4KBGxpbmUYAyADKAsyMC5vcGVudGVsZW1ldHJ5LnByb3RvLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnQuTGluZRIZChFhdHRyaWJ1dGVfaW5kaWNlcxgEIAMoBSI8CgRMaW5lEhYKDmZ1bmN0aW9uX2luZGV4GAEgASgFEgwKBGxpbmUYAiABKAMSDgoGY29sdW1uGAMgASgDIm4KCEZ1bmN0aW9uEhUKDW5hbWVfc3RyaW5kZXgYASABKAUSHAoUc3lzdGVtX25hbWVfc3RyaW5kZXgYAiABKAUSGQoRZmlsZW5hbWVfc3RyaW5kZXgYAyABKAUSEgoKc3RhcnRfbGluZRgEIAEoAyJ2Cg9LZXlWYWx1ZUFuZFVuaXQSFAoMa2V5X3N0cmluZGV4GAEgASgFEjYKBXZhbHVlGAIgASgLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuQW55VmFsdWUSFQoNdW5pdF9zdHJpbmRleBgDIAEoBSqMAQoWQWdncmVnYXRpb25UZW1wb3JhbGl0eRInCiNBR0dSRUdBVElPTl9URU1QT1JBTElUWV9VTlNQRUNJRklFRBAAEiEKHUFHR1JFR0FUSU9OX1RFTVBPUkFMSVRZX0RFTFRBEAESJgoiQUdHUkVHQVRJT05fVEVNUE9SQUxJVFlfQ1VNVUxBVElWRRACQqQBCi1pby5vcGVudGVsZW1ldHJ5LnByb3RvLnByb2ZpbGVzLnYxZGV2ZWxvcG1lbnRCDVByb2ZpbGVzUHJvdG9QAVo1Z28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL3Byb2ZpbGVzL3YxZGV2ZWxvcG1lbnSqAipPcGVuVGVsZW1ldHJ5LlByb3RvLlByb2ZpbGVzLlYxRGV2ZWxvcG1lbnRiBnByb3RvMw", + [ + file_opentelemetry_proto_common_v1_common, + file_opentelemetry_proto_resource_v1_resource, + ] + ); + +/** + * ProfilesDictionary represents the profiles data shared across the + * entire message being sent. + * + * Note that all fields in this message MUST have a zero value encoded as the first element. + * This allows for _index fields pointing into the dictionary to use a 0 pointer value + * to indicate 'null' / 'not set'. Unless otherwise defined, a 'zero value' message value + * is one with all default field values, so as to minimize wire encoded size. + * + * @generated from message opentelemetry.proto.profiles.v1development.ProfilesDictionary + */ +export type ProfilesDictionary = + Message<"opentelemetry.proto.profiles.v1development.ProfilesDictionary"> & { + /** + * Mappings from address ranges to the image/binary/library mapped + * into that address range referenced by locations via Location.mapping_index. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Mapping mapping_table = 1; + */ + mappingTable: Mapping[]; + + /** + * Locations referenced by samples via Stack.location_indices. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Location location_table = 2; + */ + locationTable: Location[]; + + /** + * Functions referenced by locations via Line.function_index. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Function function_table = 3; + */ + functionTable: Function[]; + + /** + * Links referenced by samples via Sample.link_index. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Link link_table = 4; + */ + linkTable: Link[]; + + /** + * A common table for strings referenced by various messages. + * string_table[0] must always be "". + * + * @generated from field: repeated string string_table = 5; + */ + stringTable: string[]; + + /** + * A common table for attributes referenced by various messages. + * It is a collection of key/value pairs. Note, global attributes + * like server name can be set using the resource API. Examples of attributes: + * + * "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + * "/http/server_latency": 300 + * "abc.com/myattribute": true + * "abc.com/score": 10.239 + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.KeyValueAndUnit attribute_table = 6; + */ + attributeTable: KeyValueAndUnit[]; + + /** + * Stacks referenced by samples via Sample.stack_index. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Stack stack_table = 7; + */ + stackTable: Stack[]; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.ProfilesDictionary. + * Use `create(ProfilesDictionarySchema)` to create a new message. + */ +export const ProfilesDictionarySchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 0); + +/** + * ProfilesData represents the profiles data that can be stored in persistent storage, + * OR can be embedded by other protocols that transfer OTLP profiles data but do not + * implement the OTLP protocol. + * + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + * + * @generated from message opentelemetry.proto.profiles.v1development.ProfilesData + */ +export type ProfilesData = + Message<"opentelemetry.proto.profiles.v1development.ProfilesData"> & { + /** + * An array of ResourceProfiles. + * For data coming from an SDK profiler, this array will typically contain one + * element. Host-level profilers will usually create one ResourceProfile per + * container, as well as one additional ResourceProfile grouping all samples + * from non-containerized processes. + * Other resource groupings are possible as well and clarified via + * Resource.attributes and semantic conventions. + * Tools that visualize profiles should prefer displaying + * resources_profiles[0].scope_profiles[0].profiles[0] by default. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.ResourceProfiles resource_profiles = 1; + */ + resourceProfiles: ResourceProfiles[]; + + /** + * One instance of ProfilesDictionary + * + * @generated from field: opentelemetry.proto.profiles.v1development.ProfilesDictionary dictionary = 2; + */ + dictionary?: ProfilesDictionary; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.ProfilesData. + * Use `create(ProfilesDataSchema)` to create a new message. + */ +export const ProfilesDataSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 1); + +/** + * A collection of ScopeProfiles from a Resource. + * + * @generated from message opentelemetry.proto.profiles.v1development.ResourceProfiles + */ +export type ResourceProfiles = + Message<"opentelemetry.proto.profiles.v1development.ResourceProfiles"> & { + /** + * The resource for the profiles in this message. + * If this field is not set then no resource info is known. + * + * @generated from field: opentelemetry.proto.resource.v1.Resource resource = 1; + */ + resource?: Resource; + + /** + * A list of ScopeProfiles that originate from a resource. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.ScopeProfiles scope_profiles = 2; + */ + scopeProfiles: ScopeProfiles[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the resource data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_profiles" field which have their own schema_url field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.ResourceProfiles. + * Use `create(ResourceProfilesSchema)` to create a new message. + */ +export const ResourceProfilesSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 2); + +/** + * A collection of Profiles produced by an InstrumentationScope. + * + * @generated from message opentelemetry.proto.profiles.v1development.ScopeProfiles + */ +export type ScopeProfiles = + Message<"opentelemetry.proto.profiles.v1development.ScopeProfiles"> & { + /** + * The instrumentation scope information for the profiles in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + * + * @generated from field: opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + */ + scope?: InstrumentationScope; + + /** + * A list of Profiles that originate from an instrumentation scope. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Profile profiles = 2; + */ + profiles: Profile[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the profile data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to all profiles in the "profiles" field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.ScopeProfiles. + * Use `create(ScopeProfilesSchema)` to create a new message. + */ +export const ScopeProfilesSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 3); + +/** + * Represents a complete profile, including sample types, samples, mappings to + * binaries, stacks, locations, functions, string table, and additional + * metadata. It modifies and annotates pprof Profile with OpenTelemetry + * specific fields. + * + * Note that whilst fields in this message retain the name and field id from pprof in most cases + * for ease of understanding data migration, it is not intended that pprof:Profile and + * OpenTelemetry:Profile encoding be wire compatible. + * + * @generated from message opentelemetry.proto.profiles.v1development.Profile + */ +export type Profile = + Message<"opentelemetry.proto.profiles.v1development.Profile"> & { + /** + * The type and unit of all Sample.values in this profile. + * For a cpu or off-cpu profile this might be: + * ["cpu","nanoseconds"] or ["off_cpu","nanoseconds"] + * For a heap profile, this might be: + * ["allocated_objects","count"] or ["allocated_space","bytes"], + * + * @generated from field: opentelemetry.proto.profiles.v1development.ValueType sample_type = 1; + */ + sampleType?: ValueType; + + /** + * The set of samples recorded in this profile. + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Sample sample = 2; + */ + sample: Sample[]; + + /** + * Time of collection (UTC) represented as nanoseconds past the epoch. + * + * @generated from field: fixed64 time_unix_nano = 3; + */ + timeUnixNano: bigint; + + /** + * Duration of the profile, if a duration makes sense. + * + * @generated from field: uint64 duration_nano = 4; + */ + durationNano: bigint; + + /** + * The kind of events between sampled occurrences. + * e.g [ "cpu","cycles" ] or [ "heap","bytes" ] + * + * @generated from field: opentelemetry.proto.profiles.v1development.ValueType period_type = 5; + */ + periodType?: ValueType; + + /** + * The number of events between sampled occurrences. + * + * @generated from field: int64 period = 6; + */ + period: bigint; + + /** + * Free-form text associated with the profile. The text is displayed as is + * to the user by the tools that read profiles (e.g. by pprof). This field + * should not be used to store any machine-readable information, it is only + * for human-friendly content. The profile must stay functional if this field + * is cleaned. + * + * Indices into ProfilesDictionary.string_table. + * + * @generated from field: repeated int32 comment_strindices = 7; + */ + commentStrindices: number[]; + + /** + * A globally unique identifier for a profile. The ID is a 16-byte array. An ID with + * all zeroes is considered invalid. It may be used for deduplication and signal + * correlation purposes. It is acceptable to treat two profiles with different values + * in this field as not equal, even if they represented the same object at an earlier + * time. + * This field is optional; an ID may be assigned to an ID-less profile in a later step. + * + * @generated from field: bytes profile_id = 8; + */ + profileId: Uint8Array; + + /** + * dropped_attributes_count is the number of attributes that were discarded. Attributes + * can be discarded because their keys are too long or because there are too many + * attributes. If this value is 0, then no attributes were dropped. + * + * @generated from field: uint32 dropped_attributes_count = 9; + */ + droppedAttributesCount: number; + + /** + * Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present] + * + * @generated from field: string original_payload_format = 10; + */ + originalPayloadFormat: string; + + /** + * Original payload can be stored in this field. This can be useful for users who want to get the original payload. + * Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. + * Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. + * If the original payload is in pprof format, it SHOULD not be included in this field. + * The field is optional, however if it is present then equivalent converted data should be populated in other fields + * of this message as far as is practicable. + * + * @generated from field: bytes original_payload = 11; + */ + originalPayload: Uint8Array; + + /** + * References to attributes in attribute_table. [optional] + * + * @generated from field: repeated int32 attribute_indices = 12; + */ + attributeIndices: number[]; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Profile. + * Use `create(ProfileSchema)` to create a new message. + */ +export const ProfileSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 4); + +/** + * A pointer from a profile Sample to a trace Span. + * Connects a profile sample to a trace span, identified by unique trace and span IDs. + * + * @generated from message opentelemetry.proto.profiles.v1development.Link + */ +export type Link = + Message<"opentelemetry.proto.profiles.v1development.Link"> & { + /** + * A unique identifier of a trace that this linked span is part of. The ID is a + * 16-byte array. + * + * @generated from field: bytes trace_id = 1; + */ + traceId: Uint8Array; + + /** + * A unique identifier for the linked span. The ID is an 8-byte array. + * + * @generated from field: bytes span_id = 2; + */ + spanId: Uint8Array; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Link. + * Use `create(LinkSchema)` to create a new message. + */ +export const LinkSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 5); + +/** + * ValueType describes the type and units of a value, with an optional aggregation temporality. + * + * @generated from message opentelemetry.proto.profiles.v1development.ValueType + */ +export type ValueType = + Message<"opentelemetry.proto.profiles.v1development.ValueType"> & { + /** + * Index into ProfilesDictionary.string_table. + * + * @generated from field: int32 type_strindex = 1; + */ + typeStrindex: number; + + /** + * Index into ProfilesDictionary.string_table. + * + * @generated from field: int32 unit_strindex = 2; + */ + unitStrindex: number; + + /** + * @generated from field: opentelemetry.proto.profiles.v1development.AggregationTemporality aggregation_temporality = 3; + */ + aggregationTemporality: AggregationTemporality; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.ValueType. + * Use `create(ValueTypeSchema)` to create a new message. + */ +export const ValueTypeSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 6); + +/** + * Each Sample records values encountered in some program context. The program + * context is typically a stack trace, perhaps augmented with auxiliary + * information like the thread-id, some indicator of a higher level request + * being handled etc. + * + * A Sample MUST have have at least one values or timestamps_unix_nano entry. If + * both fields are populated, they MUST contain the same number of elements, and + * the elements at the same index MUST refer to the same event. + * + * Examples of different ways of representing a sample with the total value of 10: + * + * Report of a stacktrace at 10 timestamps (consumers must assume the value is 1 for each point): + * values: [] + * timestamps_unix_nano: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + * + * Report of a stacktrace with an aggregated value without timestamps: + * values: [10] + * timestamps_unix_nano: [] + * + * Report of a stacktrace at 4 timestamps where each point records a specific value: + * values: [2, 2, 3, 3] + * timestamps_unix_nano: [1, 2, 3, 4] + * + * @generated from message opentelemetry.proto.profiles.v1development.Sample + */ +export type Sample = + Message<"opentelemetry.proto.profiles.v1development.Sample"> & { + /** + * Reference to stack in ProfilesDictionary.stack_table. + * + * @generated from field: int32 stack_index = 1; + */ + stackIndex: number; + + /** + * The type and unit of each value is defined by Profile.sample_type. + * + * @generated from field: repeated int64 values = 2; + */ + values: bigint[]; + + /** + * References to attributes in ProfilesDictionary.attribute_table. [optional] + * + * @generated from field: repeated int32 attribute_indices = 3; + */ + attributeIndices: number[]; + + /** + * Reference to link in ProfilesDictionary.link_table. [optional] + * It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value. + * + * @generated from field: int32 link_index = 4; + */ + linkIndex: number; + + /** + * Timestamps associated with Sample represented in nanoseconds. These + * timestamps should fall within the Profile's time range. + * + * @generated from field: repeated fixed64 timestamps_unix_nano = 5; + */ + timestampsUnixNano: bigint[]; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Sample. + * Use `create(SampleSchema)` to create a new message. + */ +export const SampleSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 7); + +/** + * Describes the mapping of a binary in memory, including its address range, + * file offset, and metadata like build ID + * + * @generated from message opentelemetry.proto.profiles.v1development.Mapping + */ +export type Mapping = + Message<"opentelemetry.proto.profiles.v1development.Mapping"> & { + /** + * Address at which the binary (or DLL) is loaded into memory. + * + * @generated from field: uint64 memory_start = 1; + */ + memoryStart: bigint; + + /** + * The limit of the address range occupied by this mapping. + * + * @generated from field: uint64 memory_limit = 2; + */ + memoryLimit: bigint; + + /** + * Offset in the binary that corresponds to the first mapped address. + * + * @generated from field: uint64 file_offset = 3; + */ + fileOffset: bigint; + + /** + * The object this entry is loaded from. This can be a filename on + * disk for the main binary and shared libraries, or virtual + * abstractions like "[vdso]". + * + * Index into ProfilesDictionary.string_table. + * + * @generated from field: int32 filename_strindex = 4; + */ + filenameStrindex: number; + + /** + * References to attributes in ProfilesDictionary.attribute_table. [optional] + * + * @generated from field: repeated int32 attribute_indices = 5; + */ + attributeIndices: number[]; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Mapping. + * Use `create(MappingSchema)` to create a new message. + */ +export const MappingSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 8); + +/** + * A Stack represents a stack trace as a list of locations. + * + * @generated from message opentelemetry.proto.profiles.v1development.Stack + */ +export type Stack = + Message<"opentelemetry.proto.profiles.v1development.Stack"> & { + /** + * References to locations in ProfilesDictionary.location_table. + * The first location is the leaf frame. + * + * @generated from field: repeated int32 location_indices = 1; + */ + locationIndices: number[]; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Stack. + * Use `create(StackSchema)` to create a new message. + */ +export const StackSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 9); + +/** + * Describes function and line table debug information. + * + * @generated from message opentelemetry.proto.profiles.v1development.Location + */ +export type Location = + Message<"opentelemetry.proto.profiles.v1development.Location"> & { + /** + * Reference to mapping in ProfilesDictionary.mapping_table. + * It can be unset / set to 0 if the mapping is unknown or not applicable for + * this profile type, as mapping_table[0] is always a 'null' default mapping. + * + * @generated from field: int32 mapping_index = 1; + */ + mappingIndex: number; + + /** + * The instruction address for this location, if available. It + * should be within [Mapping.memory_start...Mapping.memory_limit] + * for the corresponding mapping. A non-leaf address may be in the + * middle of a call instruction. It is up to display tools to find + * the beginning of the instruction if necessary. + * + * @generated from field: uint64 address = 2; + */ + address: bigint; + + /** + * Multiple line indicates this location has inlined functions, + * where the last entry represents the caller into which the + * preceding entries were inlined. + * + * E.g., if memcpy() is inlined into printf: + * line[0].function_name == "memcpy" + * line[1].function_name == "printf" + * + * @generated from field: repeated opentelemetry.proto.profiles.v1development.Line line = 3; + */ + line: Line[]; + + /** + * References to attributes in ProfilesDictionary.attribute_table. [optional] + * + * @generated from field: repeated int32 attribute_indices = 4; + */ + attributeIndices: number[]; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Location. + * Use `create(LocationSchema)` to create a new message. + */ +export const LocationSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 10); + +/** + * Details a specific line in a source code, linked to a function. + * + * @generated from message opentelemetry.proto.profiles.v1development.Line + */ +export type Line = + Message<"opentelemetry.proto.profiles.v1development.Line"> & { + /** + * Reference to function in ProfilesDictionary.function_table. + * + * @generated from field: int32 function_index = 1; + */ + functionIndex: number; + + /** + * Line number in source code. 0 means unset. + * + * @generated from field: int64 line = 2; + */ + line: bigint; + + /** + * Column number in source code. 0 means unset. + * + * @generated from field: int64 column = 3; + */ + column: bigint; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Line. + * Use `create(LineSchema)` to create a new message. + */ +export const LineSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 11); + +/** + * Describes a function, including its human-readable name, system name, + * source file, and starting line number in the source. + * + * @generated from message opentelemetry.proto.profiles.v1development.Function + */ +export type Function = + Message<"opentelemetry.proto.profiles.v1development.Function"> & { + /** + * Function name. Empty string if not available. + * + * @generated from field: int32 name_strindex = 1; + */ + nameStrindex: number; + + /** + * Function name, as identified by the system. For instance, + * it can be a C++ mangled name. Empty string if not available. + * + * @generated from field: int32 system_name_strindex = 2; + */ + systemNameStrindex: number; + + /** + * Source file containing the function. Empty string if not available. + * + * @generated from field: int32 filename_strindex = 3; + */ + filenameStrindex: number; + + /** + * Line number in source file. 0 means unset. + * + * @generated from field: int64 start_line = 4; + */ + startLine: bigint; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.Function. + * Use `create(FunctionSchema)` to create a new message. + */ +export const FunctionSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 12); + +/** + * A custom 'dictionary native' style of encoding attributes which is more convenient + * for profiles than opentelemetry.proto.common.v1.KeyValue + * Specifically, uses the string table for keys and allows optional unit information. + * + * @generated from message opentelemetry.proto.profiles.v1development.KeyValueAndUnit + */ +export type KeyValueAndUnit = + Message<"opentelemetry.proto.profiles.v1development.KeyValueAndUnit"> & { + /** + * @generated from field: int32 key_strindex = 1; + */ + keyStrindex: number; + + /** + * @generated from field: opentelemetry.proto.common.v1.AnyValue value = 2; + */ + value?: AnyValue; + + /** + * zero indicates implicit (by semconv) or non-defined unit. + * + * @generated from field: int32 unit_strindex = 3; + */ + unitStrindex: number; + }; + +/** + * Describes the message opentelemetry.proto.profiles.v1development.KeyValueAndUnit. + * Use `create(KeyValueAndUnitSchema)` to create a new message. + */ +export const KeyValueAndUnitSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_profiles_v1development_profiles, 13); + +/** + * Specifies the method of aggregating metric values, either DELTA (change since last report) + * or CUMULATIVE (total since a fixed start time). + * + * @generated from enum opentelemetry.proto.profiles.v1development.AggregationTemporality + */ +export enum AggregationTemporality { + /** + * UNSPECIFIED is the default AggregationTemporality, it MUST not be used. + * + * @generated from enum value: AGGREGATION_TEMPORALITY_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * * DELTA is an AggregationTemporality for a profiler which reports + * changes since last report time. Successive metrics contain aggregation of + * values from continuous and non-overlapping intervals. + * + * The values for a DELTA metric are based only on the time interval + * associated with one measurement cycle. There is no dependency on + * previous measurements like is the case for CUMULATIVE metrics. + * + * For example, consider a system measuring the number of requests that + * it receives and reports the sum of these requests every second as a + * DELTA metric: + * + * 1. The system starts receiving at time=t_0. + * 2. A request is received, the system measures 1 request. + * 3. A request is received, the system measures 1 request. + * 4. A request is received, the system measures 1 request. + * 5. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+1 with a value of 3. + * 6. A request is received, the system measures 1 request. + * 7. A request is received, the system measures 1 request. + * 8. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0+1 to + * t_0+2 with a value of 2. + * + * @generated from enum value: AGGREGATION_TEMPORALITY_DELTA = 1; + */ + DELTA = 1, + + /** + * * CUMULATIVE is an AggregationTemporality for a profiler which + * reports changes since a fixed start time. This means that current values + * of a CUMULATIVE metric depend on all previous measurements since the + * start time. Because of this, the sender is required to retain this state + * in some form. If this state is lost or invalidated, the CUMULATIVE metric + * values MUST be reset and a new fixed start time following the last + * reported measurement time sent MUST be used. + * + * For example, consider a system measuring the number of requests that + * it receives and reports the sum of these requests every second as a + * CUMULATIVE metric: + * + * 1. The system starts receiving at time=t_0. + * 2. A request is received, the system measures 1 request. + * 3. A request is received, the system measures 1 request. + * 4. A request is received, the system measures 1 request. + * 5. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+1 with a value of 3. + * 6. A request is received, the system measures 1 request. + * 7. A request is received, the system measures 1 request. + * 8. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+2 with a value of 5. + * 9. The system experiences a fault and loses state. + * 10. The system recovers and resumes receiving at time=t_1. + * 11. A request is received, the system measures 1 request. + * 12. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_1 to + * t_1+1 with a value of 1. + * + * Note: Even though, when reporting changes since last report time, using + * CUMULATIVE is valid, it is not recommended. + * + * @generated from enum value: AGGREGATION_TEMPORALITY_CUMULATIVE = 2; + */ + CUMULATIVE = 2, +} + +/** + * Describes the enum opentelemetry.proto.profiles.v1development.AggregationTemporality. + */ +export const AggregationTemporalitySchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_profiles_v1development_profiles, 0); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/resource/v1/resource_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/resource/v1/resource_pb.ts new file mode 100644 index 0000000..1910da6 --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/resource/v1/resource_pb.ts @@ -0,0 +1,86 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/resource/v1/resource.proto (package opentelemetry.proto.resource.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { EntityRef, KeyValue } from "../../common/v1/common_pb"; +import { file_opentelemetry_proto_common_v1_common } from "../../common/v1/common_pb"; + +/** + * Describes the file opentelemetry/proto/resource/v1/resource.proto. + */ +export const file_opentelemetry_proto_resource_v1_resource: GenFile = + /*@__PURE__*/ + fileDesc( + "Ci5vcGVudGVsZW1ldHJ5L3Byb3RvL3Jlc291cmNlL3YxL3Jlc291cmNlLnByb3RvEh9vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxIqgBCghSZXNvdXJjZRI7CgphdHRyaWJ1dGVzGAEgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAIgASgNEj0KC2VudGl0eV9yZWZzGAMgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuRW50aXR5UmVmQoMBCiJpby5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxQg1SZXNvdXJjZVByb3RvUAFaKmdvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC9yZXNvdXJjZS92MaoCH09wZW5UZWxlbWV0cnkuUHJvdG8uUmVzb3VyY2UuVjFiBnByb3RvMw", + [file_opentelemetry_proto_common_v1_common] + ); + +/** + * Resource information. + * + * @generated from message opentelemetry.proto.resource.v1.Resource + */ +export type Resource = Message<"opentelemetry.proto.resource.v1.Resource"> & { + /** + * Set of attributes that describe the resource. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; + */ + attributes: KeyValue[]; + + /** + * dropped_attributes_count is the number of dropped attributes. If the value is 0, then + * no attributes were dropped. + * + * @generated from field: uint32 dropped_attributes_count = 2; + */ + droppedAttributesCount: number; + + /** + * Set of entities that participate in this Resource. + * + * Note: keys in the references MUST exist in attributes of this message. + * + * Status: [Development] + * + * @generated from field: repeated opentelemetry.proto.common.v1.EntityRef entity_refs = 3; + */ + entityRefs: EntityRef[]; +}; + +/** + * Describes the message opentelemetry.proto.resource.v1.Resource. + * Use `create(ResourceSchema)` to create a new message. + */ +export const ResourceSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_resource_v1_resource, 0); diff --git a/packages/api/src/routes/otlp/gen/opentelemetry/proto/trace/v1/trace_pb.ts b/packages/api/src/routes/otlp/gen/opentelemetry/proto/trace/v1/trace_pb.ts new file mode 100644 index 0000000..939172b --- /dev/null +++ b/packages/api/src/routes/otlp/gen/opentelemetry/proto/trace/v1/trace_pb.ts @@ -0,0 +1,707 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.9.0 with parameter "target=ts" +// @generated from file opentelemetry/proto/trace/v1/trace.proto (package opentelemetry.proto.trace.v1, syntax proto3) +/* eslint-disable */ + +import type { Message } from "@bufbuild/protobuf"; +import type { + GenEnum, + GenFile, + GenMessage, +} from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { InstrumentationScope, KeyValue } from "../../common/v1/common_pb"; +import { file_opentelemetry_proto_common_v1_common } from "../../common/v1/common_pb"; +import type { Resource } from "../../resource/v1/resource_pb"; +import { file_opentelemetry_proto_resource_v1_resource } from "../../resource/v1/resource_pb"; + +/** + * Describes the file opentelemetry/proto/trace/v1/trace.proto. + */ +export const file_opentelemetry_proto_trace_v1_trace: GenFile = + /*@__PURE__*/ + fileDesc( + "CihvcGVudGVsZW1ldHJ5L3Byb3RvL3RyYWNlL3YxL3RyYWNlLnByb3RvEhxvcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxIlEKClRyYWNlc0RhdGESQwoOcmVzb3VyY2Vfc3BhbnMYASADKAsyKy5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxLlJlc291cmNlU3BhbnMipwEKDVJlc291cmNlU3BhbnMSOwoIcmVzb3VyY2UYASABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxLlJlc291cmNlEj0KC3Njb3BlX3NwYW5zGAIgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5TY29wZVNwYW5zEhIKCnNjaGVtYV91cmwYAyABKAlKBgjoBxDpByKXAQoKU2NvcGVTcGFucxJCCgVzY29wZRgBIAEoCzIzLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLkluc3RydW1lbnRhdGlvblNjb3BlEjEKBXNwYW5zGAIgAygLMiIub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5TcGFuEhIKCnNjaGVtYV91cmwYAyABKAkihAgKBFNwYW4SEAoIdHJhY2VfaWQYASABKAwSDwoHc3Bhbl9pZBgCIAEoDBITCgt0cmFjZV9zdGF0ZRgDIAEoCRIWCg5wYXJlbnRfc3Bhbl9pZBgEIAEoDBINCgVmbGFncxgQIAEoBxIMCgRuYW1lGAUgASgJEjkKBGtpbmQYBiABKA4yKy5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxLlNwYW4uU3BhbktpbmQSHAoUc3RhcnRfdGltZV91bml4X25hbm8YByABKAYSGgoSZW5kX3RpbWVfdW5peF9uYW5vGAggASgGEjsKCmF0dHJpYnV0ZXMYCSADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZRIgChhkcm9wcGVkX2F0dHJpYnV0ZXNfY291bnQYCiABKA0SOAoGZXZlbnRzGAsgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5TcGFuLkV2ZW50EhwKFGRyb3BwZWRfZXZlbnRzX2NvdW50GAwgASgNEjYKBWxpbmtzGA0gAygLMicub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5TcGFuLkxpbmsSGwoTZHJvcHBlZF9saW5rc19jb3VudBgOIAEoDRI0CgZzdGF0dXMYDyABKAsyJC5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxLlN0YXR1cxqMAQoFRXZlbnQSFgoOdGltZV91bml4X25hbm8YASABKAYSDAoEbmFtZRgCIAEoCRI7CgphdHRyaWJ1dGVzGAMgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAQgASgNGqwBCgRMaW5rEhAKCHRyYWNlX2lkGAEgASgMEg8KB3NwYW5faWQYAiABKAwSEwoLdHJhY2Vfc3RhdGUYAyABKAkSOwoKYXR0cmlidXRlcxgEIAMoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLktleVZhbHVlEiAKGGRyb3BwZWRfYXR0cmlidXRlc19jb3VudBgFIAEoDRINCgVmbGFncxgGIAEoByKZAQoIU3BhbktpbmQSGQoVU1BBTl9LSU5EX1VOU1BFQ0lGSUVEEAASFgoSU1BBTl9LSU5EX0lOVEVSTkFMEAESFAoQU1BBTl9LSU5EX1NFUlZFUhACEhQKEFNQQU5fS0lORF9DTElFTlQQAxIWChJTUEFOX0tJTkRfUFJPRFVDRVIQBBIWChJTUEFOX0tJTkRfQ09OU1VNRVIQBSKuAQoGU3RhdHVzEg8KB21lc3NhZ2UYAiABKAkSPQoEY29kZRgDIAEoDjIvLm9wZW50ZWxlbWV0cnkucHJvdG8udHJhY2UudjEuU3RhdHVzLlN0YXR1c0NvZGUiTgoKU3RhdHVzQ29kZRIVChFTVEFUVVNfQ09ERV9VTlNFVBAAEhIKDlNUQVRVU19DT0RFX09LEAESFQoRU1RBVFVTX0NPREVfRVJST1IQAkoECAEQAiqcAQoJU3BhbkZsYWdzEhkKFVNQQU5fRkxBR1NfRE9fTk9UX1VTRRAAEiAKG1NQQU5fRkxBR1NfVFJBQ0VfRkxBR1NfTUFTSxD/ARIqCiVTUEFOX0ZMQUdTX0NPTlRFWFRfSEFTX0lTX1JFTU9URV9NQVNLEIACEiYKIVNQQU5fRkxBR1NfQ09OVEVYVF9JU19SRU1PVEVfTUFTSxCABEJ3Ch9pby5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxQgpUcmFjZVByb3RvUAFaJ2dvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC90cmFjZS92MaoCHE9wZW5UZWxlbWV0cnkuUHJvdG8uVHJhY2UuVjFiBnByb3RvMw", + [ + file_opentelemetry_proto_common_v1_common, + file_opentelemetry_proto_resource_v1_resource, + ] + ); + +/** + * TracesData represents the traces data that can be stored in a persistent storage, + * OR can be embedded by other protocols that transfer OTLP traces data but do + * not implement the OTLP protocol. + * + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + * + * @generated from message opentelemetry.proto.trace.v1.TracesData + */ +export type TracesData = Message<"opentelemetry.proto.trace.v1.TracesData"> & { + /** + * An array of ResourceSpans. + * For data coming from a single resource this array will typically contain + * one element. Intermediary nodes that receive data from multiple origins + * typically batch the data before forwarding further and in that case this + * array will contain multiple elements. + * + * @generated from field: repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1; + */ + resourceSpans: ResourceSpans[]; +}; + +/** + * Describes the message opentelemetry.proto.trace.v1.TracesData. + * Use `create(TracesDataSchema)` to create a new message. + */ +export const TracesDataSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 0); + +/** + * A collection of ScopeSpans from a Resource. + * + * @generated from message opentelemetry.proto.trace.v1.ResourceSpans + */ +export type ResourceSpans = + Message<"opentelemetry.proto.trace.v1.ResourceSpans"> & { + /** + * The resource for the spans in this message. + * If this field is not set then no resource info is known. + * + * @generated from field: opentelemetry.proto.resource.v1.Resource resource = 1; + */ + resource?: Resource; + + /** + * A list of ScopeSpans that originate from a resource. + * + * @generated from field: repeated opentelemetry.proto.trace.v1.ScopeSpans scope_spans = 2; + */ + scopeSpans: ScopeSpans[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the resource data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_spans" field which have their own schema_url field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; + }; + +/** + * Describes the message opentelemetry.proto.trace.v1.ResourceSpans. + * Use `create(ResourceSpansSchema)` to create a new message. + */ +export const ResourceSpansSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 1); + +/** + * A collection of Spans produced by an InstrumentationScope. + * + * @generated from message opentelemetry.proto.trace.v1.ScopeSpans + */ +export type ScopeSpans = Message<"opentelemetry.proto.trace.v1.ScopeSpans"> & { + /** + * The instrumentation scope information for the spans in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + * + * @generated from field: opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + */ + scope?: InstrumentationScope; + + /** + * A list of Spans that originate from an instrumentation scope. + * + * @generated from field: repeated opentelemetry.proto.trace.v1.Span spans = 2; + */ + spans: Span[]; + + /** + * The Schema URL, if known. This is the identifier of the Schema that the span data + * is recorded in. Notably, the last part of the URL path is the version number of the + * schema: http[s]://server[:port]/path/. To learn more about Schema URL see + * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + * This schema_url applies to all spans and span events in the "spans" field. + * + * @generated from field: string schema_url = 3; + */ + schemaUrl: string; +}; + +/** + * Describes the message opentelemetry.proto.trace.v1.ScopeSpans. + * Use `create(ScopeSpansSchema)` to create a new message. + */ +export const ScopeSpansSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 2); + +/** + * A Span represents a single operation performed by a single component of the system. + * + * The next available field id is 17. + * + * @generated from message opentelemetry.proto.trace.v1.Span + */ +export type Span = Message<"opentelemetry.proto.trace.v1.Span"> & { + /** + * A unique identifier for a trace. All spans from the same trace share + * the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR + * of length other than 16 bytes is considered invalid (empty string in OTLP/JSON + * is zero-length and thus is also invalid). + * + * This field is required. + * + * @generated from field: bytes trace_id = 1; + */ + traceId: Uint8Array; + + /** + * A unique identifier for a span within a trace, assigned when the span + * is created. The ID is an 8-byte array. An ID with all zeroes OR of length + * other than 8 bytes is considered invalid (empty string in OTLP/JSON + * is zero-length and thus is also invalid). + * + * This field is required. + * + * @generated from field: bytes span_id = 2; + */ + spanId: Uint8Array; + + /** + * trace_state conveys information about request position in multiple distributed tracing graphs. + * It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + * See also https://github.com/w3c/distributed-tracing for more details about this field. + * + * @generated from field: string trace_state = 3; + */ + traceState: string; + + /** + * The `span_id` of this span's parent span. If this is a root span, then this + * field must be empty. The ID is an 8-byte array. + * + * @generated from field: bytes parent_span_id = 4; + */ + parentSpanId: Uint8Array; + + /** + * Flags, a bit field. + * + * Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + * Context specification. To read the 8-bit W3C trace flag, use + * `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + * + * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + * + * Bits 8 and 9 represent the 3 states of whether a span's parent + * is remote. The states are (unknown, is not remote, is remote). + * To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + * To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + * + * When creating span messages, if the message is logically forwarded from another source + * with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD + * be copied as-is. If creating from a source that does not have an equivalent flags field + * (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST + * be set to zero. + * Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + * + * [Optional]. + * + * @generated from field: fixed32 flags = 16; + */ + flags: number; + + /** + * A description of the span's operation. + * + * For example, the name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name at the same call point in an application. + * This makes it easier to correlate spans in different traces. + * + * This field is semantically required to be set to non-empty string. + * Empty value is equivalent to an unknown span name. + * + * This field is required. + * + * @generated from field: string name = 5; + */ + name: string; + + /** + * Distinguishes between spans generated in a particular context. For example, + * two spans with the same name may be distinguished using `CLIENT` (caller) + * and `SERVER` (callee) to identify queueing latency associated with the span. + * + * @generated from field: opentelemetry.proto.trace.v1.Span.SpanKind kind = 6; + */ + kind: Span_SpanKind; + + /** + * start_time_unix_nano is the start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server side, this + * is the time when the server's application handler starts running. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * + * This field is semantically required and it is expected that end_time >= start_time. + * + * @generated from field: fixed64 start_time_unix_nano = 7; + */ + startTimeUnixNano: bigint; + + /** + * end_time_unix_nano is the end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server side, this + * is the time when the server application handler stops running. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * + * This field is semantically required and it is expected that end_time >= start_time. + * + * @generated from field: fixed64 end_time_unix_nano = 8; + */ + endTimeUnixNano: bigint; + + /** + * attributes is a collection of key/value pairs. Note, global attributes + * like server name can be set using the resource API. Examples of attributes: + * + * "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + * "/http/server_latency": 300 + * "example.com/myattribute": true + * "example.com/score": 10.239 + * + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 9; + */ + attributes: KeyValue[]; + + /** + * dropped_attributes_count is the number of attributes that were discarded. Attributes + * can be discarded because their keys are too long or because there are too many + * attributes. If this value is 0, then no attributes were dropped. + * + * @generated from field: uint32 dropped_attributes_count = 10; + */ + droppedAttributesCount: number; + + /** + * events is a collection of Event items. + * + * @generated from field: repeated opentelemetry.proto.trace.v1.Span.Event events = 11; + */ + events: Span_Event[]; + + /** + * dropped_events_count is the number of dropped events. If the value is 0, then no + * events were dropped. + * + * @generated from field: uint32 dropped_events_count = 12; + */ + droppedEventsCount: number; + + /** + * links is a collection of Links, which are references from this span to a span + * in the same or different trace. + * + * @generated from field: repeated opentelemetry.proto.trace.v1.Span.Link links = 13; + */ + links: Span_Link[]; + + /** + * dropped_links_count is the number of dropped links after the maximum size was + * enforced. If this value is 0, then no links were dropped. + * + * @generated from field: uint32 dropped_links_count = 14; + */ + droppedLinksCount: number; + + /** + * An optional final status for this span. Semantically when Status isn't set, it means + * span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). + * + * @generated from field: opentelemetry.proto.trace.v1.Status status = 15; + */ + status?: Status; +}; + +/** + * Describes the message opentelemetry.proto.trace.v1.Span. + * Use `create(SpanSchema)` to create a new message. + */ +export const SpanSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 3); + +/** + * Event is a time-stamped annotation of the span, consisting of user-supplied + * text description and key-value pairs. + * + * @generated from message opentelemetry.proto.trace.v1.Span.Event + */ +export type Span_Event = Message<"opentelemetry.proto.trace.v1.Span.Event"> & { + /** + * time_unix_nano is the time the event occurred. + * + * @generated from field: fixed64 time_unix_nano = 1; + */ + timeUnixNano: bigint; + + /** + * name of the event. + * This field is semantically required to be set to non-empty string. + * + * @generated from field: string name = 2; + */ + name: string; + + /** + * attributes is a collection of attribute key/value pairs on the event. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 3; + */ + attributes: KeyValue[]; + + /** + * dropped_attributes_count is the number of dropped attributes. If the value is 0, + * then no attributes were dropped. + * + * @generated from field: uint32 dropped_attributes_count = 4; + */ + droppedAttributesCount: number; +}; + +/** + * Describes the message opentelemetry.proto.trace.v1.Span.Event. + * Use `create(Span_EventSchema)` to create a new message. + */ +export const Span_EventSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 3, 0); + +/** + * A pointer from the current span to another span in the same trace or in a + * different trace. For example, this can be used in batching operations, + * where a single batch handler processes multiple requests from different + * traces or when the handler receives a request from a different project. + * + * @generated from message opentelemetry.proto.trace.v1.Span.Link + */ +export type Span_Link = Message<"opentelemetry.proto.trace.v1.Span.Link"> & { + /** + * A unique identifier of a trace that this linked span is part of. The ID is a + * 16-byte array. + * + * @generated from field: bytes trace_id = 1; + */ + traceId: Uint8Array; + + /** + * A unique identifier for the linked span. The ID is an 8-byte array. + * + * @generated from field: bytes span_id = 2; + */ + spanId: Uint8Array; + + /** + * The trace_state associated with the link. + * + * @generated from field: string trace_state = 3; + */ + traceState: string; + + /** + * attributes is a collection of attribute key/value pairs on the link. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + * + * The attribute values SHOULD NOT contain empty values. + * The attribute values SHOULD NOT contain bytes values. + * The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, + * double values. + * The attribute values SHOULD NOT contain kvlist values. + * The behavior of software that receives attributes containing such values can be unpredictable. + * These restrictions can change in a minor release. + * The restrictions take origin from the OpenTelemetry specification: + * https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. + * + * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 4; + */ + attributes: KeyValue[]; + + /** + * dropped_attributes_count is the number of dropped attributes. If the value is 0, + * then no attributes were dropped. + * + * @generated from field: uint32 dropped_attributes_count = 5; + */ + droppedAttributesCount: number; + + /** + * Flags, a bit field. + * + * Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + * Context specification. To read the 8-bit W3C trace flag, use + * `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + * + * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + * + * Bits 8 and 9 represent the 3 states of whether the link is remote. + * The states are (unknown, is not remote, is remote). + * To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + * To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + * + * Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + * When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero. + * + * [Optional]. + * + * @generated from field: fixed32 flags = 6; + */ + flags: number; +}; + +/** + * Describes the message opentelemetry.proto.trace.v1.Span.Link. + * Use `create(Span_LinkSchema)` to create a new message. + */ +export const Span_LinkSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 3, 1); + +/** + * SpanKind is the type of span. Can be used to specify additional relationships between spans + * in addition to a parent/child relationship. + * + * @generated from enum opentelemetry.proto.trace.v1.Span.SpanKind + */ +export enum Span_SpanKind { + /** + * Unspecified. Do NOT use as default. + * Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. + * + * @generated from enum value: SPAN_KIND_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * Indicates that the span represents an internal operation within an application, + * as opposed to an operation happening at the boundaries. Default value. + * + * @generated from enum value: SPAN_KIND_INTERNAL = 1; + */ + INTERNAL = 1, + + /** + * Indicates that the span covers server-side handling of an RPC or other + * remote network request. + * + * @generated from enum value: SPAN_KIND_SERVER = 2; + */ + SERVER = 2, + + /** + * Indicates that the span describes a request to some remote service. + * + * @generated from enum value: SPAN_KIND_CLIENT = 3; + */ + CLIENT = 3, + + /** + * Indicates that the span describes a producer sending a message to a broker. + * Unlike CLIENT and SERVER, there is often no direct critical path latency relationship + * between producer and consumer spans. A PRODUCER span ends when the message was accepted + * by the broker while the logical processing of the message might span a much longer time. + * + * @generated from enum value: SPAN_KIND_PRODUCER = 4; + */ + PRODUCER = 4, + + /** + * Indicates that the span describes consumer receiving a message from a broker. + * Like the PRODUCER kind, there is often no direct critical path latency relationship + * between producer and consumer spans. + * + * @generated from enum value: SPAN_KIND_CONSUMER = 5; + */ + CONSUMER = 5, +} + +/** + * Describes the enum opentelemetry.proto.trace.v1.Span.SpanKind. + */ +export const Span_SpanKindSchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_trace_v1_trace, 3, 0); + +/** + * The Status type defines a logical error model that is suitable for different + * programming environments, including REST APIs and RPC APIs. + * + * @generated from message opentelemetry.proto.trace.v1.Status + */ +export type Status = Message<"opentelemetry.proto.trace.v1.Status"> & { + /** + * A developer-facing human readable error message. + * + * @generated from field: string message = 2; + */ + message: string; + + /** + * The status code. + * + * @generated from field: opentelemetry.proto.trace.v1.Status.StatusCode code = 3; + */ + code: Status_StatusCode; +}; + +/** + * Describes the message opentelemetry.proto.trace.v1.Status. + * Use `create(StatusSchema)` to create a new message. + */ +export const StatusSchema: GenMessage = + /*@__PURE__*/ + messageDesc(file_opentelemetry_proto_trace_v1_trace, 4); + +/** + * For the semantics of status codes see + * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status + * + * @generated from enum opentelemetry.proto.trace.v1.Status.StatusCode + */ +export enum Status_StatusCode { + /** + * The default status. + * + * @generated from enum value: STATUS_CODE_UNSET = 0; + */ + UNSET = 0, + + /** + * The Span has been validated by an Application developer or Operator to + * have completed successfully. + * + * @generated from enum value: STATUS_CODE_OK = 1; + */ + OK = 1, + + /** + * The Span contains an error. + * + * @generated from enum value: STATUS_CODE_ERROR = 2; + */ + ERROR = 2, +} + +/** + * Describes the enum opentelemetry.proto.trace.v1.Status.StatusCode. + */ +export const Status_StatusCodeSchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_trace_v1_trace, 4, 0); + +/** + * SpanFlags represents constants used to interpret the + * Span.flags field, which is protobuf 'fixed32' type and is to + * be used as bit-fields. Each non-zero value defined in this enum is + * a bit-mask. To extract the bit-field, for example, use an + * expression like: + * + * (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK) + * + * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + * + * Note that Span flags were introduced in version 1.1 of the + * OpenTelemetry protocol. Older Span producers do not set this + * field, consequently consumers should not rely on the absence of a + * particular flag bit to indicate the presence of a particular feature. + * + * @generated from enum opentelemetry.proto.trace.v1.SpanFlags + */ +export enum SpanFlags { + /** + * The zero value for the enum. Should not be used for comparisons. + * Instead use bitwise "and" with the appropriate mask as shown above. + * + * @generated from enum value: SPAN_FLAGS_DO_NOT_USE = 0; + */ + DO_NOT_USE = 0, + + /** + * Bits 0-7 are used for trace flags. + * + * @generated from enum value: SPAN_FLAGS_TRACE_FLAGS_MASK = 255; + */ + TRACE_FLAGS_MASK = 255, + + /** + * Bits 8 and 9 are used to indicate that the parent span or link span is remote. + * Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known. + * Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote. + * + * @generated from enum value: SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256; + */ + CONTEXT_HAS_IS_REMOTE_MASK = 256, + + /** + * @generated from enum value: SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512; + */ + CONTEXT_IS_REMOTE_MASK = 512, +} + +/** + * Describes the enum opentelemetry.proto.trace.v1.SpanFlags. + */ +export const SpanFlagsSchema: GenEnum = + /*@__PURE__*/ + enumDesc(file_opentelemetry_proto_trace_v1_trace, 0); diff --git a/packages/api/src/routes/otlp/otlp.server.ts b/packages/api/src/routes/otlp/otlp.server.ts new file mode 100644 index 0000000..5e1329d --- /dev/null +++ b/packages/api/src/routes/otlp/otlp.server.ts @@ -0,0 +1,27 @@ +import { create } from "@bufbuild/protobuf"; +import type { APIServer } from "../../server"; +import { withAgentInvocationAuth } from "../agents/me/me.server"; +import { + mapExportTraceServiceRequestToOtelSpans, + parseOtlpHttpTraces, +} from "./convert"; +import { ExportTraceServiceResponseSchema } from "./gen/opentelemetry/proto/collector/trace/v1/trace_service_pb"; + +export default function mountOtlp(server: APIServer) { + // /api/otlp/v1/traces + server.post("/v1/traces", withAgentInvocationAuth, async (c) => { + const parsedTraces = await parseOtlpHttpTraces(c.req.raw); + const spans = mapExportTraceServiceRequestToOtelSpans(parsedTraces, { + agent_id: c.get("agent_id"), + deployment_id: c.get("agent_deployment_id"), + deployment_target_id: c.get("agent_deployment_target_id"), + run_id: c.get("run_id"), + step_id: c.get("step_id"), + chat_id: c.get("chat_id"), + }); + + await c.env.traces.write(spans); + + return c.json(create(ExportTraceServiceResponseSchema, {}), 200); + }); +} diff --git a/packages/api/src/routes/otlp/otlp.test.ts b/packages/api/src/routes/otlp/otlp.test.ts new file mode 100644 index 0000000..c3f67d0 --- /dev/null +++ b/packages/api/src/routes/otlp/otlp.test.ts @@ -0,0 +1,343 @@ +import { create } from "@bufbuild/protobuf"; +import { describe, expect, mock, test } from "bun:test"; +import { Hono } from "hono"; + +import { toBinary } from "@bufbuild/protobuf"; +import type { Bindings } from "../../server"; +import { generateAgentInvocationToken } from "../agents/me/me.server"; +import type { OtelSpan } from "./convert"; +import { ExportTraceServiceRequestSchema } from "./gen/opentelemetry/proto/collector/trace/v1/trace_service_pb"; +import { + AnyValueSchema, + InstrumentationScopeSchema, + KeyValueSchema, +} from "./gen/opentelemetry/proto/common/v1/common_pb"; +import { ResourceSchema } from "./gen/opentelemetry/proto/resource/v1/resource_pb"; +import { + ResourceSpansSchema, + ScopeSpansSchema, + SpanSchema, + Span_SpanKind, +} from "./gen/opentelemetry/proto/trace/v1/trace_pb"; +import mountOtlp from "./otlp.server"; + +// Helper function to create mock Uint8Array IDs +function createMockId(hexString: string): Uint8Array { + const bytes = + hexString.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) ?? []; + return new Uint8Array(bytes); +} + +// Helper function to create mock KeyValue attributes +function createMockAttribute(key: string, value: string) { + return create(KeyValueSchema, { + key, + value: create(AnyValueSchema, { + value: { + case: "stringValue", + value, + }, + }), + }); +} + +// Helper function to create a mock trace request +function createMockTraceRequest() { + const mockSpan = create(SpanSchema, { + traceId: createMockId("a1b2c3d4e5f67890fedcba0987654321"), + spanId: createMockId("1234567890abcdef"), + parentSpanId: createMockId("fedcba0987654321"), + name: "test-span", + kind: Span_SpanKind.INTERNAL, + startTimeUnixNano: BigInt("1640995200000000000"), + endTimeUnixNano: BigInt("1640995201000000000"), + attributes: [createMockAttribute("service.name", "test-service")], + }); + + const mockScopeSpans = create(ScopeSpansSchema, { + scope: create(InstrumentationScopeSchema, { + name: "test-instrumentation", + version: "1.0.0", + }), + spans: [mockSpan], + }); + + const mockResourceSpans = create(ResourceSpansSchema, { + resource: create(ResourceSchema, { + attributes: [createMockAttribute("service.name", "test-app")], + }), + scopeSpans: [mockScopeSpans], + }); + + return create(ExportTraceServiceRequestSchema, { + resourceSpans: [mockResourceSpans], + }); +} + +// Helper function to create mock bindings +function createMockBindings(): Bindings { + const mockTracesWrite = mock(() => Promise.resolve()); + + return { + AUTH_SECRET: "test-secret", + traces: { + write: mockTracesWrite, + }, + database: mock(() => Promise.resolve({} as any)), + logs: { + write: mock(() => Promise.resolve()), + }, + } as any; +} + +describe("OTLP Server", () => { + describe("POST /v1/traces", () => { + test("should authenticate and process traces with all IDs from token", async () => { + // Setup + const app = new Hono<{ Bindings: Bindings }>(); + const bindings = createMockBindings(); + mountOtlp(app); + + const tokenPayload = { + agent_id: "test-agent-123", + agent_deployment_id: "test-deployment-456", + agent_deployment_target_id: "test-target-789", + run_id: "test-run-abc", + step_id: "test-step-def", + }; + + const token = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + tokenPayload + ); + + // Create request with authorization header + const request = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/x-protobuf", + }, + body: toBinary( + ExportTraceServiceRequestSchema, + createMockTraceRequest() + ), + }); + + // Execute + const response = await app.fetch(request, bindings); + + // Verify response + expect(response.status).toBe(200); + const responseJson = await response.json(); + expect(responseJson).toHaveProperty( + "$typeName", + "opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse" + ); + + // Verify traces.write was called with correct parameters + expect(bindings.traces.write).toHaveBeenCalledTimes(1); + const [spans] = (bindings.traces.write as any).mock.calls[0] as [ + OtelSpan[], + ]; + + expect(spans).toHaveLength(1); + expect(spans[0].agent_id).toBe("test-agent-123"); + expect(spans[0].payload.resource.attributes.blink).toEqual({ + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-789", + run_id: "test-run-abc", + step_id: "test-step-def", + }); + }); + + test("should work with optional run_id and step_id missing", async () => { + // Setup + const app = new Hono<{ Bindings: Bindings }>(); + const bindings = createMockBindings(); + mountOtlp(app); + + const tokenPayload = { + agent_id: "test-agent-123", + agent_deployment_id: "test-deployment-456", + agent_deployment_target_id: "test-target-789", + // run_id and step_id omitted + }; + + const token = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + tokenPayload + ); + + const request = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/x-protobuf", + }, + body: toBinary( + ExportTraceServiceRequestSchema, + createMockTraceRequest() + ), + }); + + // Execute + const response = await app.fetch(request, bindings); + + // Verify response + expect(response.status).toBe(200); + + // Verify traces.write was called with correct parameters + expect(bindings.traces.write).toHaveBeenCalledTimes(1); + const [spans] = (bindings.traces.write as any).mock.calls[0] as [ + OtelSpan[], + ]; + + expect(spans).toHaveLength(1); + expect(spans[0].payload.resource.attributes.blink).toEqual({ + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-789", + // run_id and step_id should not be present + }); + expect(spans[0].payload.resource.attributes.blink).not.toHaveProperty( + "run_id" + ); + expect(spans[0].payload.resource.attributes.blink).not.toHaveProperty( + "step_id" + ); + }); + + test("should work with only run_id present", async () => { + // Setup + const app = new Hono<{ Bindings: Bindings }>(); + const bindings = createMockBindings(); + mountOtlp(app); + + const tokenPayload = { + agent_id: "test-agent-123", + agent_deployment_id: "test-deployment-456", + agent_deployment_target_id: "test-target-789", + run_id: "test-run-abc", + // step_id omitted + }; + + const token = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + tokenPayload + ); + + const request = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/x-protobuf", + }, + body: toBinary( + ExportTraceServiceRequestSchema, + createMockTraceRequest() + ), + }); + + // Execute + const response = await app.fetch(request, bindings); + + // Verify response + expect(response.status).toBe(200); + + // Verify traces.write was called with correct parameters + const [spans] = (bindings.traces.write as any).mock.calls[0] as [ + OtelSpan[], + ]; + + expect(spans[0].payload.resource.attributes.blink).toEqual({ + agent_id: "test-agent-123", + deployment_id: "test-deployment-456", + deployment_target_id: "test-target-789", + run_id: "test-run-abc", + }); + expect(spans[0].payload.resource.attributes.blink).not.toHaveProperty( + "step_id" + ); + }); + + test("should return 401 when no authorization header", async () => { + // Setup + const app = new Hono<{ Bindings: Bindings }>(); + const bindings = createMockBindings(); + mountOtlp(app); + + const request = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { + "Content-Type": "application/x-protobuf", + }, + body: new Uint8Array(), + }); + + // Execute + const response = await app.fetch(request, bindings); + + // Verify + expect(response.status).toBe(401); + expect(bindings.traces.write).not.toHaveBeenCalled(); + }); + + test("should return 401 when token is invalid", async () => { + // Setup + const app = new Hono<{ Bindings: Bindings }>(); + const bindings = createMockBindings(); + mountOtlp(app); + + const request = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { + Authorization: "Bearer invalid-token", + "Content-Type": "application/x-protobuf", + }, + body: new Uint8Array(), + }); + + // Execute + const response = await app.fetch(request, bindings); + + // Verify + expect(response.status).toBe(401); + expect(bindings.traces.write).not.toHaveBeenCalled(); + }); + + test("should return 401 when token is missing required fields", async () => { + // Setup + const app = new Hono<{ Bindings: Bindings }>(); + const bindings = createMockBindings(); + mountOtlp(app); + + const tokenPayload = { + agent_id: "test-agent-123", + // Missing agent_deployment_id and agent_deployment_target_id + }; + + const token = await generateAgentInvocationToken( + bindings.AUTH_SECRET, + tokenPayload as any + ); + + const request = new Request("http://localhost/v1/traces", { + method: "POST", + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/x-protobuf", + }, + body: new Uint8Array(), + }); + + // Execute + const response = await app.fetch(request, bindings); + + // Verify + expect(response.status).toBe(401); + expect(bindings.traces.write).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/packages/api/src/routes/tools/compute.client.ts b/packages/api/src/routes/tools/compute.client.ts new file mode 100644 index 0000000..476b793 --- /dev/null +++ b/packages/api/src/routes/tools/compute.client.ts @@ -0,0 +1,47 @@ +import { Client as ComputeClient } from "@blink-sdk/compute-protocol/client"; +import { z } from "zod"; +import { assertResponseStatus } from "../../client-helper"; +import Client from "../../client.browser"; + +const schemaTokenRequest = z.object({}); + +const schemaTokenResponse = z.object({ + id: z.string(), + token: z.string(), +}); + +export type TokenResponse = z.infer; + +export default class Compute { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * Create a compute token. This can be used to serve a compute instance. + * + * @param request - The request body. + * @returns The compute instance. + */ + public async token(): Promise { + const resp = await this.client.request("POST", "/api/tools/compute"); + await assertResponseStatus(resp, 201); + return resp.json(); + } + + /** + * connect to a compute instance. + * + * @param id - The ID of the compute instance. + * @returns A compute client. + */ + public async connect(id: string): Promise { + const ws = this.client.websocket(`/api/tools/compute/connect?id=${id}`); + const client = new ComputeClient({ + send: (message) => ws.send(message), + }); + return client; + } +} diff --git a/packages/api/src/routes/tools/compute.server.ts b/packages/api/src/routes/tools/compute.server.ts new file mode 100644 index 0000000..ec9b93b --- /dev/null +++ b/packages/api/src/routes/tools/compute.server.ts @@ -0,0 +1,66 @@ +import { getCookie } from "hono/cookie"; +import { decode, encode } from "next-auth/jwt"; +import { validate } from "uuid"; +import type { APIServer } from "../../server"; +import { SESSION_COOKIE_NAME } from "../auth/auth.client"; +import type { TokenResponse } from "./compute.client"; + +export default function mountCompute(app: APIServer) { + // Generate a remote compute token. + app.post("/", async (c) => { + const id = crypto.randomUUID(); + const token = await generateComputeToken(c.env.AUTH_SECRET, id); + const tokenResponse: TokenResponse = { + id, + token, + }; + return c.json(tokenResponse, 201); + }); + + // Connect to a compute instance. + // TODO: There is no authentication here at the moment. + // There obviously needs to be. + app.get("/connect", async (c) => { + const id = c.req.query("id"); + if (!id || !validate(id)) { + return c.json({ error: "Invalid ID" }, 400); + } + if (!c.env.compute?.handleConnect) { + return c.json({ error: "Not implemented" }, 501); + } + return c.env.compute.handleConnect(id, c.req.raw); + }); + + // Serve a compute instance. + app.get("/serve", async (c) => { + const cookieValue = getCookie(c, SESSION_COOKIE_NAME); + + if (!cookieValue) { + return c.json({ error: "Unauthorized" }, 401); + } + + const token = await decode({ + token: cookieValue, + secret: c.env.AUTH_SECRET, + salt: SESSION_COOKIE_NAME, + }); + if (!token || !token.sub) { + return c.json({ error: "Unauthorized" }, 401); + } + if (!c.env.compute?.handleServe) { + return c.json({ error: "Not implemented" }, 501); + } + return c.env.compute.handleServe(token.sub as string, c.req.raw); + }); +} + +const generateComputeToken = (authSecret: string, id: string) => { + return encode({ + // TODO: Change this to "compute-token" once we update the CLI. + salt: "workspace", + secret: authSecret, + token: { + sub: id, + }, + }); +}; diff --git a/packages/api/src/routes/tools/exa.server.ts b/packages/api/src/routes/tools/exa.server.ts new file mode 100644 index 0000000..49dd8a2 --- /dev/null +++ b/packages/api/src/routes/tools/exa.server.ts @@ -0,0 +1,62 @@ +import { HTTPException } from "hono/http-exception"; +import type { APIServer } from "../../server"; +import { withToolsAuth } from "./tools.server"; + +/** + * This exports the Exa API under a nested path - just proxying the original request. + * TODO: We should associate cost with the request. + */ +export default function mountExa(app: APIServer) { + app.all( + "/:path{.+}", + withToolsAuth({ + findToken: (req) => { + return req.headers.get("x-api-key"); + }, + }), + async (c) => { + if (!c.env.TOOLS_EXA_API_KEY) { + throw new HTTPException(500, { + message: "The Exa API provider is not configured!", + }); + } + + // Preserve original headers, just in case Exa adds some + // experimental headers for features or something. + const headers = new Headers(c.req.raw.headers); + headers.set("x-api-key", c.env.TOOLS_EXA_API_KEY); + + const reqURL = new URL(c.req.raw.url); + let url: URL; + try { + url = new URL(c.req.param("path"), "https://api.exa.ai"); + url.search = reqURL.search; + } catch (err) { + throw new HTTPException(500, { + message: `Could not construct Exa API URL: ${err}`, + }); + } + + // We just route this to the official Exa API directly. + // We do no parsing of the inbound request intentionally, + // as users can process the raw Exa response with an Exa client. + const resp = await fetch(url, { + method: c.req.method, + headers, + body: c.req.raw.body, + }); + // TODO: This payload returns "costDollars": + // costDollars: { + // total: 0.01, + // search: { + // neural: 0.005, + // }, + // contents: { + // text: 0.005, + // }, + // }, + // We can use this to track costs back to the user or agent. + return resp; + } + ); +} diff --git a/packages/api/src/routes/tools/exa.test.ts b/packages/api/src/routes/tools/exa.test.ts new file mode 100644 index 0000000..8a3baf6 --- /dev/null +++ b/packages/api/src/routes/tools/exa.test.ts @@ -0,0 +1,164 @@ +import { afterEach, beforeEach, expect, test } from "bun:test"; +import { http } from "msw"; +import { setupServer, SetupServerApi } from "msw/node"; +import Client from "../../client.browser"; +import { serve } from "../../test"; +import { generateAgentInvocationToken } from "../agents/me/me.server"; + +let requestURL: string | undefined; +let server: SetupServerApi; +beforeEach(() => { + server = setupServer(); + server.use( + http.post("https://api.exa.ai/search", ({ request }) => { + requestURL = request.url; + return new Response( + JSON.stringify({ + results: [ + { + title: "Test", + }, + ], + }) + ); + }) + ); + server.listen({ + onUnhandledRequest: "bypass", + }); +}); +afterEach(() => { + server.close(); +}); + +test("unauthenticated", async () => { + const { url } = await serve({ + bindings: { + TOOLS_EXA_API_KEY: "test", + }, + }); + + let requestURL: string | undefined; + const server = setupServer(); + server.use( + http.post("https://api.exa.ai/search", ({ request }) => { + requestURL = request.url; + return new Response( + JSON.stringify({ + results: [ + { + title: "Test", + }, + ], + }) + ); + }) + ); + server.listen({ + onUnhandledRequest: "bypass", + }); + + const client = new Client({ + baseURL: url.toString(), + }); + const resp = await client.request( + "POST", + "/api/tools/exa/search?some-query", + JSON.stringify({ + query: "test", + }) + ); + expect(resp.status).toBe(401); +}); + +test("authenticated", async () => { + const { helpers } = await serve({ + bindings: { + TOOLS_EXA_API_KEY: "test", + }, + }); + + let requestURL: string | undefined; + const server = setupServer(); + server.use( + http.post("https://api.exa.ai/search", ({ request }) => { + requestURL = request.url; + return new Response( + JSON.stringify({ + results: [ + { + title: "Test", + }, + ], + }) + ); + }) + ); + server.listen({ + onUnhandledRequest: "bypass", + }); + + const { client } = await helpers.createUser(); + const resp = await client.request( + "POST", + "/api/tools/exa/search?some-query", + JSON.stringify({ + query: "test", + }) + ); + expect(resp.status).toBe(200); + expect(requestURL).toBe("https://api.exa.ai/search?some-query"); +}); + +test("authenticated with x-api-key", async () => { + const { helpers, bindings } = await serve({ + bindings: { + TOOLS_EXA_API_KEY: "test", + }, + }); + + const { client, user } = await helpers.createUser(); + + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + organization_id: user.organization_id, + }); + + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + + const target = await ( + await bindings.database() + ).selectAgentDeploymentTargetByName(agent.id, "production"); + if (!target) { + throw new Error("Target not found"); + } + const token = await generateAgentInvocationToken(bindings.AUTH_SECRET, { + agent_id: agent.id, + agent_deployment_id: deployment.id, + agent_deployment_target_id: target.id, + }); + const resp = await client.request( + "POST", + "/api/tools/exa/search?some-query", + JSON.stringify({ + query: "test", + }), + { + headers: { + "x-api-key": token, + }, + } + ); + expect(resp.status).toBe(200); + expect(requestURL).toBe("https://api.exa.ai/search?some-query"); +}); diff --git a/packages/api/src/routes/tools/tools.client.node.ts b/packages/api/src/routes/tools/tools.client.node.ts new file mode 100644 index 0000000..fb2a112 --- /dev/null +++ b/packages/api/src/routes/tools/tools.client.node.ts @@ -0,0 +1,12 @@ +import Client from "../../client.node"; +import Compute from "./compute.client"; + +export default class Tools { + private readonly client: Client; + public readonly compute: Compute; + + public constructor(client: Client) { + this.client = client; + this.compute = new Compute(this.client); + } +} diff --git a/packages/api/src/routes/tools/tools.server.ts b/packages/api/src/routes/tools/tools.server.ts new file mode 100644 index 0000000..428fd3c --- /dev/null +++ b/packages/api/src/routes/tools/tools.server.ts @@ -0,0 +1,23 @@ +import { createAuthMiddleware } from "../../middleware"; +import type { APIServer } from "../../server"; +import mountCompute from "./compute.server"; +import mountExa from "./exa.server"; + +export default function mountTools(server: APIServer) { + mountCompute(server.basePath("/compute")); + mountExa(server.basePath("/exa")); +} + +/** + * Authentication middleware for tools endpoints. + * Supports API keys, agent invocation tokens, and session authentication. + */ +export const withToolsAuth = ( + options: { + findToken?: (req: Request) => string | undefined | null; + } = {} +) => + createAuthMiddleware({ + findAgentToken: options.findToken, + allowAgentAuth: true, + }); diff --git a/packages/api/src/routes/users.client.ts b/packages/api/src/routes/users.client.ts new file mode 100644 index 0000000..78f2024 --- /dev/null +++ b/packages/api/src/routes/users.client.ts @@ -0,0 +1,197 @@ +import z from "zod"; +import { + assertResponseStatus, + nameFormat, + schemaPaginatedRequest, +} from "../client-helper"; +import Client from "../client.browser"; + +export const schemaUser = z.object({ + id: z.uuid(), + created_at: z.date(), + updated_at: z.date(), + email: z.string().email(), + email_verified: z.boolean(), + display_name: z.string(), + username: z.string(), + organization_id: z.uuid(), + avatar_url: z.string().url().nullable(), +}); + +export type User = z.infer; + +export const schemaUpdateUserRequest = z.object({ + display_name: z.string().max(100).optional(), + username: z.string().regex(nameFormat).optional(), + avatar_file_id: z.string().nullable().optional(), +}); + +export type UpdateUserRequest = z.infer; + +export const schemaUserAccount = z.object({ + provider: z.enum(["github", "google"]), + provider_account_id: z.string(), +}); + +export type UserAccount = z.infer; + +export const schemaUserAccounts = z.object({ + github: z.array(schemaUserAccount), + google: z.array(schemaUserAccount), +}); + +export type UserAccounts = z.infer; + +export const schemaApiKey = z.object({ + id: z.uuid(), + user_id: z.uuid(), + name: z.string().nullable(), + key_lookup: z.string(), + key_prefix: z.string(), + key_suffix: z.string(), + scope: z.enum(["full"]), + expires_at: z.coerce.date().nullable(), + last_used_at: z.coerce.date().nullable(), + created_at: z.coerce.date(), + updated_at: z.coerce.date(), + revoked_at: z.coerce.date().nullable(), + revoked_by: z.uuid().nullable(), +}); + +export type ApiKey = z.infer; + +export const schemaListApiKeysRequest = schemaPaginatedRequest; +export type ListApiKeysRequest = z.infer; + +export const schemaListApiKeysResponse = z.object({ + items: z.array(schemaApiKey), +}); +export type ListApiKeysResponse = z.infer; + +export const schemaCreateApiKeyRequest = z.object({ + name: z.string().optional(), + scope: z.enum(["full"]).optional(), + expires_at: z.coerce.date().optional(), +}); + +export const schemaCreateApiKeyResponse = schemaApiKey.extend({ + key: z.string(), +}); +export type CreateApiKeyResponse = z.infer; + +export type CreateApiKeyRequest = z.infer; + +export const schemaRevokeApiKeyRequest = z.object({ + key_id: z.uuid(), +}); + +export type RevokeApiKeyRequest = z.infer; + +export default class Users { + private readonly client: Client; + + public constructor(client: Client) { + this.client = client; + } + + /** + * Get the current user. + * + * @returns The current user. + */ + public async me(): Promise { + return this.get("me"); + } + + /** + * Get a user by ID. + * + * @param id - The ID of the user. + * @returns The user. + */ + public async get(id: string): Promise { + const res = await this.client.request("GET", `/api/users/${id}`); + await assertResponseStatus(res, 200); + return res.json(); + } + + /** + * Update the current user. + * + * @param request - The update request. + * @returns The updated user. + */ + public async update(request: UpdateUserRequest): Promise { + const res = await this.client.request( + "PATCH", + "/api/users/me", + JSON.stringify(request) + ); + await assertResponseStatus(res, 200); + return res.json(); + } + + /** + * Get user accounts (OAuth providers) for the current user. + * + * @returns The user accounts. + */ + public async accounts(): Promise { + const res = await this.client.request("GET", "/api/users/me/accounts"); + await assertResponseStatus(res, 200); + return res.json(); + } + + /** + * Unlink an OAuth provider for the current user. + * + * @param provider - The provider to unlink. + * @param providerAccountId - The provider account ID. + */ + public async unlinkProvider( + provider: "github" | "google", + providerAccountId: string + ): Promise { + const res = await this.client.request( + "DELETE", + `/api/users/me/accounts/${provider}/${providerAccountId}` + ); + await assertResponseStatus(res, 204); + } + + /** + * Delete the current user account. + */ + public async delete(): Promise { + const res = await this.client.request("DELETE", "/api/users/me"); + await assertResponseStatus(res, 204); + } + + public async listApiKeys( + request: ListApiKeysRequest = {} + ): Promise { + const response = await this.client.request("GET", "/api/users/me/api-keys"); + await assertResponseStatus(response, 200); + return response.json(); + } + + public async createApiKey( + request: CreateApiKeyRequest = {} + ): Promise { + const response = await this.client.request( + "POST", + "/api/users/me/api-keys", + JSON.stringify(request) + ); + await assertResponseStatus(response, 200); + return response.json(); + } + + public async revokeApiKey(request: RevokeApiKeyRequest): Promise { + const response = await this.client.request( + "DELETE", + `/api/users/me/api-keys/${request.key_id}` + ); + await assertResponseStatus(response, 204); + } +} diff --git a/packages/api/src/routes/users.server.ts b/packages/api/src/routes/users.server.ts new file mode 100644 index 0000000..ea8d205 --- /dev/null +++ b/packages/api/src/routes/users.server.ts @@ -0,0 +1,282 @@ +import * as convert from "@blink.so/database/convert"; +import { validator } from "hono/validator"; +import { validate } from "uuid"; +import { withAuth } from "../middleware"; +import type { APIServer } from "../server"; +import { isUniqueConstraintError } from "../server-helper"; +import { newApiKeyString } from "./api-keys.server"; +import { + schemaCreateApiKeyRequest, + schemaUpdateUserRequest, + type CreateApiKeyResponse, + type ListApiKeysResponse, +} from "./users.client"; + +export default function mountUsers(server: APIServer) { + // Get the current user. + server.get("/me", withAuth, async (c) => { + const db = await c.env.database(); + const user = await db.selectUserByID(c.get("user_id")); + if (!user) { + return c.json({ message: "User not found" }, 404); + } + return c.json(convert.user(user)); + }); + + // Update the current user. + server.patch( + "/me", + withAuth, + validator("json", (value, c) => { + return schemaUpdateUserRequest.parse(value); + }), + async (c) => { + const db = await c.env.database(); + const userID = c.get("user_id"); + const { display_name, username, avatar_file_id } = c.req.valid("json"); + + const user = await db.selectUserByID(userID); + if (!user) { + return c.json({ message: "User not found" }, 404); + } + + try { + // Update display name if provided + if (display_name !== undefined) { + await db.updateUserByID({ + id: userID, + display_name: display_name || null, + }); + } + + // Update avatar if provided (updates personal organization avatar) + if (avatar_file_id !== undefined) { + const newUrl = + avatar_file_id && avatar_file_id.trim().length > 0 + ? `/api/files/${avatar_file_id.trim()}` + : null; + + await db.updateOrganizationByID(user.organization_id, { + avatar_url: newUrl, + }); + } + + // Update username (personal organization name) if provided + if (username !== undefined) { + await db.updateOrganizationByID(user.organization_id, { + name: username, + }); + } + + // Fetch updated user + const updatedUser = await db.selectUserByID(userID); + if (!updatedUser) { + return c.json({ message: "User not found after update" }, 404); + } + + return c.json(convert.user(updatedUser)); + } catch (error) { + // Check for unique constraint violations on organization name + if ( + isUniqueConstraintError(error, "organization_name_unique") || + isUniqueConstraintError(error, "organization_lower_idx") + ) { + return c.json({ message: "Username is already taken" }, 400); + } + throw error; + } + } + ); + + // Get a user by ID. + server.get("/:id", withAuth, async (c) => { + const db = await c.env.database(); + const userID = c.req.param("id"); + if (!validate(userID)) { + return c.json({ message: "Invalid user ID" }, 400); + } + const user = await db.selectUserByID(userID); + if (!user) { + return c.json({ message: "User not found" }, 404); + } + return c.json(convert.user(user)); + }); + + // Get user accounts (OAuth providers) for current user. + server.get("/me/accounts", withAuth, async (c) => { + const db = await c.env.database(); + const userID = c.get("user_id"); + + const [githubAccounts, googleAccounts] = await Promise.all([ + db.selectUserAccountsByProviderAndUserID("github", userID), + db.selectUserAccountsByProviderAndUserID("google", userID), + ]); + + return c.json({ + github: githubAccounts.map((a) => ({ + provider: "github" as const, + provider_account_id: a.provider_account_id, + })), + google: googleAccounts.map((a) => ({ + provider: "google" as const, + provider_account_id: a.provider_account_id, + })), + }); + }); + + // Unlink OAuth provider for current user. + server.delete("/me/accounts/:provider/:accountId", withAuth, async (c) => { + const db = await c.env.database(); + const userID = c.get("user_id"); + const provider = c.req.param("provider") as "github" | "google"; + const providerAccountId = c.req.param("accountId"); + + if (provider !== "github" && provider !== "google") { + return c.json({ message: "Invalid provider" }, 400); + } + + // Fetch user and all linked accounts to enforce safety + const [user, githubAccounts, googleAccounts] = await Promise.all([ + db.selectUserByID(userID), + db.selectUserAccountsByProviderAndUserID("github", userID), + db.selectUserAccountsByProviderAndUserID("google", userID), + ]); + + if (!user) { + return c.json({ message: "User not found" }, 404); + } + + // Verify the account to unlink belongs to this user + const targetList = provider === "github" ? githubAccounts : googleAccounts; + const target = targetList.find( + (a) => a.provider_account_id === providerAccountId + ); + if (!target) { + return c.json({ message: "Account not found" }, 404); + } + + // Prevent lockout: if user has no password and this is the last linked provider + const totalLinked = githubAccounts.length + googleAccounts.length; + if (!user.password && totalLinked <= 1) { + return c.json( + { + message: + "Set a password or link another provider before unlinking your last login method.", + }, + 400 + ); + } + + await db.deleteUserAccountByProviderAccountID({ + provider, + provider_account_id: providerAccountId, + }); + + return c.body(null, 204); + }); + + // Delete current user account. + server.delete("/me", withAuth, async (c) => { + const db = await c.env.database(); + const userID = c.get("user_id"); + + await db.deleteUserByID(userID); + + return c.body(null, 204); + }); + + server.get("/me/api-keys", withAuth, async (c) => { + const userID = c.get("user_id"); + const db = await c.env.database(); + const apiKeys = await db.selectApiKeysByUserId(userID); + return c.json({ + items: apiKeys.map((k) => ({ + id: k.id, + user_id: k.user_id, + name: k.name, + key_lookup: k.key_lookup, + key_prefix: k.key_prefix, + key_suffix: k.key_suffix, + scope: k.scope, + expires_at: k.expires_at, + last_used_at: k.last_used_at, + created_at: k.created_at, + updated_at: k.updated_at, + revoked_at: k.revoked_at, + revoked_by: k.revoked_by, + })), + } satisfies ListApiKeysResponse); + }); + + server.post( + "/me/api-keys", + withAuth, + validator("json", (value, c) => { + return schemaCreateApiKeyRequest.parse(value); + }), + async (c) => { + const userID = c.get("user_id"); + const { name, expires_at } = c.req.valid("json"); + const db = await c.env.database(); + + const { lookup, prefix, fullKey, hash } = await newApiKeyString( + c.env.AUTH_SECRET + ); + + const apiKey = await db.insertApiKey({ + user_id: userID, + name: name || "New API Key", + key_hash: hash, + key_lookup: lookup, + key_prefix: prefix, + key_suffix: fullKey.slice(-4), + scope: "full", + expires_at: + expires_at || new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), + }); + + return c.json({ + id: apiKey.id, + user_id: apiKey.user_id, + name: apiKey.name, + key_lookup: apiKey.key_lookup, + key_prefix: apiKey.key_prefix, + key_suffix: apiKey.key_suffix, + scope: apiKey.scope, + expires_at: apiKey.expires_at, + last_used_at: apiKey.last_used_at, + created_at: apiKey.created_at, + updated_at: apiKey.updated_at, + revoked_at: apiKey.revoked_at, + revoked_by: apiKey.revoked_by, + key: fullKey, + } satisfies CreateApiKeyResponse); + } + ); + + server.delete("/me/api-keys/:key_id", withAuth, async (c) => { + const keyId = c.req.param("key_id"); + const { z } = await import("zod"); + const parsed = await z.uuid().safeParseAsync(keyId); + if (!parsed.success) { + return c.json({ message: "Invalid API Key ID" }, 400); + } + const userID = c.get("user_id"); + const db = await c.env.database(); + const apiKey = await db.selectApiKeyByID(keyId); + if ( + !apiKey || + apiKey.revoked_at || + (apiKey.expires_at && + apiKey.expires_at.getTime() < new Date().getTime()) || + apiKey.user_id !== userID + ) { + return c.json({ message: "API key not found" }, 404); + } + await db.updateApiKey(keyId, { + revoked_at: new Date(), + revoked_by: userID, + }); + return c.body(null, 204); + }); +} diff --git a/packages/api/src/routes/users.test.ts b/packages/api/src/routes/users.test.ts new file mode 100644 index 0000000..b4055c2 --- /dev/null +++ b/packages/api/src/routes/users.test.ts @@ -0,0 +1,719 @@ +import { expect, test } from "bun:test"; +import Client from "../client.node"; +import { serve } from "../test"; + +test("GET /api/users/me returns current user", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + const me = await client.users.me(); + expect(me.id).toBe(user.id); + expect(me.email).toBe(user.email ?? ""); + expect(me.username).toBeDefined(); + expect(me.organization_id).toBeDefined(); +}); + +test("GET /api/users/:id returns user by ID", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + const fetchedUser = await client.users.get(user.id); + expect(fetchedUser.id).toBe(user.id); + expect(fetchedUser.email).toBe(user.email ?? ""); +}); + +test("PATCH /api/users/me updates display name", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const updated = await client.users.update({ + display_name: "New Name", + }); + + expect(updated.display_name).toBe("New Name"); + + // Verify persistence + const me = await client.users.me(); + expect(me.display_name).toBe("New Name"); +}); + +test("PATCH /api/users/me updates username", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + const originalUsername = user.username; + const newUsername = "new-username-123"; + + const updated = await client.users.update({ + username: newUsername, + }); + + expect(updated.username).toBe(newUsername); + expect(updated.username).not.toBe(originalUsername); + + // Verify persistence + const me = await client.users.me(); + expect(me.username).toBe(newUsername); +}); + +test("PATCH /api/users/me updates both display name and username", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const updated = await client.users.update({ + display_name: "Full Name", + username: "full-name", + }); + + expect(updated.display_name).toBe("Full Name"); + expect(updated.username).toBe("full-name"); +}); + +test("PATCH /api/users/me rejects duplicate username", async () => { + const { helpers } = await serve(); + const { client: client1, user: user1 } = await helpers.createUser(); + const { client: client2 } = await helpers.createUser(); + + // Try to use user1's username + await expect( + client2.users.update({ + username: user1.username, + }) + ).rejects.toThrow("Username is already taken"); +}); + +test("PATCH /api/users/me validates username format", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Test invalid formats - these should be caught by Zod validation + const invalidUsernames = [ + "UPPERCASE", // must be lowercase + "-starts-with-dash", + "ends-with-dash-", + "has--double-dash", + "has space", + "has_underscore", + "a".repeat(40), // too long (max 39) + ]; + + for (const username of invalidUsernames) { + try { + await client.users.update({ username }); + throw new Error(`Expected ${username} to fail validation`); + } catch (error) { + // Should throw validation error + expect(error).toBeDefined(); + } + } +}); + +test("PATCH /api/users/me allows valid username formats", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const validUsernames = [ + "abc", + "test-user", + "test123", + "123test", + "a", + "test-user-123", + ]; + + for (const username of validUsernames) { + const updated = await client.users.update({ username }); + expect(updated.username).toBe(username); + } +}); + +test("PATCH /api/users/me allows empty display name", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Set a name first + await client.users.update({ display_name: "Test Name" }); + const me = await client.users.me(); + expect(me.display_name).toBe("Test Name"); + + // Clear it - empty string or null clears the name + const updated = await client.users.update({ display_name: "" }); + // Empty string gets converted to empty string in display, but may be null internally + expect(updated.display_name === "" || updated.display_name === null).toBe( + true + ); +}); + +test("PATCH /api/users/me validates display name length", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Max 100 characters + const validName = "a".repeat(100); + const updated = await client.users.update({ display_name: validName }); + expect(updated.display_name).toBe(validName); + + // Over 100 should fail + const tooLongName = "a".repeat(101); + await expect( + client.users.update({ display_name: tooLongName }) + ).rejects.toThrow(); +}); + +test("PATCH /api/users/me requires authentication", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create unauthenticated client by using the base URL without auth token + const unauthClient = new Client({ + baseURL: client["baseURL"]?.toString(), + // No authToken provided + }); + + try { + await unauthClient.users.update({ display_name: "test" }); + throw new Error("Expected authentication error"); + } catch (error) { + // Should throw authentication error (401 or similar) + expect(error).toBeDefined(); + // Verify it's an auth error, not just any error + const errorMessage = String(error); + expect( + errorMessage.includes("401") || errorMessage.includes("Unauthorized") + ).toBe(true); + } +}); + +test("PATCH /api/users/me updates avatar with file_id", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const updated = await client.users.update({ + avatar_file_id: "test-file-id", + }); + + expect(updated.avatar_url).toBe("/api/files/test-file-id"); + + // Verify persistence + const me = await client.users.me(); + expect(me.avatar_url).toBe("/api/files/test-file-id"); +}); + +test("PATCH /api/users/me removes avatar with null file_id", async () => { + const { helpers, bindings } = await serve(); + const { client, user } = await helpers.createUser(); + const db = await bindings.database(); + + // Set an avatar first (now stored in organization) + await db.updateOrganizationByID(user.organization_id, { + avatar_url: "/api/files/test-file-id", + }); + + // Remove it + const updated = await client.users.update({ avatar_file_id: null }); + + expect(updated.avatar_url).toBeNull(); +}); + +test("PATCH /api/users/me trims avatar file_id", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const updated = await client.users.update({ + avatar_file_id: " test-file-id ", + }); + + expect(updated.avatar_url).toBe("/api/files/test-file-id"); +}); + +test("GET /api/users/me/accounts returns user accounts", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const accounts = await client.users.accounts(); + + expect(accounts).toBeDefined(); + expect(Array.isArray(accounts.github)).toBe(true); + expect(Array.isArray(accounts.google)).toBe(true); + expect(accounts.github.length).toBe(0); + expect(accounts.google.length).toBe(0); +}); + +test("GET /api/users/me/accounts returns linked accounts", async () => { + const { helpers, bindings } = await serve(); + const { client, user } = await helpers.createUser(); + const db = await bindings.database(); + + // Add accounts + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: "github", + provider_account_id: "github-123", + access_token: null, + refresh_token: null, + expires_at: null, + token_type: null, + scope: null, + id_token: null, + session_state: null, + }); + + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: "google", + provider_account_id: "google-456", + access_token: null, + refresh_token: null, + expires_at: null, + token_type: null, + scope: null, + id_token: null, + session_state: null, + }); + + const accounts = await client.users.accounts(); + + expect(accounts.github.length).toBe(1); + expect(accounts.github[0].provider).toBe("github"); + expect(accounts.github[0].provider_account_id).toBe("github-123"); + + expect(accounts.google.length).toBe(1); + expect(accounts.google[0].provider).toBe("google"); + expect(accounts.google[0].provider_account_id).toBe("google-456"); +}); + +test("DELETE /api/users/me/accounts/:provider/:accountId prevents last account removal without password", async () => { + const { helpers, bindings } = await serve(); + const { client, user } = await helpers.createUser(); + const db = await bindings.database(); + + // Add a GitHub account + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: "github", + provider_account_id: "github-test-123", + access_token: null, + refresh_token: null, + expires_at: null, + token_type: null, + scope: null, + id_token: null, + session_state: null, + }); + + // User has no password, so can't remove last auth method + await expect( + client.users.unlinkProvider("github", "github-test-123") + ).rejects.toThrow(); +}); + +test("DELETE /api/users/me/accounts/:provider/:accountId allows removal with password", async () => { + const { helpers, bindings } = await serve(); + const { client, user } = await helpers.createUser(); + const db = await bindings.database(); + + // Set a password + await db.updateUserByID({ + id: user.id, + password: "hashed-password", + }); + + // Add a GitHub account + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: "github", + provider_account_id: "github-test-123", + access_token: null, + refresh_token: null, + expires_at: null, + token_type: null, + scope: null, + id_token: null, + session_state: null, + }); + + // Should succeed + await client.users.unlinkProvider("github", "github-test-123"); + + // Verify it's removed + const accounts = await client.users.accounts(); + expect(accounts.github.length).toBe(0); +}); + +test("DELETE /api/users/me/accounts/:provider/:accountId allows removal with multiple accounts", async () => { + const { helpers, bindings } = await serve(); + const { client, user } = await helpers.createUser(); + const db = await bindings.database(); + + // Add two accounts (no password needed) + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: "github", + provider_account_id: "github-123", + access_token: null, + refresh_token: null, + expires_at: null, + token_type: null, + scope: null, + id_token: null, + session_state: null, + }); + + await db.upsertUserAccount({ + user_id: user.id, + type: "oauth", + provider: "google", + provider_account_id: "google-456", + access_token: null, + refresh_token: null, + expires_at: null, + token_type: null, + scope: null, + id_token: null, + session_state: null, + }); + + // Should succeed - still has another auth method + await client.users.unlinkProvider("github", "github-123"); + + // Verify it's removed + const accounts = await client.users.accounts(); + expect(accounts.github.length).toBe(0); + expect(accounts.google.length).toBe(1); +}); + +test("DELETE /api/users/me/accounts/:provider/:accountId returns 404 for non-existent account", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + await expect( + client.users.unlinkProvider("github", "non-existent") + ).rejects.toThrow(); +}); + +test("DELETE /api/users/me/accounts/:provider/:accountId rejects invalid provider", async () => { + const { helpers, url } = await serve(); + const { client } = await helpers.createUser(); + + // Get the auth token to make direct request + const token = client["authToken"]; + const res = await fetch(`${url}/api/users/me/accounts/invalid/test-123`, { + method: "DELETE", + headers: { + Cookie: `blink_session_token=${token}`, + }, + }); + + expect(res.status).toBe(400); +}); + +test("DELETE /api/users/me deletes user", async () => { + const { helpers, bindings } = await serve(); + const { client, user } = await helpers.createUser(); + + await client.users.delete(); + + // Verify user is deleted + const db = await bindings.database(); + const deletedUser = await db.selectUserByID(user.id); + expect(deletedUser).toBeUndefined(); +}); + +test("DELETE /api/users/me requires authentication", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create unauthenticated client + const unauthClient = new Client({ + baseURL: client["baseURL"]?.toString(), + }); + + await expect(unauthClient.users.delete()).rejects.toThrow(); +}); + +// API Key Tests +test("POST /api/users/me/api-keys creates API key with custom name", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + const result = await client.users.createApiKey({ + name: "My Test Key", + scope: "full", + }); + + expect(result.name).toBe("My Test Key"); + expect(result.user_id).toBe(user.id); + expect(result.scope).toBe("full"); + expect(result.key).toBeDefined(); + expect(result.key).toMatch(/^bk_/); // API keys start with bk_ + expect(result.key_prefix).toBe("bk"); + expect(result.key_suffix).toBeDefined(); + expect(result.revoked_at).toBeNull(); + // assert that the key hash is not included in the response + expect(JSON.stringify(result)).not.toContain("key_hash"); +}); + +test("POST /api/users/me/api-keys creates API key without name defaults to 'New API Key'", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + const result = await client.users.createApiKey({ + scope: "full", + }); + + expect(result.name).toBe("New API Key"); + expect(result.user_id).toBe(user.id); + expect(result.key).toBeDefined(); +}); + +test("POST /api/users/me/api-keys creates API key with empty string name defaults to 'New API Key'", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const result = await client.users.createApiKey({ + name: "", + scope: "full", + }); + + expect(result.name).toBe("New API Key"); +}); + +test("POST /api/users/me/api-keys creates API key with custom expiration", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30); // 30 days + const result = await client.users.createApiKey({ + name: "Expiring Key", + scope: "full", + expires_at: expiresAt, + }); + + expect(result.name).toBe("Expiring Key"); + expect(result.expires_at).toBeDefined(); + // expires_at comes back as a Date object from the coerce schema + const resultDate = new Date(result.expires_at!); + expect(resultDate.getTime()).toBeCloseTo(expiresAt.getTime(), -3); // Within a second +}); + +test("GET /api/users/me/api-keys lists user's API keys", async () => { + const { helpers } = await serve(); + const { client, user } = await helpers.createUser(); + + // Create multiple API keys + await client.users.createApiKey({ name: "Key 1", scope: "full" }); + await client.users.createApiKey({ name: "Key 2", scope: "full" }); + await client.users.createApiKey({ name: "Key 3", scope: "full" }); + + const response = await client.users.listApiKeys(); + + expect(response.items).toBeDefined(); + expect(response.items.length).toBe(3); + + // Verify keys belong to user + for (const key of response.items) { + expect(key.user_id).toBe(user.id); + expect(key.revoked_at).toBeNull(); + } + + // Verify names + const names = response.items.map((k) => k.name).sort(); + expect(names).toEqual(["Key 1", "Key 2", "Key 3"]); +}); + +test("GET /api/users/me/api-keys does not include revoked keys", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create API keys + const key1 = await client.users.createApiKey({ name: "Active Key" }); + const key2 = await client.users.createApiKey({ name: "To Be Revoked" }); + + // Revoke one key + await client.users.revokeApiKey({ key_id: key2.id }); + + // List keys - should only show active key + const response = await client.users.listApiKeys(); + + expect(response.items.length).toBe(1); + expect(response.items[0].name).toBe("Active Key"); + expect(response.items[0].id).toBe(key1.id); +}); + +test("GET /api/users/me/api-keys does not include key hash", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create API keys + const key1 = await client.users.createApiKey({ name: "Active Key" }); + + const response = await client.users.listApiKeys(); + + expect(response.items.length).toBe(1); + expect(response.items[0].name).toBe("Active Key"); + expect(response.items[0].id).toBe(key1.id); + expect(JSON.stringify(response.items[0])).not.toContain("key_hash"); +}); + +test("GET /api/users/me/api-keys cannot see another user's API keys", async () => { + const { helpers } = await serve(); + const { client: client1, user: user1 } = await helpers.createUser(); + const { client: client2, user: user2 } = await helpers.createUser(); + + // User 1 creates API keys + await client1.users.createApiKey({ name: "User 1 Key 1" }); + await client1.users.createApiKey({ name: "User 1 Key 2" }); + + // User 2 creates API keys + await client2.users.createApiKey({ name: "User 2 Key 1" }); + + // User 1 lists their keys - should only see their own + const user1Keys = await client1.users.listApiKeys(); + expect(user1Keys.items.length).toBe(2); + for (const key of user1Keys.items) { + expect(key.user_id).toBe(user1.id); + expect(key.name).toMatch(/^User 1/); + } + + // User 2 lists their keys - should only see their own + const user2Keys = await client2.users.listApiKeys(); + expect(user2Keys.items.length).toBe(1); + expect(user2Keys.items[0].user_id).toBe(user2.id); + expect(user2Keys.items[0].name).toBe("User 2 Key 1"); +}); + +test("DELETE /api/users/me/api-keys/:key_id revokes user's own API key", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const key = await client.users.createApiKey({ name: "Key to Revoke" }); + + // Revoke the key + await client.users.revokeApiKey({ key_id: key.id }); + + // Verify it's no longer in active keys + const response = await client.users.listApiKeys(); + expect(response.items.find((k) => k.id === key.id)).toBeUndefined(); +}); + +test("DELETE /api/users/me/api-keys/:key_id cannot revoke another user's API key", async () => { + const { helpers } = await serve(); + const { client: client1 } = await helpers.createUser(); + const { client: client2 } = await helpers.createUser(); + + // User 1 creates an API key + const user1Key = await client1.users.createApiKey({ name: "User 1 Key" }); + + // User 2 tries to revoke User 1's key - should fail + await expect( + client2.users.revokeApiKey({ key_id: user1Key.id }) + ).rejects.toThrow(); + + // Verify User 1's key is still active + const user1Keys = await client1.users.listApiKeys(); + expect(user1Keys.items.find((k) => k.id === user1Key.id)).toBeDefined(); +}); + +test("DELETE /api/users/me/api-keys/:key_id returns 404 for non-existent key", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const nonExistentId = "00000000-0000-0000-0000-000000000000"; + + await expect( + client.users.revokeApiKey({ key_id: nonExistentId }) + ).rejects.toThrow(); +}); + +test("DELETE /api/users/me/api-keys/:key_id rejects invalid UUID", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + await expect( + client.users.revokeApiKey({ key_id: "not-a-uuid" as any }) + ).rejects.toThrow(); +}); + +test("DELETE /api/users/me/api-keys/:key_id cannot revoke already revoked key", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create and revoke an API key + const key = await client.users.createApiKey({ name: "Key to Double Revoke" }); + await client.users.revokeApiKey({ key_id: key.id }); + + // Try to revoke the same key again - should fail + await expect(client.users.revokeApiKey({ key_id: key.id })).rejects.toThrow( + "API key not found" + ); +}); + +test("DELETE /api/users/me/api-keys/:key_id cannot revoke expired key", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create an API key that's already expired + const expiredDate = new Date(Date.now() - 1000 * 60 * 60); // 1 hour ago + const key = await client.users.createApiKey({ + name: "Expired Key", + scope: "full", + expires_at: expiredDate, + }); + + // Try to revoke the expired key - should fail + await expect(client.users.revokeApiKey({ key_id: key.id })).rejects.toThrow( + "API key not found" + ); +}); + +test("POST /api/users/me/api-keys requires authentication", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create unauthenticated client + const unauthClient = new Client({ + baseURL: client["baseURL"]?.toString(), + }); + + await expect( + unauthClient.users.createApiKey({ name: "Test Key" }) + ).rejects.toThrow(); +}); + +test("GET /api/users/me/api-keys requires authentication", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + // Create unauthenticated client + const unauthClient = new Client({ + baseURL: client["baseURL"]?.toString(), + }); + + await expect(unauthClient.users.listApiKeys()).rejects.toThrow(); +}); + +test("API key contains only partial key information after creation", async () => { + const { helpers } = await serve(); + const { client } = await helpers.createUser(); + + const result = await client.users.createApiKey({ name: "Test Key" }); + + // Full key is returned on creation + expect(result.key).toBeDefined(); + expect(result.key.length).toBeGreaterThan(20); + + // But listing keys doesn't include full key + const response = await client.users.listApiKeys(); + const listedKey = response.items.find((k) => k.id === result.id); + + expect(listedKey).toBeDefined(); + expect(listedKey!.key_prefix).toBe("bk"); + expect(listedKey!.key_suffix).toBeDefined(); + // Full key should not be in the listed response type + expect((listedKey as any).key).toBeUndefined(); +}); diff --git a/packages/api/src/server-helper.ts b/packages/api/src/server-helper.ts new file mode 100644 index 0000000..db85235 --- /dev/null +++ b/packages/api/src/server-helper.ts @@ -0,0 +1,53 @@ +import { DrizzleQueryError } from "drizzle-orm/errors"; +import postgres from "postgres"; + +export const isUniqueConstraintError = ( + err: unknown, + constraint?: string +): boolean => { + if (!(err instanceof DrizzleQueryError)) { + return false; + } + if (!(err.cause instanceof postgres.PostgresError)) { + return false; + } + if (err.cause.code !== "23505") { + return false; + } + if (constraint) { + return err.cause.constraint_name === constraint; + } + return true; +}; + +let countryNames: Intl.DisplayNames; + +// detectRequestLocation is a helper function that detects the location of a request. +export const detectRequestLocation = (request: Request): string | undefined => { + if (!("cf" in request)) { + return undefined; + } + const cf = request.cf as any; + if (!countryNames) { + countryNames = new Intl.DisplayNames("en", { type: "region" }); + } + + const city = typeof cf.city === "string" ? cf.city.trim() : ""; + const region = typeof cf.region === "string" ? cf.region.trim() : ""; + const regionCode = + typeof cf.regionCode === "string" ? cf.regionCode.trim() : ""; + const countryRaw = + typeof cf.country === "string" ? cf.country.trim().toUpperCase() : ""; + + const parts: string[] = []; + if (city) parts.push(city); + if (region || regionCode) parts.push(region || regionCode); + if (countryRaw) { + if (!countryNames) { + countryNames = new Intl.DisplayNames("en", { type: "region" }); + } + const countryName = countryNames.of(countryRaw) || countryRaw; + parts.push(countryName); + } + return parts.length ? parts.join(", ") : undefined; +}; diff --git a/packages/api/src/server.test.ts b/packages/api/src/server.test.ts new file mode 100644 index 0000000..2079bf2 --- /dev/null +++ b/packages/api/src/server.test.ts @@ -0,0 +1,14 @@ +import { expect, test } from "bun:test"; +import Client from "./client.node"; +import { serve } from "./test"; + +test("GET /api", async () => { + const { url } = await serve(); + const client = new Client({ baseURL: url.toString() }); + + const response = await client.request("GET", "/api"); + const body = await response.json(); + expect(body).toEqual({ + message: "Hello, world!", + }); +}); diff --git a/packages/api/src/server.ts b/packages/api/src/server.ts new file mode 100644 index 0000000..7de8bef --- /dev/null +++ b/packages/api/src/server.ts @@ -0,0 +1,356 @@ +import Querier from "@blink.so/database/querier"; +import type { AgentDeployment, DBMessage } from "@blink.so/database/schema"; +import type { AgentStore } from "blink"; +import { type ExecutionContext, Hono } from "hono"; +import { cors } from "hono/cors"; +import { HTTPException } from "hono/http-exception"; +import { validate } from "uuid"; +import { ZodError } from "zod"; +import { fromError } from "zod-validation-error"; +import type { CreateChatMessage } from "./client.browser"; +import handleAgentRequest from "./routes/agent-request.server"; +import mountAgents from "./routes/agents/agents.server"; +import type { AgentLog } from "./routes/agents/logs.client"; +import type { FieldFilterGroup } from "./routes/agents/traces.client"; +import { mountDisabledAIGateway } from "./routes/ai-gateway.server"; +import mountAuth from "./routes/auth/auth.server"; +import mountChats from "./routes/chats/chats.server"; +import mountDevhook from "./routes/devhook.server"; +import mountFiles from "./routes/files.server"; +import mountInvites from "./routes/invites.server"; +import mountMessages from "./routes/messages.server"; +import mountOrganizations from "./routes/organizations/organizations.server"; +import type { OtelSpan } from "./routes/otlp/convert"; +import mountOtlp from "./routes/otlp/otlp.server"; +import mountTools from "./routes/tools/tools.server"; +import mountUsers from "./routes/users.server"; + +export type Email = + | { + type: "verification"; + email: string; + name: string | null; + code: string; + } + | { + type: "password-reset"; + email: string; + name: string | null; + code: string; + } + | { + type: "invite"; + email: string; + inviterName: string; + inviterEmail: string; + teamName: string; + role: string; + inviteUrl: string; + }; + +export type TelemetryEvent = + | { + type: "user.registered"; + userId: string; + email: string | null; + name: string | null; + earlyAccess?: boolean; + createdAt?: string; + } + | { + type: "user.oauth_registered"; + userId: string; + email: string | null; + name: string | null; + provider: string; + createdAt?: string; + } + | { + type: "user.invited"; + email: string; + role?: string; + invitedAt?: string; + inviteCode?: string; + } + | { + type: "user.merged"; + primaryUserId: string; + secondaryUserId: string; + } + | { + type: "user.deleted"; + userId: string; + }; + +export interface Bindings { + readonly database: () => Promise; + readonly agentStore: (targetID: string) => AgentStore; + readonly auth: { + // handleWebSocketTokenRequest is a function that will be called + // when a WebSocket connection is inbound for a token request. + // + // This is abstracted so the Cloudflare or Node implementation work regardless. + readonly handleWebSocketTokenRequest: ( + id: string, + request: Request + ) => Promise; + + /** + * sendTokenToWebSocket is called when the user has authenticated with the respective + * authentication ID and we now have a token. + * + * It's expected that the implementor would send the token to the WebSocket + * connection. + * + * @param id - The authentication ID. + * @param token - The token. + * @returns - A promise that resolves when the token has been handled. + */ + readonly sendTokenToWebSocket: (id: string, token: string) => Promise; + }; + readonly files: { + readonly upload: (opts: { + user_id?: string; + agent_id?: string; + organization_id?: string; + file: File; + }) => Promise<{ + id: string; + url: string; + }>; + readonly download: (id: string) => Promise<{ + stream: ReadableStream; + type: string; + name: string; + size: number; + }>; + }; + readonly chat: { + readonly handleStart: (opts: { + id: string; + interrupt: boolean; + }) => Promise; + readonly handleStop: (id: string) => Promise; + readonly handleStream: (id: string, req: Request) => Promise; + readonly handleMessagesChanged: ( + event: "message.created" | "message.updated", + id: string, + messages: DBMessage[] + ) => Promise; + // This is intended to be an async operation where the server + // will notify the clients by some means that the title has been generated. + readonly generateTitle?: (opts: { + messages: CreateChatMessage[]; + id: string; + }) => void; + }; + readonly logs: { + readonly get: (opts: { + agent_id: string; + /** + * Simple filter - supports literal matching and wildcard matching. + * Wildcard matching is done using the `*` character. The '*' characters can be escaped with a backslash. + * For example: + * - `*error*` will match any message that contains the word "error". + * - `error*` will match any message that starts with the word "error". + * - `*error` will match any message that ends with the word "error". + * - `*error*success` will match any message that contains the word "error" and ends with "success". + * - `error\*` will match any message that contains the literal string "error*". + */ + message_pattern?: string; + /** + * Advanced filters - same as traces filtering. + * Allows filtering by JSON paths in the log payload. + */ + filters?: FieldFilterGroup; + start_time: Date; + end_time: Date; + limit: number; + }) => Promise; + readonly write: (opts: { + agent_id: string; + event: Record; + }) => Promise; + }; + readonly compute?: { + readonly handleConnect: (id: string, req: Request) => Promise; + readonly handleServe: (id: string, req: Request) => Promise; + }; + readonly traces: { + readonly write: (spans: OtelSpan[]) => Promise; + readonly read: (opts: { + agent_id: string; + filters: FieldFilterGroup; + start_time?: Date; + end_time?: Date; + limit: number; + }) => Promise; + }; + readonly runtime: { + readonly usage: (opts: { + agent_id: string; + start_time: Date; + end_time: Date; + }) => Promise; + }; + readonly devhook?: { + readonly handleListen: (id: string, req: Request) => Promise; + readonly handleRequest: (id: string, req: Request) => Promise; + }; + readonly sendEmail?: (email: Email) => Promise; + readonly sendTelemetryEvent?: (event: TelemetryEvent) => Promise; + /** + * Deploy an agent. It's expected that the implementor will update the status + * of the deployment as it progresses, and will mark it as the "active_deployment_id" + * if the "target" is "production". + * + * @param deployment - The agent deployment to deploy. + * @returns - A promise that resolves when the agent has been deployed. + */ + readonly deployAgent: (deployment: AgentDeployment) => Promise | void; + + /** + * apiBaseURL is the base URL that the API is running on. + * Pathname will not be respected - /api is used. + */ + readonly apiBaseURL: URL; + readonly matchRequestHost?: (host: string) => string | undefined; + readonly createRequestURL?: (id: string) => URL; + + readonly AUTH_SECRET: string; + readonly NODE_ENV: string; + readonly AI_GATEWAY_API_KEY?: string; + readonly TOOLS_EXA_API_KEY?: string; + + // OAuth provider credentials + readonly GITHUB_CLIENT_ID?: string; + readonly GITHUB_CLIENT_SECRET?: string; + readonly GOOGLE_CLIENT_ID?: string; + readonly GOOGLE_CLIENT_SECRET?: string; + + // Optional AWS credentials used by platform logging to CloudWatch + readonly AWS_ACCESS_KEY_ID?: string; + readonly AWS_SECRET_ACCESS_KEY?: string; + readonly AWS_REGION?: string; +} + +export type APIServer = Hono<{ + Bindings: Bindings; +}>; + +const api = new Hono<{ + Bindings: Bindings; +}>() + .basePath("/api") + .use( + cors({ + // We're going to test the embedding of chats on coder.com. + origin: ["https://blink.so"], + }) + ); + +api.use(async (c, next) => { + await next(); + if (c.res.headers.get("Content-Type")?.startsWith("application/json")) { + const obj = await c.res.json(); + c.res = new Response(JSON.stringify(obj, null, 2), c.res); + } +}); +api.get("/", async (c) => { + return c.json({ + message: "Hello, world!", + }); +}); +api.onError((err, c) => { + console.error(err); + + if (err instanceof ZodError) { + const parsed = fromError(err); + return c.json( + { + message: fromError(err).message, + details: parsed.details, + }, + 400 + ); + } + + if (err instanceof HTTPException) { + return c.json( + { + message: err.message, + details: err.cause, + }, + err.status + ); + } + + return c.json( + { + message: "Internal Server Error", + }, + 500 + ); +}); +api.notFound((c) => { + return c.json({ message: "Not Found" }, 404); +}); + +mountAgents(api.basePath("/agents")); +mountAuth(api.basePath("/auth")); +mountChats(api.basePath("/chats")); +mountFiles(api.basePath("/files")); +mountOrganizations(api.basePath("/organizations")); +mountUsers(api.basePath("/users")); +mountInvites(api.basePath("/invites")); +mountMessages(api.basePath("/messages")); +// the AI Gateway is disabled until we implement proper billing +mountDisabledAIGateway(api.basePath("/ai-gateway")); +mountTools(api.basePath("/tools")); +mountOtlp(api.basePath("/otlp")); +mountDevhook(api.basePath("/devhook")); + +// Legacy webhook route for backwards compatibility. +api.all("/webhook/:id", async (c) => { + const id = c.req.param("id"); + if (!validate(id)) { + return c.json({ message: "Invalid ID" }, 400); + } + return handleAgentRequest(c, id, true); +}); + +export type AgentServer = Hono<{ + Bindings: Bindings; + Variables: { + request_id: string; + }; +}>; + +const app = new Hono<{ + Bindings: Bindings; +}>(); +app.all("*", (c) => { + const url = new URL(c.req.raw.url); + const match = c.env.matchRequestHost && c.env.matchRequestHost(url.host); + // We handle all agent requests here if they match. + // This could be for dev requests or production requests. + if (match) { + return handleAgentRequest(c, match, false); + } + // Just pass through to the API. + // We could make it 404 here, but it's really unnecessary + // it will anyways if the route is not found. + return api.fetch(c.req.raw, c.env, c.executionCtx); +}); + +export default { + fetch: ( + req: Request, + bindings: Bindings, + executionCtx?: ExecutionContext + ) => { + return app.fetch(req, bindings, executionCtx); + }, +}; + +export type { OtelSpan }; diff --git a/packages/api/src/test.ts b/packages/api/src/test.ts new file mode 100644 index 0000000..4fbd467 --- /dev/null +++ b/packages/api/src/test.ts @@ -0,0 +1,285 @@ +import { connectToPostgres } from "@blink.so/database/postgres"; +import Querier from "@blink.so/database/querier"; +import type { User } from "@blink.so/database/schema"; +import { createPostgresURL, createTestUser } from "@blink.so/database/test"; +import { encode } from "next-auth/jwt"; +import Client from "./client.node"; +import server, { type Bindings } from "./server"; + +import type { AgentStore } from "blink"; + +export interface PartialBindings + extends Partial< + Omit< + Bindings, + | "auth" + | "chat" + | "files" + | "logs" + | "traces" + | "runtime" + | "sendEmail" + | "sendTelemetryEvent" + > + > { + auth?: Partial; + chat?: Partial; + files?: Partial; + logs?: Partial; + traces?: Partial; + runtime?: Partial; + sendEmail?: Bindings["sendEmail"]; + sendTelemetryEvent?: Bindings["sendTelemetryEvent"]; +} + +export type ServeOptions = { + bindings?: PartialBindings; + + onWaitUntil?: (promise: Promise) => void; +}; + +export const serve = async (options?: ServeOptions) => { + let databasePromise: Promise | undefined; + + const authSecret = options?.bindings?.AUTH_SECRET ?? crypto.randomUUID(); + const files = new Map(); + const devhookServers = new Map(); + const srv = Bun.serve< + | { + type: "token"; + id: string; + } + | { + type: "devhook"; + id: string; + }, + any + >({ + fetch: (request, srv) => { + return server.fetch(request, bindings, { + waitUntil: (promise) => { + options?.onWaitUntil?.(promise); + }, + passThroughOnException() {}, + props: {}, + }); + }, + websocket: { + open: (ws) => { + if (ws.data.type === "token") { + ws.subscribe(`token:${ws.data.id}`); + } + if (ws.data.type === "devhook") { + ws.subscribe(`devhook:${ws.data.id}`); + } + }, + message: (ws, message) => { + if (ws.data.type === "devhook") { + const srv = devhookServers.get(ws.data.id); + if (srv) { + srv.handleServerMessage(message as Uint8Array); + } + } + }, + }, + port: 0, + }); + const agentStore = new Map(); + const bindings: Bindings = { + apiBaseURL: srv.url, + matchRequestHost: (hostname) => { + const regex = new RegExp(`^(.*)\.${srv.url.host}$`); + const exec = regex.exec(hostname); + if (exec) { + return exec[1]; + } + return undefined; + }, + createRequestURL: (id) => { + return new URL(`http://${id}.${srv.url.host}`); + }, + + deployAgent: async (deployment) => { + // noop - users decide in their tests + }, + database: () => { + if (!databasePromise) { + databasePromise = createPostgresURL().then(async (v) => { + return new Querier(await connectToPostgres(v)); + }); + } + return databasePromise; + }, + AUTH_SECRET: authSecret, + NODE_ENV: "development", + ...options?.bindings, + agentStore: (targetID) => { + let store = agentStore.get(targetID); + if (!store) { + const values = new Map(); + store = { + delete: async (key) => { + values.delete(key); + }, + get: async (key) => { + return values.get(key); + }, + set: async (key, value) => { + values.set(key, value); + }, + list: async (prefix, options) => { + return { + entries: Array.from(values.entries()).map(([key, value]) => ({ + key, + value, + })), + }; + }, + }; + } + agentStore.set(targetID, store); + return store; + }, + auth: { + handleWebSocketTokenRequest: async (id, request) => { + if ( + srv.upgrade(request, { + data: { + type: "token", + id, + }, + }) + ) { + return new Response(null); + } + return new Response("Not a WebSocket", { status: 400 }); + }, + sendTokenToWebSocket: async (id, token) => { + srv.publish(`token:${id}`, token); + }, + ...options?.bindings?.auth, + }, + devhook: { + handleListen: async (id, req) => { + // Devhook not supported in OSS version + throw new Error("Devhook not supported in OSS version"); + }, + handleRequest: async (id, req) => { + // Devhook not supported in OSS version + throw new Error("Devhook not supported in OSS version"); + }, + ...options?.bindings?.devhook, + }, + files: { + upload: async (opts) => { + const id = crypto.randomUUID(); + files.set(id, opts.file); + return { + id, + url: `${srv.url}/api/files/${id}`, + }; + }, + download: async (id) => { + const file = files.get(id); + if (!file) { + throw new Error("File not found"); + } + return { + stream: file.stream(), + type: file.type, + name: file.name, + size: file.size, + }; + }, + ...options?.bindings?.files, + }, + chat: { + handleStart: async (opts) => { + // noop + }, + handleStop: async (id) => { + // noop + }, + handleStream: async (id, req) => { + throw new Error("Not implemented"); + }, + handleMessagesChanged: async (event, id, messages) => { + // noop + }, + ...options?.bindings?.chat, + }, + logs: { + get: async () => { + throw new Error("Not implemented"); + }, + write: async (opts) => { + // no-op + }, + ...options?.bindings?.logs, + }, + traces: { + write: async () => { + throw new Error("Not implemented"); + }, + read: async () => { + throw new Error("Not implemented"); + }, + ...options?.bindings?.traces, + }, + runtime: { + usage: async () => { + return "0.0"; + }, + ...options?.bindings?.runtime, + }, + sendEmail: + options?.bindings?.sendEmail ?? + (async (email) => { + // Mock email service for tests - just log + console.log("Mock email sent:", email.type, email.email); + }), + sendTelemetryEvent: + options?.bindings?.sendTelemetryEvent ?? + (async (event) => { + // Mock telemetry service for tests - just log + console.log("Mock telemetry event:", event.type); + }), + }; + + const createAuthToken = async (userID: string) => { + const token = await encode({ + secret: authSecret, + salt: "blink_session_token", + token: { + sub: userID, + }, + }); + return token; + }; + + return { + url: srv.url, + bindings, + helpers: { + createUser: async ( + userData?: Partial & { + username?: string; + avatar_url?: string | null; + } + ) => { + const db = await bindings.database(); + const user = await createTestUser(db, userData); + return { + user, + client: new Client({ + baseURL: srv.url.toString(), + authToken: await createAuthToken(user.id), + }), + }; + }, + }, + stop: () => { + srv.stop(); + }, + }; +}; diff --git a/packages/api/src/util/async-iterable-stream.ts b/packages/api/src/util/async-iterable-stream.ts new file mode 100644 index 0000000..f0dc750 --- /dev/null +++ b/packages/api/src/util/async-iterable-stream.ts @@ -0,0 +1,95 @@ +// Taken from: +// https://github.com/vercel/ai/blob/HEAD/packages/ai/src/util/async-iterable-stream.ts + +/** + * A type that combines AsyncIterable and ReadableStream. + * This allows a ReadableStream to be consumed using for-await-of syntax. + */ +export type AsyncIterableStream = AsyncIterable & ReadableStream; + +/** + * Wraps a ReadableStream and returns an object that is both a ReadableStream and an AsyncIterable. + * This enables consumption of the stream using for-await-of, with proper resource cleanup on early exit or error. + * + * @template T The type of the stream's chunks. + * @param source The source ReadableStream to wrap. + * @returns An AsyncIterableStream that can be used as both a ReadableStream and an AsyncIterable. + */ +export function createAsyncIterableStream( + source: ReadableStream +): AsyncIterableStream { + // Pipe through a TransformStream to ensure a fresh, unlocked stream. + const stream = source.pipeThrough(new TransformStream()); + + /** + * Implements the async iterator protocol for the stream. + * Ensures proper cleanup (cancelling and releasing the reader) on completion, early exit, or error. + */ + (stream as AsyncIterableStream)[Symbol.asyncIterator] = function ( + this: ReadableStream + ): AsyncIterator { + const reader = this.getReader(); + + let finished = false; + + /** + * Cleans up the reader by cancelling and releasing the lock. + */ + async function cleanup(cancelStream: boolean) { + finished = true; + try { + if (cancelStream) { + await reader.cancel?.(); + } + } finally { + try { + reader.releaseLock(); + } catch {} + } + } + + return { + /** + * Reads the next chunk from the stream. + * @returns A promise resolving to the next IteratorResult. + */ + async next(): Promise> { + if (finished) { + return { done: true, value: undefined }; + } + + const { done, value } = await reader.read(); + + if (done) { + await cleanup(true); + return { done: true, value: undefined }; + } + + return { done: false, value }; + }, + + /** + * Called on early exit (e.g., break from for-await). + * Ensures the stream is cancelled and resources are released. + * @returns A promise resolving to a completed IteratorResult. + */ + async return(): Promise> { + await cleanup(true); + return { done: true, value: undefined }; + }, + + /** + * Called on early exit with error. + * Ensures the stream is cancelled and resources are released, then rethrows the error. + * @param err The error to throw. + * @returns A promise that rejects with the provided error. + */ + async throw(err: unknown): Promise> { + await cleanup(true); + throw err; + }, + }; + }; + + return stream as AsyncIterableStream; +} diff --git a/packages/api/src/util/chat.ts b/packages/api/src/util/chat.ts new file mode 100644 index 0000000..99af199 --- /dev/null +++ b/packages/api/src/util/chat.ts @@ -0,0 +1,606 @@ +import type Querier from "@blink.so/database/querier"; +import { BlinkInvocationTokenHeader } from "@blink.so/runtime/types"; +import { + isToolOrDynamicToolUIPart, + isToolUIPart, + readUIMessageStream, + type UIMessage, + type UIMessageChunk, +} from "ai"; +import type { ID, ToolApprovalOutput } from "blink"; +import { EventSourceParserStream } from "eventsource-parser/stream"; +import { z } from "zod"; +import type { StreamChatEvent } from "../client.browser"; + +export interface RunChatOptions { + // The chat ID to run. + id: string; + signal: AbortSignal; + db: Querier; + + broadcast: (event: StreamChatEvent) => Promise; + waitUntil: (promise: Promise) => void; + writePlatformLog?: (opts: { + agentId: string; + event: Record; + }) => void; + + env: { + AUTH_SECRET: string; + }; +} + +/** + * runChat executes a chat run. It gets the latest chat step and executes it. + * The onus is on the caller to ensure that this does not run multiple times for the same chat. + */ +export async function runChat({ + id, + db, + signal, + broadcast, + waitUntil, + env, + writePlatformLog, +}: RunChatOptions): Promise<{ + continue: boolean; +}> { + const broadcastChatUpdate = async () => { + const chat = await db.selectChatByID({ id }); + if (!chat) { + throw new Error("Chat not found"); + } + broadcast({ + event: "chat.updated", + data: { + ...chat, + created_at: chat.created_at.toISOString(), + updated_at: new Date().toISOString(), + expire_ttl: chat.expire_ttl, + expires_at: chat.expire_ttl + ? new Date( + chat.created_at.getTime() + chat.expire_ttl * 1000 + ).toISOString() + : null, + agent: { + ...chat.agent, + pinned: false, + created_at: chat.agent.created_at.toISOString(), + updated_at: chat.agent.updated_at.toISOString(), + avatar_url: chat.agent.avatar_file_id + ? `/api/files/${chat.agent.avatar_file_id}` + : null, + request_url: null, + chat_expire_ttl: chat.agent.chat_expire_ttl, + user_permission: undefined, + }, + }, + }); + }; + + const latestChatRun = await db.selectLatestChatRun(id); + if (!latestChatRun) { + throw new Error("The chat was executed without a run"); + } + const { run, step } = latestChatRun; + if (!step) { + return { + continue: false, + }; + } + + const deployment = await db.selectAgentDeploymentByIDOrActive({ + agentID: run.agent_id, + id: run.agent_deployment_id, + }); + if (!deployment) { + throw new Error("Agent has no active deployment!"); + } + const baseURL = deployment.direct_access_url; + if (!baseURL) { + throw new Error("Agent deployment has no run URL!"); + } + const dbMessages = await db.selectMessagesByChatID(id); + const { Client } = await import("blink/client"); + const client = new Client({ + baseUrl: baseURL, + }); + const firstMessageID = dbMessages[0]?.id; + const lastMessageID = dbMessages[dbMessages.length - 1]?.id; + await db.updateChatRunStep({ + id: step.id, + first_message_id: firstMessageID ?? null, + last_message_id: lastMessageID ?? null, + }); + + await broadcastChatUpdate(); + + let stream: ReadableStream; + const reqId = crypto.randomUUID(); + const requestStart = performance.now(); + using hb = startHeartbeat({ + waitUntil, + db, + stepId: step.id, + }); + + try { + // Fire-and-forget platform log (must not block) + writePlatformLog?.({ + agentId: run.agent_id, + event: { + type: "blink.request.send_messages", + level: "info", + ts: new Date().toISOString(), + source: "platform", + message: "Sending messages to agent", + agent: { + id: run.agent_id, + deployment_id: deployment.id, + }, + correlation: { + chat_id: id, + run_id: run.id, + step_id: step.id, + request_id: reqId, + }, + }, + }); + + const { generateAgentInvocationToken } = await import( + "@blink.so/api/agents/me/server" + ); + const headers = { + [BlinkInvocationTokenHeader]: await generateAgentInvocationToken( + env.AUTH_SECRET, + { + agent_id: run.agent_id, + agent_deployment_id: deployment.id, + agent_deployment_target_id: deployment.target_id, + step_id: step.id, + run_id: run.id, + chat_id: id, + } + ), + }; + + if (deployment.compatibility_version === "3") { + // TODO: we should cache the key. + const chat = await db.selectChatByID({ id }); + if (!chat) { + throw new Error("Chat not found"); + } + stream = await client.chat( + { + id: chat.id as ID, + messages: dbMessages.map((m) => ({ + id: m.id, + parts: m.parts, + role: m.role, + metadata: m.metadata, + })), + }, + { + signal, + headers, + } + ); + } else { + let runURL: URL; + if (deployment.compatibility_version === "1") { + runURL = new URL("/sendMessages", baseURL); + } else { + runURL = new URL("/_agent/send-messages", baseURL); + } + const resp = await fetch(runURL, { + method: "POST", + body: JSON.stringify({ + chat: { + id, + }, + messages: dbMessages.map((m) => ({ + id: m.id, + parts: m.parts, + role: m.role, + metadata: m.metadata, + })), + }), + headers, + }); + + if (!resp.ok) { + const error = await resp.text(); + throw new Error(error); + } + + stream = resp + .body!.pipeThrough(new TextDecoderStream()) + .pipeThrough(new EventSourceParserStream()) + .pipeThrough( + new TransformStream({ + async transform(chunk, controller) { + if (chunk.data === "[DONE]") { + return; + } + try { + const result = JSON.parse(chunk.data); + controller.enqueue(result as UIMessageChunk); + } catch (err) { + controller.error(err); + return; + } + }, + }) + ); + } + } catch (err) { + let error: string | undefined; + if (signal.aborted) { + // If an abort occurrs, it's because a new step was created. + // So we don't want to set an error - the interrupt will + // already be set. + error = undefined; + } else if (err instanceof Error) { + error = err.message; + } else { + error = JSON.stringify(err); + } + // If fetch fails, we update the run. + await db.updateChatRunStep({ + id: step.id, + chat_run_id: run.id, + chat_id: id, + error, + interrupted_at: signal.aborted ? new Date() : undefined, + completed_at: new Date(), + }); + await broadcastChatUpdate(); + + // Emit failure log (fire-and-forget) + writePlatformLog?.({ + agentId: run.agent_id, + event: { + type: "blink.request.send_messages", + level: "error", + ts: new Date().toISOString(), + source: "platform", + message: "Failed to send messages to agent", + agent: { + id: run.agent_id, + deployment_id: deployment.id, + }, + correlation: { + chat_id: id, + run_id: run.id, + step_id: step.id, + request_id: reqId, + }, + error: err instanceof Error ? err.message : String(err), + }, + }); + return { + continue: false, + }; + } + + const responseMessageID = crypto.randomUUID(); + let timeToFirstTokenMicros: number | undefined; + let error: Error | undefined; + const streamingResponseMessages = readUIMessageStream({ + stream: stream.pipeThrough( + new TransformStream({ + transform: (chunk, controller) => { + if (signal.aborted) { + return; + } + if (timeToFirstTokenMicros === undefined) { + timeToFirstTokenMicros = Math.round( + (performance.now() - requestStart) * 1000 + ); + } + + broadcast({ + event: "message.chunk.added", + data: { + id: responseMessageID, + chunk, + }, + }); + controller.enqueue(chunk); + }, + }), + { signal } + ), + onError: (err) => { + error = err instanceof Error ? err : new Error(String(err)); + }, + }); + + let responseMessage: UIMessage | null = null; + + const insertResponseMessage = async () => { + if (!responseMessage) { + return; + } + const createdAt = new Date(); + await db.insertMessages({ + messages: [ + { + id: responseMessageID, + created_at: createdAt, + chat_id: step.chat_id, + role: "assistant", + parts: responseMessage.parts, + agent_id: step.agent_id, + agent_deployment_id: step.agent_deployment_id, + chat_run_id: step.chat_run_id, + chat_run_step_id: step.id, + metadata: responseMessage.metadata as Record, + }, + ], + }); + + await broadcast({ + event: "message.created", + data: { + id: responseMessageID, + chat_id: step.chat_id, + role: responseMessage?.role, + parts: responseMessage?.parts ?? [], + format: "ai-sdk", + created_at: createdAt.toISOString(), + metadata: (responseMessage.metadata as Record) ?? null, + }, + }); + }; + try { + for await (const chunk of streamingResponseMessages) { + responseMessage = chunk; + } + } catch (err) { + if (err instanceof Error) { + error = err; + } else { + console.warn("An unknown error occurred:", err); + } + } + + const stats = getMessageStats(responseMessage); + if (error || signal.aborted) { + if (responseMessage) { + await insertResponseMessage(); + } + + await db.updateChatRunStep({ + id: step.id, + chat_run_id: run.id, + chat_id: id, + error: signal.aborted ? undefined : error?.message, + interrupted_at: signal.aborted ? new Date() : undefined, + completed_at: new Date(), + response_message_id: responseMessage ? responseMessageID : null, + response_status: 200, + time_to_first_token_micros: timeToFirstTokenMicros ?? null, + ...stats, + }); + await broadcastChatUpdate(); + return { + continue: false, + }; + } + + if (responseMessage) { + await insertResponseMessage(); + + if (shouldLoop(responseMessage)) { + await db.tx(async (tx) => { + await tx.updateChatRunStep({ + id: step.id, + chat_run_id: run.id, + chat_id: step.chat_id, + completed_at: new Date(), + continuation_reason: "tool_call", + response_message_id: responseMessageID, + response_status: 200, + time_to_first_token_micros: timeToFirstTokenMicros ?? null, + ...stats, + }); + + // Insert a new step for the next loop. + await tx.insertChatRunStep( + { + chat_id: step.chat_id, + chat_run_id: run.id, + agent_id: run.agent_id, + agent_deployment_id: deployment.id, + }, + // This ignores the unique constraint. If someone else + // created a new step already, that's perfectly fine. + true + ); + }); + + await broadcastChatUpdate(); + return { + continue: true, + }; + } + } + + await db.updateChatRunStep({ + id: step.id, + chat_run_id: run.id, + chat_id: id, + completed_at: new Date(), + response_message_id: responseMessage ? responseMessageID : null, + response_status: 200, + time_to_first_token_micros: timeToFirstTokenMicros ?? null, + ...stats, + }); + await broadcastChatUpdate(); + + return { + continue: false, + }; +} + +function startHeartbeat({ + waitUntil, + db, + stepId, +}: { + waitUntil: (promise: Promise) => void; + db: { + updateChatRunStep: (updates: { + id: string; + heartbeat_at: Date; + }) => Promise; + }; + stepId: string; +}) { + const beat = async () => { + try { + await db.updateChatRunStep({ id: stepId, heartbeat_at: new Date() }); + } catch (err) { + // noop + } + }; + + // Kick immediately so slow starts are not marked idle + waitUntil(beat()); + const interval = setInterval(() => { + waitUntil(beat()); + }, 30_000); + + return { + [Symbol.dispose](): void { + clearInterval(interval); + }, + } as { [Symbol.dispose](): void }; +} + +interface MessageStats { + tool_calls: number; + tool_calls_completed: number; + tool_calls_errored: number; + usage_cost_usd: number | undefined; + usage_model: string | undefined; + usage_total_input_tokens: number | undefined; + usage_total_output_tokens: number | undefined; + usage_total_tokens: number | undefined; + usage_total_cached_input_tokens: number | undefined; +} + +function getMessageStats(message: UIMessage | null): MessageStats { + const stats: MessageStats = { + tool_calls: 0, + tool_calls_completed: 0, + tool_calls_errored: 0, + usage_cost_usd: undefined, + usage_model: undefined, + usage_total_input_tokens: undefined, + usage_total_output_tokens: undefined, + usage_total_tokens: undefined, + usage_total_cached_input_tokens: undefined, + }; + if (!message) { + return stats; + } + for (const part of message.parts) { + if (isToolUIPart(part)) { + stats.tool_calls++; + if (part.state === "output-available") { + stats.tool_calls_completed++; + } else if (part.state === "output-error") { + stats.tool_calls_errored++; + } + } + } + + if (message.metadata) { + // Check if the metadata is usage data. + // This is an example of the raw metadata we get back. + // metadata: { + // usage: { + // inputTokens: 7181, + // outputTokens: 35, + // totalTokens: 7216, + // cachedInputTokens: 0 + // }, + // model: 'claude-sonnet-4-5-20250929', + // totalUsage: { + // inputTokens: 7181, + // outputTokens: 35, + // totalTokens: 7216, + // cachedInputTokens: 0 + // } + // }, + const usageStats = usageStatsSchema.safeParse(message.metadata); + if (usageStats.success) { + stats.usage_model = usageStats.data.model; + stats.usage_total_input_tokens = usageStats.data.totalUsage?.inputTokens; + stats.usage_total_output_tokens = + usageStats.data.totalUsage?.outputTokens; + stats.usage_total_tokens = usageStats.data.totalUsage?.totalTokens; + stats.usage_total_cached_input_tokens = + usageStats.data.totalUsage?.cachedInputTokens; + } + } + + return stats; +} + +const usageStatsSchema = z.object({ + totalUsage: z + .object({ + inputTokens: z.number().optional(), + outputTokens: z.number().optional(), + totalTokens: z.number().optional(), + cachedInputTokens: z.number().optional(), + }) + .optional(), + model: z.string().optional(), +}); + +function shouldLoop(lastMessage: UIMessage): boolean { + if (lastMessage.role !== "assistant") { + return false; + } + const lastStepStartIndex = lastMessage.parts.reduce( + (lastIndex, part, index) => { + return part.type === "step-start" ? index : lastIndex; + }, + -1 + ); + const lastStepToolInvocations = lastMessage.parts + .slice(lastStepStartIndex + 1) + .filter(isToolOrDynamicToolUIPart); + + if (lastStepToolInvocations.length === 0) { + return false; + } + + const hasPendingApprovals = lastStepToolInvocations.some( + (part) => + isToolApprovalOutput(part.output) && part.output.outcome === "pending" + ); + if (hasPendingApprovals) { + return false; + } + + return lastStepToolInvocations.every((part) => + part.state.startsWith("output-") + ); +} + +/** + * isToolApprovalOutput checks if an output is a tool approval output. + */ +function isToolApprovalOutput(output: unknown): output is ToolApprovalOutput { + return ( + typeof output === "object" && + output !== null && + "type" in output && + output.type === "tool-approval" + ); +} diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json new file mode 100644 index 0000000..4096a3a --- /dev/null +++ b/packages/api/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "incremental": true, + "verbatimModuleSyntax": true, + "module": "esnext", + "esModuleInterop": true, + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve" + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/packages/api/tsconfig.tsbuildinfo b/packages/api/tsconfig.tsbuildinfo new file mode 100644 index 0000000..50b5960 --- /dev/null +++ b/packages/api/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"version":"7.0.0-dev.20251005.1","root":[[238,240],[305,306],[354,376],381,[457,460],808,937,[944,950],[955,962],[969,972],[974,984],[994,996],[1000,1018],[1317,1334]],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.intl.d.ts","lib.esnext.disposable.d.ts","lib.esnext.promise.d.ts","lib.esnext.decorators.d.ts","lib.esnext.iterator.d.ts","lib.esnext.float16.d.ts","lib.esnext.error.d.ts","lib.esnext.sharedmemory.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../node_modules/@ai-sdk/provider/dist/index.d.ts","../../node_modules/zod/v4/core/standard-schema.d.cts","../../node_modules/zod/v4/core/util.d.cts","../../node_modules/zod/v4/core/versions.d.cts","../../node_modules/zod/v4/core/schemas.d.cts","../../node_modules/zod/v4/core/checks.d.cts","../../node_modules/zod/v4/core/errors.d.cts","../../node_modules/zod/v4/core/core.d.cts","../../node_modules/zod/v4/core/parse.d.cts","../../node_modules/zod/v4/core/regexes.d.cts","../../node_modules/zod/v4/locales/ar.d.cts","../../node_modules/zod/v4/locales/az.d.cts","../../node_modules/zod/v4/locales/be.d.cts","../../node_modules/zod/v4/locales/ca.d.cts","../../node_modules/zod/v4/locales/cs.d.cts","../../node_modules/zod/v4/locales/de.d.cts","../../node_modules/zod/v4/locales/en.d.cts","../../node_modules/zod/v4/locales/eo.d.cts","../../node_modules/zod/v4/locales/es.d.cts","../../node_modules/zod/v4/locales/fa.d.cts","../../node_modules/zod/v4/locales/fi.d.cts","../../node_modules/zod/v4/locales/fr.d.cts","../../node_modules/zod/v4/locales/fr-CA.d.cts","../../node_modules/zod/v4/locales/he.d.cts","../../node_modules/zod/v4/locales/hu.d.cts","../../node_modules/zod/v4/locales/id.d.cts","../../node_modules/zod/v4/locales/it.d.cts","../../node_modules/zod/v4/locales/ja.d.cts","../../node_modules/zod/v4/locales/kh.d.cts","../../node_modules/zod/v4/locales/ko.d.cts","../../node_modules/zod/v4/locales/mk.d.cts","../../node_modules/zod/v4/locales/ms.d.cts","../../node_modules/zod/v4/locales/nl.d.cts","../../node_modules/zod/v4/locales/no.d.cts","../../node_modules/zod/v4/locales/ota.d.cts","../../node_modules/zod/v4/locales/ps.d.cts","../../node_modules/zod/v4/locales/pl.d.cts","../../node_modules/zod/v4/locales/pt.d.cts","../../node_modules/zod/v4/locales/ru.d.cts","../../node_modules/zod/v4/locales/sl.d.cts","../../node_modules/zod/v4/locales/sv.d.cts","../../node_modules/zod/v4/locales/ta.d.cts","../../node_modules/zod/v4/locales/th.d.cts","../../node_modules/zod/v4/locales/tr.d.cts","../../node_modules/zod/v4/locales/ua.d.cts","../../node_modules/zod/v4/locales/ur.d.cts","../../node_modules/zod/v4/locales/vi.d.cts","../../node_modules/zod/v4/locales/zh-CN.d.cts","../../node_modules/zod/v4/locales/zh-TW.d.cts","../../node_modules/zod/v4/locales/index.d.cts","../../node_modules/zod/v4/core/registries.d.cts","../../node_modules/zod/v4/core/doc.d.cts","../../node_modules/zod/v4/core/function.d.cts","../../node_modules/zod/v4/core/api.d.cts","../../node_modules/zod/v4/core/json-schema.d.cts","../../node_modules/zod/v4/core/to-json-schema.d.cts","../../node_modules/zod/v4/core/index.d.cts","../../node_modules/zod/v4/classic/errors.d.cts","../../node_modules/zod/v4/classic/parse.d.cts","../../node_modules/zod/v4/classic/schemas.d.cts","../../node_modules/zod/v4/classic/checks.d.cts","../../node_modules/zod/v4/classic/compat.d.cts","../../node_modules/zod/v4/classic/iso.d.cts","../../node_modules/zod/v4/classic/coerce.d.cts","../../node_modules/zod/v4/classic/external.d.cts","../../node_modules/zod/v4/classic/index.d.cts","../../node_modules/zod/v4/index.d.cts","../../node_modules/@standard-schema/spec/dist/index.d.ts","../../node_modules/zod/v3/helpers/typeAliases.d.cts","../../node_modules/zod/v3/helpers/util.d.cts","../../node_modules/zod/v3/ZodError.d.cts","../../node_modules/zod/v3/locales/en.d.cts","../../node_modules/zod/v3/errors.d.cts","../../node_modules/zod/v3/helpers/parseUtil.d.cts","../../node_modules/zod/v3/helpers/enumUtil.d.cts","../../node_modules/zod/v3/helpers/errorUtil.d.cts","../../node_modules/zod/v3/helpers/partialUtil.d.cts","../../node_modules/zod/v3/standard-schema.d.cts","../../node_modules/zod/v3/types.d.cts","../../node_modules/zod/v3/external.d.cts","../../node_modules/zod/v3/index.d.cts","../../node_modules/eventsource-parser/dist/stream.d.ts","../../node_modules/@ai-sdk/provider-utils/dist/index.d.ts","./node_modules/zod/v4/core/standard-schema.d.cts","./node_modules/zod/v4/core/util.d.cts","./node_modules/zod/v4/core/versions.d.cts","./node_modules/zod/v4/core/schemas.d.cts","./node_modules/zod/v4/core/checks.d.cts","./node_modules/zod/v4/core/errors.d.cts","./node_modules/zod/v4/core/core.d.cts","./node_modules/zod/v4/core/parse.d.cts","./node_modules/zod/v4/core/regexes.d.cts","./node_modules/zod/v4/locales/ar.d.cts","./node_modules/zod/v4/locales/az.d.cts","./node_modules/zod/v4/locales/be.d.cts","./node_modules/zod/v4/locales/bg.d.cts","./node_modules/zod/v4/locales/ca.d.cts","./node_modules/zod/v4/locales/cs.d.cts","./node_modules/zod/v4/locales/da.d.cts","./node_modules/zod/v4/locales/de.d.cts","./node_modules/zod/v4/locales/en.d.cts","./node_modules/zod/v4/locales/eo.d.cts","./node_modules/zod/v4/locales/es.d.cts","./node_modules/zod/v4/locales/fa.d.cts","./node_modules/zod/v4/locales/fi.d.cts","./node_modules/zod/v4/locales/fr.d.cts","./node_modules/zod/v4/locales/fr-CA.d.cts","./node_modules/zod/v4/locales/he.d.cts","./node_modules/zod/v4/locales/hu.d.cts","./node_modules/zod/v4/locales/id.d.cts","./node_modules/zod/v4/locales/is.d.cts","./node_modules/zod/v4/locales/it.d.cts","./node_modules/zod/v4/locales/ja.d.cts","./node_modules/zod/v4/locales/ka.d.cts","./node_modules/zod/v4/locales/kh.d.cts","./node_modules/zod/v4/locales/km.d.cts","./node_modules/zod/v4/locales/ko.d.cts","./node_modules/zod/v4/locales/lt.d.cts","./node_modules/zod/v4/locales/mk.d.cts","./node_modules/zod/v4/locales/ms.d.cts","./node_modules/zod/v4/locales/nl.d.cts","./node_modules/zod/v4/locales/no.d.cts","./node_modules/zod/v4/locales/ota.d.cts","./node_modules/zod/v4/locales/ps.d.cts","./node_modules/zod/v4/locales/pl.d.cts","./node_modules/zod/v4/locales/pt.d.cts","./node_modules/zod/v4/locales/ru.d.cts","./node_modules/zod/v4/locales/sl.d.cts","./node_modules/zod/v4/locales/sv.d.cts","./node_modules/zod/v4/locales/ta.d.cts","./node_modules/zod/v4/locales/th.d.cts","./node_modules/zod/v4/locales/tr.d.cts","./node_modules/zod/v4/locales/ua.d.cts","./node_modules/zod/v4/locales/uk.d.cts","./node_modules/zod/v4/locales/ur.d.cts","./node_modules/zod/v4/locales/vi.d.cts","./node_modules/zod/v4/locales/zh-CN.d.cts","./node_modules/zod/v4/locales/zh-TW.d.cts","./node_modules/zod/v4/locales/yo.d.cts","./node_modules/zod/v4/locales/index.d.cts","./node_modules/zod/v4/core/registries.d.cts","./node_modules/zod/v4/core/doc.d.cts","./node_modules/zod/v4/core/api.d.cts","./node_modules/zod/v4/core/json-schema.d.cts","./node_modules/zod/v4/core/to-json-schema.d.cts","./node_modules/zod/v4/core/index.d.cts","./node_modules/zod/v4/classic/errors.d.cts","./node_modules/zod/v4/classic/parse.d.cts","./node_modules/zod/v4/classic/schemas.d.cts","./node_modules/zod/v4/classic/checks.d.cts","./node_modules/zod/v4/classic/compat.d.cts","./node_modules/zod/v4/classic/iso.d.cts","./node_modules/zod/v4/classic/coerce.d.cts","./node_modules/zod/v4/classic/external.d.cts","./node_modules/zod/index.d.cts","./src/util/async-iterable-stream.ts","./src/client-helper.ts","./src/client-helper.test.ts","../../node_modules/ai/node_modules/@ai-sdk/provider-utils/dist/index.d.ts","../../node_modules/ai/node_modules/@ai-sdk/gateway/dist/index.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/types.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/utils.d.ts","../../node_modules/@opentelemetry/api/build/src/common/Exception.d.ts","../../node_modules/@opentelemetry/api/build/src/common/Time.d.ts","../../node_modules/@opentelemetry/api/build/src/common/Attributes.d.ts","../../node_modules/@opentelemetry/api/build/src/context/types.d.ts","../../node_modules/@opentelemetry/api/build/src/context/context.d.ts","../../node_modules/@opentelemetry/api/build/src/api/context.d.ts","../../node_modules/@opentelemetry/api/build/src/diag/types.d.ts","../../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.d.ts","../../node_modules/@opentelemetry/api/build/src/api/diag.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/ObservableResult.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/Metric.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/Meter.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.d.ts","../../node_modules/@opentelemetry/api/build/src/api/metrics.d.ts","../../node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/context-helpers.d.ts","../../node_modules/@opentelemetry/api/build/src/api/propagation.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/attributes.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/trace_state.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/span_context.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/link.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/status.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/span.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/span_kind.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/tracer.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/tracer_options.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/tracer_provider.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/Sampler.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/trace_flags.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/internal/utils.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/context-utils.d.ts","../../node_modules/@opentelemetry/api/build/src/api/trace.d.ts","../../node_modules/@opentelemetry/api/build/src/context-api.d.ts","../../node_modules/@opentelemetry/api/build/src/diag-api.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics-api.d.ts","../../node_modules/@opentelemetry/api/build/src/propagation-api.d.ts","../../node_modules/@opentelemetry/api/build/src/trace-api.d.ts","../../node_modules/@opentelemetry/api/build/src/index.d.ts","../../node_modules/ai/dist/index.d.ts","../../node_modules/hono/dist/types/utils/http-status.d.ts","../../node_modules/hono/dist/types/request/constants.d.ts","../../node_modules/hono/dist/types/router.d.ts","../../node_modules/hono/dist/types/utils/headers.d.ts","../../node_modules/hono/dist/types/utils/types.d.ts","../../node_modules/hono/dist/types/types.d.ts","../../node_modules/hono/dist/types/utils/body.d.ts","../../node_modules/hono/dist/types/request.d.ts","../../node_modules/hono/dist/types/utils/mime.d.ts","../../node_modules/hono/dist/types/context.d.ts","../../node_modules/hono/dist/types/hono-base.d.ts","../blink/dist/node/index.node-BbqFCkOX.d.ts","../blink/dist/node/agent/index.node.d.ts","./src/routes/agents/deployments.client.ts","./src/routes/agents/env.client.ts","../../node_modules/@bufbuild/protobuf/dist/esm/json-value.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/error.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/names.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/registry.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/reflect/index.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/to-binary.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/from-binary.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/wire/index.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/types.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/is-message.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/create.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/clone.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/equals.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/fields.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/merge.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/extensions.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/proto-int64.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/index.d.ts","../../node_modules/hono/dist/types/http-exception.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.d.ts","../../node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.d.ts","./src/routes/otlp/gen/opentelemetry/proto/common/v1/common_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/resource/v1/resource_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/trace/v1/trace_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts","./src/routes/otlp/convert.ts","./src/routes/agents/traces.client.ts","./src/routes/agents/logs.client.ts","./src/routes/agents/members.client.ts","./src/routes/chats/steps.client.ts","./src/routes/chats/runs.client.ts","./src/routes/agents/runs.client.ts","./src/routes/agents/steps.client.ts","./src/routes/agents/agents.client.ts","./src/routes/auth/auth.client.ts","./src/routes/messages.client.ts","./src/routes/chats/chats.client.ts","./src/routes/files.client.ts","./src/routes/organizations/members.client.ts","./src/routes/invites.client.ts","./src/routes/organizations/agents.client.ts","./src/routes/organizations/organizations.client.ts","./src/routes/users.client.ts","./src/client.browser.ts","../events/dist/events.d.ts","../../node_modules/@lydell/node-pty/node-pty.d.ts","../compute-protocol/dist/server-DLfoLMUJ.d.ts","../compute-protocol/dist/server.d.ts","./src/routes/devhook.client.ts","../compute-protocol/node_modules/zod/v4/core/standard-schema.d.cts","../compute-protocol/node_modules/zod/v4/core/util.d.cts","../compute-protocol/node_modules/zod/v4/core/versions.d.cts","../compute-protocol/node_modules/zod/v4/core/schemas.d.cts","../compute-protocol/node_modules/zod/v4/core/checks.d.cts","../compute-protocol/node_modules/zod/v4/core/errors.d.cts","../compute-protocol/node_modules/zod/v4/core/core.d.cts","../compute-protocol/node_modules/zod/v4/core/parse.d.cts","../compute-protocol/node_modules/zod/v4/core/regexes.d.cts","../compute-protocol/node_modules/zod/v4/locales/ar.d.cts","../compute-protocol/node_modules/zod/v4/locales/az.d.cts","../compute-protocol/node_modules/zod/v4/locales/be.d.cts","../compute-protocol/node_modules/zod/v4/locales/bg.d.cts","../compute-protocol/node_modules/zod/v4/locales/ca.d.cts","../compute-protocol/node_modules/zod/v4/locales/cs.d.cts","../compute-protocol/node_modules/zod/v4/locales/da.d.cts","../compute-protocol/node_modules/zod/v4/locales/de.d.cts","../compute-protocol/node_modules/zod/v4/locales/en.d.cts","../compute-protocol/node_modules/zod/v4/locales/eo.d.cts","../compute-protocol/node_modules/zod/v4/locales/es.d.cts","../compute-protocol/node_modules/zod/v4/locales/fa.d.cts","../compute-protocol/node_modules/zod/v4/locales/fi.d.cts","../compute-protocol/node_modules/zod/v4/locales/fr.d.cts","../compute-protocol/node_modules/zod/v4/locales/fr-CA.d.cts","../compute-protocol/node_modules/zod/v4/locales/he.d.cts","../compute-protocol/node_modules/zod/v4/locales/hu.d.cts","../compute-protocol/node_modules/zod/v4/locales/id.d.cts","../compute-protocol/node_modules/zod/v4/locales/is.d.cts","../compute-protocol/node_modules/zod/v4/locales/it.d.cts","../compute-protocol/node_modules/zod/v4/locales/ja.d.cts","../compute-protocol/node_modules/zod/v4/locales/ka.d.cts","../compute-protocol/node_modules/zod/v4/locales/kh.d.cts","../compute-protocol/node_modules/zod/v4/locales/km.d.cts","../compute-protocol/node_modules/zod/v4/locales/ko.d.cts","../compute-protocol/node_modules/zod/v4/locales/lt.d.cts","../compute-protocol/node_modules/zod/v4/locales/mk.d.cts","../compute-protocol/node_modules/zod/v4/locales/ms.d.cts","../compute-protocol/node_modules/zod/v4/locales/nl.d.cts","../compute-protocol/node_modules/zod/v4/locales/no.d.cts","../compute-protocol/node_modules/zod/v4/locales/ota.d.cts","../compute-protocol/node_modules/zod/v4/locales/ps.d.cts","../compute-protocol/node_modules/zod/v4/locales/pl.d.cts","../compute-protocol/node_modules/zod/v4/locales/pt.d.cts","../compute-protocol/node_modules/zod/v4/locales/ru.d.cts","../compute-protocol/node_modules/zod/v4/locales/sl.d.cts","../compute-protocol/node_modules/zod/v4/locales/sv.d.cts","../compute-protocol/node_modules/zod/v4/locales/ta.d.cts","../compute-protocol/node_modules/zod/v4/locales/th.d.cts","../compute-protocol/node_modules/zod/v4/locales/tr.d.cts","../compute-protocol/node_modules/zod/v4/locales/ua.d.cts","../compute-protocol/node_modules/zod/v4/locales/uk.d.cts","../compute-protocol/node_modules/zod/v4/locales/ur.d.cts","../compute-protocol/node_modules/zod/v4/locales/vi.d.cts","../compute-protocol/node_modules/zod/v4/locales/zh-CN.d.cts","../compute-protocol/node_modules/zod/v4/locales/zh-TW.d.cts","../compute-protocol/node_modules/zod/v4/locales/yo.d.cts","../compute-protocol/node_modules/zod/v4/locales/index.d.cts","../compute-protocol/node_modules/zod/v4/core/registries.d.cts","../compute-protocol/node_modules/zod/v4/core/doc.d.cts","../compute-protocol/node_modules/zod/v4/core/api.d.cts","../compute-protocol/node_modules/zod/v4/core/json-schema.d.cts","../compute-protocol/node_modules/zod/v4/core/to-json-schema.d.cts","../compute-protocol/node_modules/zod/v4/core/index.d.cts","../compute-protocol/node_modules/zod/v4/classic/errors.d.cts","../compute-protocol/node_modules/zod/v4/classic/parse.d.cts","../compute-protocol/node_modules/zod/v4/classic/schemas.d.cts","../compute-protocol/node_modules/zod/v4/classic/checks.d.cts","../compute-protocol/node_modules/zod/v4/classic/compat.d.cts","../compute-protocol/node_modules/zod/v4/classic/iso.d.cts","../compute-protocol/node_modules/zod/v4/classic/coerce.d.cts","../compute-protocol/node_modules/zod/v4/classic/external.d.cts","../compute-protocol/node_modules/zod/index.d.cts","../compute-protocol/dist/schema-BjdOf5Yg.d.ts","../compute-protocol/dist/client-u55b3voC.d.ts","../compute-protocol/dist/client.d.ts","./src/routes/tools/compute.client.ts","./src/routes/tools/tools.client.node.ts","./src/client.node.ts","./src/constants.ts","../../node_modules/hono/dist/types/hono.d.ts","../../node_modules/hono/dist/types/client/types.d.ts","../../node_modules/hono/dist/types/client/client.d.ts","../../node_modules/hono/dist/types/client/fetch-result-please.d.ts","../../node_modules/hono/dist/types/client/utils.d.ts","../../node_modules/hono/dist/types/client/index.d.ts","../../node_modules/hono/dist/types/index.d.ts","../../node_modules/@auth/core/lib/vendored/cookie.d.ts","../../node_modules/oauth4webapi/build/index.d.ts","../../node_modules/@auth/core/lib/utils/cookie.d.ts","../../node_modules/@auth/core/warnings.d.ts","../../node_modules/@auth/core/lib/symbols.d.ts","../../node_modules/@auth/core/lib/index.d.ts","../../node_modules/@auth/core/lib/utils/env.d.ts","../../node_modules/@auth/core/node_modules/preact/src/jsx.d.ts","../../node_modules/@auth/core/node_modules/preact/src/index.d.ts","../../node_modules/@auth/core/providers/credentials.d.ts","../../node_modules/@auth/core/providers/provider-types.d.ts","../../node_modules/@auth/core/providers/nodemailer.d.ts","../../node_modules/@auth/core/providers/email.d.ts","../../node_modules/@auth/core/providers/oauth.d.ts","../../node_modules/@auth/core/providers/webauthn.d.ts","../../node_modules/@auth/core/providers/index.d.ts","../../node_modules/@auth/core/adapters.d.ts","../../node_modules/@auth/core/lib/utils/actions.d.ts","../../node_modules/@auth/core/index.d.ts","../../node_modules/@auth/core/lib/utils/logger.d.ts","../../node_modules/@auth/core/lib/utils/webauthn-utils.d.ts","../../node_modules/@auth/core/types.d.ts","../../node_modules/@auth/core/jwt.d.ts","../../node_modules/next-auth/jwt.d.ts","../../node_modules/drizzle-orm/entity.d.ts","../../node_modules/drizzle-orm/cache/core/types.d.ts","../../node_modules/drizzle-orm/cache/core/cache.d.ts","../../node_modules/drizzle-orm/logger.d.ts","../../node_modules/drizzle-orm/casing.d.ts","../../node_modules/drizzle-orm/table.d.ts","../../node_modules/drizzle-orm/operations.d.ts","../../node_modules/drizzle-orm/subquery.d.ts","../../node_modules/drizzle-orm/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/sql/sql.d.ts","../../node_modules/drizzle-orm/utils.d.ts","../../node_modules/drizzle-orm/sql/expressions/conditions.d.ts","../../node_modules/drizzle-orm/sql/expressions/select.d.ts","../../node_modules/drizzle-orm/sql/expressions/index.d.ts","../../node_modules/drizzle-orm/sql/functions/aggregate.d.ts","../../node_modules/drizzle-orm/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/sql/functions/vector.d.ts","../../node_modules/drizzle-orm/sql/functions/index.d.ts","../../node_modules/drizzle-orm/sql/index.d.ts","../../node_modules/drizzle-orm/gel-core/checks.d.ts","../../node_modules/drizzle-orm/gel-core/sequence.d.ts","../../node_modules/drizzle-orm/gel-core/columns/int.common.d.ts","../../node_modules/drizzle-orm/gel-core/columns/bigintT.d.ts","../../node_modules/drizzle-orm/gel-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/gel-core/columns/bytes.d.ts","../../node_modules/drizzle-orm/gel-core/columns/custom.d.ts","../../node_modules/drizzle-orm/gel-core/columns/date-duration.d.ts","../../node_modules/drizzle-orm/gel-core/columns/decimal.d.ts","../../node_modules/drizzle-orm/gel-core/columns/double-precision.d.ts","../../node_modules/drizzle-orm/gel-core/columns/duration.d.ts","../../node_modules/drizzle-orm/gel-core/columns/integer.d.ts","../../node_modules/drizzle-orm/gel-core/columns/json.d.ts","../../node_modules/drizzle-orm/gel-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/gel-core/columns/localdate.d.ts","../../node_modules/drizzle-orm/gel-core/columns/localtime.d.ts","../../node_modules/drizzle-orm/gel-core/columns/real.d.ts","../../node_modules/drizzle-orm/gel-core/columns/relative-duration.d.ts","../../node_modules/drizzle-orm/gel-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/gel-core/columns/text.d.ts","../../node_modules/drizzle-orm/gel-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/gel-core/columns/timestamptz.d.ts","../../node_modules/drizzle-orm/gel-core/columns/uuid.d.ts","../../node_modules/drizzle-orm/gel-core/columns/all.d.ts","../../node_modules/drizzle-orm/gel-core/indexes.d.ts","../../node_modules/drizzle-orm/gel-core/roles.d.ts","../../node_modules/drizzle-orm/gel-core/policies.d.ts","../../node_modules/drizzle-orm/gel-core/primary-keys.d.ts","../../node_modules/drizzle-orm/gel-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/gel-core/table.d.ts","../../node_modules/drizzle-orm/gel-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/gel-core/columns/common.d.ts","../../node_modules/drizzle-orm/gel-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/gel-core/columns/index.d.ts","../../node_modules/drizzle-orm/gel-core/view-base.d.ts","../../node_modules/drizzle-orm/relations.d.ts","../../node_modules/drizzle-orm/session.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/query-promise.d.ts","../../node_modules/drizzle-orm/runnable-query.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/raw.d.ts","../../node_modules/drizzle-orm/gel-core/subquery.d.ts","../../node_modules/drizzle-orm/gel-core/db.d.ts","../../node_modules/drizzle-orm/gel-core/session.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/refresh-materialized-view.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/gel-core/dialect.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/gel-core/view-common.d.ts","../../node_modules/drizzle-orm/gel-core/view.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/gel-core/alias.d.ts","../../node_modules/drizzle-orm/gel-core/schema.d.ts","../../node_modules/drizzle-orm/gel-core/utils.d.ts","../../node_modules/drizzle-orm/gel-core/index.d.ts","../../node_modules/drizzle-orm/mysql-core/checks.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/binary.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/char.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/custom.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/date.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/datetime.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/decimal.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/double.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/enum.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/float.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/int.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/json.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/mediumint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/real.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/serial.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/text.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/time.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/tinyint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/varbinary.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/varchar.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/year.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/all.d.ts","../../node_modules/drizzle-orm/mysql-core/indexes.d.ts","../../node_modules/drizzle-orm/mysql-core/primary-keys.d.ts","../../node_modules/drizzle-orm/mysql-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/mysql-core/table.d.ts","../../node_modules/drizzle-orm/mysql-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/common.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/index.d.ts","../../node_modules/drizzle-orm/migrator.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/mysql-core/subquery.d.ts","../../node_modules/drizzle-orm/mysql-core/view-base.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/mysql-core/dialect.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/mysql-core/db.d.ts","../../node_modules/drizzle-orm/mysql-core/session.d.ts","../../node_modules/drizzle-orm/mysql-core/view-common.d.ts","../../node_modules/drizzle-orm/mysql-core/view.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/mysql-core/alias.d.ts","../../node_modules/drizzle-orm/mysql-core/schema.d.ts","../../node_modules/drizzle-orm/mysql-core/utils.d.ts","../../node_modules/drizzle-orm/mysql-core/index.d.ts","../../node_modules/drizzle-orm/pg-core/checks.d.ts","../../node_modules/drizzle-orm/pg-core/columns/bigserial.d.ts","../../node_modules/drizzle-orm/pg-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/pg-core/columns/char.d.ts","../../node_modules/drizzle-orm/pg-core/columns/cidr.d.ts","../../node_modules/drizzle-orm/pg-core/columns/custom.d.ts","../../node_modules/drizzle-orm/pg-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/pg-core/columns/date.d.ts","../../node_modules/drizzle-orm/pg-core/columns/double-precision.d.ts","../../node_modules/drizzle-orm/pg-core/columns/inet.d.ts","../../node_modules/drizzle-orm/pg-core/sequence.d.ts","../../node_modules/drizzle-orm/pg-core/columns/int.common.d.ts","../../node_modules/drizzle-orm/pg-core/columns/integer.d.ts","../../node_modules/drizzle-orm/pg-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/pg-core/columns/interval.d.ts","../../node_modules/drizzle-orm/pg-core/columns/json.d.ts","../../node_modules/drizzle-orm/pg-core/columns/jsonb.d.ts","../../node_modules/drizzle-orm/pg-core/columns/line.d.ts","../../node_modules/drizzle-orm/pg-core/columns/macaddr.d.ts","../../node_modules/drizzle-orm/pg-core/columns/macaddr8.d.ts","../../node_modules/drizzle-orm/pg-core/columns/numeric.d.ts","../../node_modules/drizzle-orm/pg-core/columns/point.d.ts","../../node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.d.ts","../../node_modules/drizzle-orm/pg-core/columns/real.d.ts","../../node_modules/drizzle-orm/pg-core/columns/serial.d.ts","../../node_modules/drizzle-orm/pg-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/pg-core/columns/smallserial.d.ts","../../node_modules/drizzle-orm/pg-core/columns/text.d.ts","../../node_modules/drizzle-orm/pg-core/columns/time.d.ts","../../node_modules/drizzle-orm/pg-core/columns/uuid.d.ts","../../node_modules/drizzle-orm/pg-core/columns/varchar.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.d.ts","../../node_modules/drizzle-orm/pg-core/columns/all.d.ts","../../node_modules/drizzle-orm/pg-core/indexes.d.ts","../../node_modules/drizzle-orm/pg-core/roles.d.ts","../../node_modules/drizzle-orm/pg-core/policies.d.ts","../../node_modules/drizzle-orm/pg-core/primary-keys.d.ts","../../node_modules/drizzle-orm/pg-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/pg-core/table.d.ts","../../node_modules/drizzle-orm/pg-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/pg-core/columns/common.d.ts","../../node_modules/drizzle-orm/pg-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/pg-core/columns/enum.d.ts","../../node_modules/drizzle-orm/pg-core/columns/index.d.ts","../../node_modules/drizzle-orm/pg-core/view-base.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/raw.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.d.ts","../../node_modules/drizzle-orm/pg-core/subquery.d.ts","../../node_modules/drizzle-orm/pg-core/db.d.ts","../../node_modules/drizzle-orm/pg-core/session.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/pg-core/dialect.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/pg-core/view-common.d.ts","../../node_modules/drizzle-orm/pg-core/view.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/pg-core/alias.d.ts","../../node_modules/drizzle-orm/pg-core/schema.d.ts","../../node_modules/drizzle-orm/pg-core/utils.d.ts","../../node_modules/drizzle-orm/pg-core/utils/array.d.ts","../../node_modules/drizzle-orm/pg-core/utils/index.d.ts","../../node_modules/drizzle-orm/pg-core/index.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/binary.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/char.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/custom.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/date.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/datetime.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/decimal.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/double.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/enum.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/float.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/int.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/json.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/mediumint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/real.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/serial.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/text.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/time.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/tinyint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/varbinary.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/varchar.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/vector.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/year.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/all.d.ts","../../node_modules/drizzle-orm/singlestore-core/indexes.d.ts","../../node_modules/drizzle-orm/singlestore-core/primary-keys.d.ts","../../node_modules/drizzle-orm/singlestore-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/singlestore-core/table.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/common.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/index.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/singlestore-core/dialect.d.ts","../../node_modules/drizzle-orm/cache/core/index.d.ts","../../node_modules/drizzle-orm/singlestore/session.d.ts","../../node_modules/drizzle-orm/singlestore/driver.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/singlestore-core/subquery.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/singlestore-core/db.d.ts","../../node_modules/drizzle-orm/singlestore-core/session.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/singlestore-core/alias.d.ts","../../node_modules/drizzle-orm/singlestore-core/schema.d.ts","../../node_modules/drizzle-orm/singlestore-core/utils.d.ts","../../node_modules/drizzle-orm/singlestore-core/index.d.ts","../../node_modules/drizzle-orm/sqlite-core/checks.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/custom.d.ts","../../node_modules/drizzle-orm/sqlite-core/indexes.d.ts","../../node_modules/drizzle-orm/sqlite-core/primary-keys.d.ts","../../node_modules/drizzle-orm/sqlite-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/sqlite-core/view-base.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/sqlite-core/subquery.d.ts","../../node_modules/drizzle-orm/sqlite-core/db.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/raw.d.ts","../../node_modules/drizzle-orm/sqlite-core/session.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/sqlite-core/dialect.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/sqlite-core/view.d.ts","../../node_modules/drizzle-orm/sqlite-core/utils.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/integer.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/numeric.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/real.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/text.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/all.d.ts","../../node_modules/drizzle-orm/sqlite-core/table.d.ts","../../node_modules/drizzle-orm/sqlite-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/common.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/index.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/sqlite-core/alias.d.ts","../../node_modules/drizzle-orm/sqlite-core/index.d.ts","../../node_modules/drizzle-orm/column-builder.d.ts","../../node_modules/drizzle-orm/column.d.ts","../../node_modules/drizzle-orm/alias.d.ts","../../node_modules/drizzle-orm/errors.d.ts","../../node_modules/drizzle-orm/view-common.d.ts","../../node_modules/drizzle-orm/index.d.ts","../database/src/shared.ts","../database/src/schema.ts","../../node_modules/uuid/dist/types.d.ts","../../node_modules/uuid/dist/max.d.ts","../../node_modules/uuid/dist/nil.d.ts","../../node_modules/uuid/dist/parse.d.ts","../../node_modules/uuid/dist/stringify.d.ts","../../node_modules/uuid/dist/v1.d.ts","../../node_modules/uuid/dist/v1ToV6.d.ts","../../node_modules/uuid/dist/v35.d.ts","../../node_modules/uuid/dist/v3.d.ts","../../node_modules/uuid/dist/v4.d.ts","../../node_modules/uuid/dist/v5.d.ts","../../node_modules/uuid/dist/v6.d.ts","../../node_modules/uuid/dist/v6ToV1.d.ts","../../node_modules/uuid/dist/v7.d.ts","../../node_modules/uuid/dist/validate.d.ts","../../node_modules/uuid/dist/version.d.ts","../../node_modules/uuid/dist/index.d.ts","./src/routes/api-keys.server.ts","../../node_modules/postgres/types/index.d.ts","../database/src/encryption.ts","../database/src/observability/filters.ts","../../node_modules/@types/node/compatibility/iterators.d.ts","../../node_modules/@types/node/globals.typedarray.d.ts","../../node_modules/@types/node/buffer.buffer.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../node_modules/@types/node/web-globals/crypto.d.ts","../../node_modules/@types/node/web-globals/domexception.d.ts","../../node_modules/@types/node/web-globals/events.d.ts","../../node_modules/buffer/index.d.ts","../../node_modules/undici-types/utility.d.ts","../../node_modules/undici-types/header.d.ts","../../node_modules/undici-types/readable.d.ts","../../node_modules/undici-types/fetch.d.ts","../../node_modules/undici-types/formdata.d.ts","../../node_modules/undici-types/connector.d.ts","../../node_modules/undici-types/client-stats.d.ts","../../node_modules/undici-types/client.d.ts","../../node_modules/undici-types/errors.d.ts","../../node_modules/undici-types/dispatcher.d.ts","../../node_modules/undici-types/global-dispatcher.d.ts","../../node_modules/undici-types/global-origin.d.ts","../../node_modules/undici-types/pool-stats.d.ts","../../node_modules/undici-types/pool.d.ts","../../node_modules/undici-types/handlers.d.ts","../../node_modules/undici-types/balanced-pool.d.ts","../../node_modules/undici-types/h2c-client.d.ts","../../node_modules/undici-types/agent.d.ts","../../node_modules/undici-types/mock-interceptor.d.ts","../../node_modules/undici-types/mock-call-history.d.ts","../../node_modules/undici-types/mock-agent.d.ts","../../node_modules/undici-types/mock-client.d.ts","../../node_modules/undici-types/mock-pool.d.ts","../../node_modules/undici-types/snapshot-agent.d.ts","../../node_modules/undici-types/mock-errors.d.ts","../../node_modules/undici-types/proxy-agent.d.ts","../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../node_modules/undici-types/retry-handler.d.ts","../../node_modules/undici-types/retry-agent.d.ts","../../node_modules/undici-types/api.d.ts","../../node_modules/undici-types/cache-interceptor.d.ts","../../node_modules/undici-types/interceptors.d.ts","../../node_modules/undici-types/util.d.ts","../../node_modules/undici-types/cookies.d.ts","../../node_modules/undici-types/patch.d.ts","../../node_modules/undici-types/websocket.d.ts","../../node_modules/undici-types/eventsource.d.ts","../../node_modules/undici-types/diagnostics-channel.d.ts","../../node_modules/undici-types/content-type.d.ts","../../node_modules/undici-types/cache.d.ts","../../node_modules/undici-types/index.d.ts","../../node_modules/@types/node/web-globals/fetch.d.ts","../../node_modules/@types/node/web-globals/navigator.d.ts","../../node_modules/@types/node/web-globals/storage.d.ts","../../node_modules/@types/node/web-globals/streams.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/inspector.generated.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/readline/promises.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/sea.d.ts","../../node_modules/@types/node/sqlite.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/pg-types/index.d.ts","../../node_modules/pg-protocol/dist/messages.d.ts","../../node_modules/pg-protocol/dist/serializer.d.ts","../../node_modules/pg-protocol/dist/parser.d.ts","../../node_modules/pg-protocol/dist/index.d.ts","../../node_modules/@types/pg/lib/type-overrides.d.ts","../../node_modules/@types/pg/index.d.ts","../../node_modules/@types/pg/index.d.mts","../../node_modules/drizzle-orm/node-postgres/session.d.ts","../../node_modules/drizzle-orm/node-postgres/driver.d.ts","../../node_modules/drizzle-orm/node-postgres/index.d.ts","../database/src/observability/logs.ts","../database/src/observability/traces.ts","../database/src/querier.ts","../../node_modules/hono/dist/types/middleware/cors/index.d.ts","../../node_modules/zod-validation-error/v4/index.d.ts","../runtime/src/types.ts","./src/server-helper.ts","../../node_modules/hono/dist/types/middleware/body-limit/index.d.ts","../../node_modules/hono/dist/types/validator/validator.d.ts","../../node_modules/hono/dist/types/validator/index.d.ts","../../node_modules/zod/index.d.cts","../../node_modules/@blink.so/api/dist/client.node.d.ts","../database/src/convert.ts","./src/routes/chats/runs.server.ts","./src/routes/chats/steps.server.ts","./src/routes/chats/chats.server.ts","./src/routes/messages.server.ts","./src/routes/agents/me/me.client.ts","./src/routes/agents/me/me.server.ts","./src/routes/agent-request.server.ts","../blink/dist/browser/types-keN8L-ZK.d.ts","../blink/dist/browser/index.browser-BWaJSg--.d.ts","../blink/dist/browser/index-D8N1hGPv.d.ts","../blink/dist/browser/agent/client/index.d.ts","./src/routes/agents/deployments.server.ts","./src/routes/agents/env.server.ts","./src/routes/agents/logs.server.ts","./src/routes/agents/members.server.ts","./src/routes/agents/runs.server.ts","./src/routes/agents/steps.server.ts","./src/routes/agents/traces.server.ts","./src/routes/agents/agents.server.ts","../billing/src/money.ts","../billing/src/metronome.ts","../billing/src/ingest-usage-event.ts","../../node_modules/eventsource-parser/dist/index.d.ts","../../node_modules/hono/dist/types/utils/cookie.d.ts","../../node_modules/hono/dist/types/helper/cookie/index.d.ts","./src/routes/tools/compute.server.ts","./src/routes/tools/exa.server.ts","./src/routes/tools/tools.server.ts","./src/routes/ai-gateway.server.ts","../../node_modules/bcrypt-ts/dist/node.d.mts","./src/routes/auth/auth.server.ts","./src/routes/devhook.server.ts","./src/routes/files.server.ts","./src/routes/invites.server.ts","./src/routes/organizations/agents.server.ts","./src/routes/organizations/members.server.ts","./src/routes/organizations/organizations.server.ts","./src/routes/otlp/otlp.server.ts","./src/routes/users.server.ts","./src/server.ts","./src/middleware.ts","../../node_modules/drizzle-orm/postgres-js/session.d.ts","../../node_modules/drizzle-orm/postgres-js/driver.d.ts","../../node_modules/drizzle-orm/postgres-js/index.d.ts","../../node_modules/@neondatabase/serverless/index.d.mts","../../node_modules/drizzle-orm/neon-serverless/session.d.ts","../../node_modules/drizzle-orm/neon-serverless/driver.d.ts","../../node_modules/drizzle-orm/neon-serverless/index.d.ts","../database/src/postgres.ts","../database/src/test.ts","./src/test.ts","./src/middleware.test.ts","./src/server.test.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/react/index.d.ts","./src/react/use-chat.ts","./src/react/index.ts","./src/routes/agent-request.test.ts","./src/routes/ai-gateway.test-data.ts","./src/routes/ai-gateway.test.ts","./src/routes/api-keys.test.ts","./src/routes/devhook.test.ts","./src/routes/files.test.ts","./src/routes/invites.test.ts","./src/routes/messages.test.ts","./src/routes/users.test.ts","./src/routes/agents/agents.test.ts","./src/routes/agents/deployments.test.ts","./src/routes/agents/env.test.ts","./src/routes/agents/logs.test.ts","./src/routes/agents/runs.test.ts","./src/routes/agents/steps.test.ts","./src/routes/agents/traces.test.ts","./src/routes/agents/me/me.test.ts","../../node_modules/strict-event-emitter/lib/index.d.ts","../../node_modules/@open-draft/logger/lib/index.d.ts","../../node_modules/@mswjs/interceptors/lib/node/Interceptor-dc0a39b5.d.ts","../../node_modules/@mswjs/interceptors/lib/node/BatchInterceptor-cb9a2eee.d.ts","../../node_modules/@mswjs/interceptors/lib/node/index.d.ts","../../node_modules/msw/lib/core/utils/internal/isIterable.d.mts","../../node_modules/msw/lib/core/typeUtils.d.mts","../../node_modules/graphql/version.d.ts","../../node_modules/graphql/jsutils/Maybe.d.ts","../../node_modules/graphql/language/source.d.ts","../../node_modules/graphql/jsutils/ObjMap.d.ts","../../node_modules/graphql/jsutils/Path.d.ts","../../node_modules/graphql/jsutils/PromiseOrValue.d.ts","../../node_modules/graphql/language/kinds.d.ts","../../node_modules/graphql/language/tokenKind.d.ts","../../node_modules/graphql/language/ast.d.ts","../../node_modules/graphql/language/location.d.ts","../../node_modules/graphql/error/GraphQLError.d.ts","../../node_modules/graphql/language/directiveLocation.d.ts","../../node_modules/graphql/type/directives.d.ts","../../node_modules/graphql/type/schema.d.ts","../../node_modules/graphql/type/definition.d.ts","../../node_modules/graphql/execution/execute.d.ts","../../node_modules/graphql/graphql.d.ts","../../node_modules/graphql/type/scalars.d.ts","../../node_modules/graphql/type/introspection.d.ts","../../node_modules/graphql/type/validate.d.ts","../../node_modules/graphql/type/assertName.d.ts","../../node_modules/graphql/type/index.d.ts","../../node_modules/graphql/language/printLocation.d.ts","../../node_modules/graphql/language/lexer.d.ts","../../node_modules/graphql/language/parser.d.ts","../../node_modules/graphql/language/printer.d.ts","../../node_modules/graphql/language/visitor.d.ts","../../node_modules/graphql/language/predicates.d.ts","../../node_modules/graphql/language/index.d.ts","../../node_modules/graphql/execution/subscribe.d.ts","../../node_modules/graphql/execution/values.d.ts","../../node_modules/graphql/execution/index.d.ts","../../node_modules/graphql/subscription/index.d.ts","../../node_modules/graphql/utilities/TypeInfo.d.ts","../../node_modules/graphql/validation/ValidationContext.d.ts","../../node_modules/graphql/validation/validate.d.ts","../../node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.d.ts","../../node_modules/graphql/validation/specifiedRules.d.ts","../../node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts","../../node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts","../../node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts","../../node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts","../../node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts","../../node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts","../../node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts","../../node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts","../../node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts","../../node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts","../../node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts","../../node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts","../../node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts","../../node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts","../../node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts","../../node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts","../../node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts","../../node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts","../../node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts","../../node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts","../../node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts","../../node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts","../../node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts","../../node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts","../../node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts","../../node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts","../../node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts","../../node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts","../../node_modules/graphql/validation/index.d.ts","../../node_modules/graphql/error/syntaxError.d.ts","../../node_modules/graphql/error/locatedError.d.ts","../../node_modules/graphql/error/index.d.ts","../../node_modules/graphql/utilities/getIntrospectionQuery.d.ts","../../node_modules/graphql/utilities/getOperationAST.d.ts","../../node_modules/graphql/utilities/getOperationRootType.d.ts","../../node_modules/graphql/utilities/introspectionFromSchema.d.ts","../../node_modules/graphql/utilities/buildClientSchema.d.ts","../../node_modules/graphql/utilities/buildASTSchema.d.ts","../../node_modules/graphql/utilities/extendSchema.d.ts","../../node_modules/graphql/utilities/lexicographicSortSchema.d.ts","../../node_modules/graphql/utilities/printSchema.d.ts","../../node_modules/graphql/utilities/typeFromAST.d.ts","../../node_modules/graphql/utilities/valueFromAST.d.ts","../../node_modules/graphql/utilities/valueFromASTUntyped.d.ts","../../node_modules/graphql/utilities/astFromValue.d.ts","../../node_modules/graphql/utilities/coerceInputValue.d.ts","../../node_modules/graphql/utilities/concatAST.d.ts","../../node_modules/graphql/utilities/separateOperations.d.ts","../../node_modules/graphql/utilities/stripIgnoredCharacters.d.ts","../../node_modules/graphql/utilities/typeComparators.d.ts","../../node_modules/graphql/utilities/assertValidName.d.ts","../../node_modules/graphql/utilities/findBreakingChanges.d.ts","../../node_modules/graphql/utilities/typedQueryDocumentNode.d.ts","../../node_modules/graphql/utilities/resolveSchemaCoordinate.d.ts","../../node_modules/graphql/utilities/index.d.ts","../../node_modules/graphql/index.d.ts","../../node_modules/msw/lib/core/utils/matching/matchRequestUrl.d.mts","../../node_modules/msw/lib/core/HttpResponse-DGUjNQHG.d.mts","../../node_modules/msw/lib/core/utils/request/onUnhandledRequest.d.mts","../../node_modules/msw/lib/core/sharedOptions.d.mts","../../node_modules/msw/lib/core/utils/internal/Disposable.d.mts","../../node_modules/@mswjs/interceptors/lib/browser/Interceptor-af98b768.d.ts","../../node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.d.ts","../../node_modules/msw/lib/core/handlers/WebSocketHandler.d.mts","../../node_modules/msw/lib/core/SetupApi.d.mts","../../node_modules/msw/lib/core/handlers/HttpHandler.d.mts","../../node_modules/msw/lib/core/http.d.mts","../../node_modules/msw/lib/core/graphql.d.mts","../../node_modules/msw/lib/core/ws.d.mts","../../node_modules/msw/lib/core/sse.d.mts","../../node_modules/msw/lib/core/utils/handleRequest.d.mts","../../node_modules/msw/lib/core/getResponse.d.mts","../../node_modules/msw/lib/core/utils/url/cleanUrl.d.mts","../../node_modules/msw/lib/core/delay.d.mts","../../node_modules/msw/lib/core/bypass.d.mts","../../node_modules/msw/lib/core/passthrough.d.mts","../../node_modules/msw/lib/core/isCommonAssetRequest.d.mts","../../node_modules/msw/lib/core/index.d.mts","../../node_modules/type-fest/source/primitive.d.ts","../../node_modules/type-fest/source/typed-array.d.ts","../../node_modules/type-fest/source/basic.d.ts","../../node_modules/type-fest/source/observable-like.d.ts","../../node_modules/type-fest/source/union-to-intersection.d.ts","../../node_modules/type-fest/source/keys-of-union.d.ts","../../node_modules/type-fest/source/distributed-omit.d.ts","../../node_modules/type-fest/source/distributed-pick.d.ts","../../node_modules/type-fest/source/empty-object.d.ts","../../node_modules/type-fest/source/if-empty-object.d.ts","../../node_modules/type-fest/source/optional-keys-of.d.ts","../../node_modules/type-fest/source/required-keys-of.d.ts","../../node_modules/type-fest/source/has-required-keys.d.ts","../../node_modules/type-fest/source/is-never.d.ts","../../node_modules/type-fest/source/if-never.d.ts","../../node_modules/type-fest/source/unknown-array.d.ts","../../node_modules/type-fest/source/internal/array.d.ts","../../node_modules/type-fest/source/internal/characters.d.ts","../../node_modules/type-fest/source/is-any.d.ts","../../node_modules/type-fest/source/is-float.d.ts","../../node_modules/type-fest/source/is-integer.d.ts","../../node_modules/type-fest/source/numeric.d.ts","../../node_modules/type-fest/source/is-literal.d.ts","../../node_modules/type-fest/source/trim.d.ts","../../node_modules/type-fest/source/is-equal.d.ts","../../node_modules/type-fest/source/and.d.ts","../../node_modules/type-fest/source/or.d.ts","../../node_modules/type-fest/source/greater-than.d.ts","../../node_modules/type-fest/source/greater-than-or-equal.d.ts","../../node_modules/type-fest/source/less-than.d.ts","../../node_modules/type-fest/source/internal/tuple.d.ts","../../node_modules/type-fest/source/internal/string.d.ts","../../node_modules/type-fest/source/internal/keys.d.ts","../../node_modules/type-fest/source/internal/numeric.d.ts","../../node_modules/type-fest/source/simplify.d.ts","../../node_modules/type-fest/source/omit-index-signature.d.ts","../../node_modules/type-fest/source/pick-index-signature.d.ts","../../node_modules/type-fest/source/merge.d.ts","../../node_modules/type-fest/source/if-any.d.ts","../../node_modules/type-fest/source/internal/type.d.ts","../../node_modules/type-fest/source/internal/object.d.ts","../../node_modules/type-fest/source/internal/index.d.ts","../../node_modules/type-fest/source/except.d.ts","../../node_modules/type-fest/source/require-at-least-one.d.ts","../../node_modules/type-fest/source/non-empty-object.d.ts","../../node_modules/type-fest/source/non-empty-string.d.ts","../../node_modules/type-fest/source/unknown-record.d.ts","../../node_modules/type-fest/source/unknown-set.d.ts","../../node_modules/type-fest/source/unknown-map.d.ts","../../node_modules/type-fest/source/tagged-union.d.ts","../../node_modules/type-fest/source/writable.d.ts","../../node_modules/type-fest/source/writable-deep.d.ts","../../node_modules/type-fest/source/conditional-simplify.d.ts","../../node_modules/type-fest/source/non-empty-tuple.d.ts","../../node_modules/type-fest/source/array-tail.d.ts","../../node_modules/type-fest/source/enforce-optional.d.ts","../../node_modules/type-fest/source/simplify-deep.d.ts","../../node_modules/type-fest/source/merge-deep.d.ts","../../node_modules/type-fest/source/merge-exclusive.d.ts","../../node_modules/type-fest/source/require-exactly-one.d.ts","../../node_modules/type-fest/source/require-all-or-none.d.ts","../../node_modules/type-fest/source/require-one-or-none.d.ts","../../node_modules/type-fest/source/single-key-object.d.ts","../../node_modules/type-fest/source/partial-deep.d.ts","../../node_modules/type-fest/source/required-deep.d.ts","../../node_modules/type-fest/source/subtract.d.ts","../../node_modules/type-fest/source/paths.d.ts","../../node_modules/type-fest/source/pick-deep.d.ts","../../node_modules/type-fest/source/array-splice.d.ts","../../node_modules/type-fest/source/literal-union.d.ts","../../node_modules/type-fest/source/union-to-tuple.d.ts","../../node_modules/type-fest/source/omit-deep.d.ts","../../node_modules/type-fest/source/is-null.d.ts","../../node_modules/type-fest/source/is-unknown.d.ts","../../node_modules/type-fest/source/if-unknown.d.ts","../../node_modules/type-fest/source/partial-on-undefined-deep.d.ts","../../node_modules/type-fest/source/undefined-on-partial-deep.d.ts","../../node_modules/type-fest/source/readonly-deep.d.ts","../../node_modules/type-fest/source/promisable.d.ts","../../node_modules/type-fest/source/arrayable.d.ts","../../node_modules/type-fest/source/tagged.d.ts","../../node_modules/type-fest/source/invariant-of.d.ts","../../node_modules/type-fest/source/set-optional.d.ts","../../node_modules/type-fest/source/set-readonly.d.ts","../../node_modules/type-fest/source/set-required.d.ts","../../node_modules/type-fest/source/set-required-deep.d.ts","../../node_modules/type-fest/source/set-non-nullable.d.ts","../../node_modules/type-fest/source/set-non-nullable-deep.d.ts","../../node_modules/type-fest/source/value-of.d.ts","../../node_modules/type-fest/source/async-return-type.d.ts","../../node_modules/type-fest/source/conditional-keys.d.ts","../../node_modules/type-fest/source/conditional-except.d.ts","../../node_modules/type-fest/source/conditional-pick.d.ts","../../node_modules/type-fest/source/conditional-pick-deep.d.ts","../../node_modules/type-fest/source/stringified.d.ts","../../node_modules/type-fest/source/join.d.ts","../../node_modules/type-fest/source/sum.d.ts","../../node_modules/type-fest/source/less-than-or-equal.d.ts","../../node_modules/type-fest/source/array-slice.d.ts","../../node_modules/type-fest/source/string-slice.d.ts","../../node_modules/type-fest/source/fixed-length-array.d.ts","../../node_modules/type-fest/source/multidimensional-array.d.ts","../../node_modules/type-fest/source/multidimensional-readonly-array.d.ts","../../node_modules/type-fest/source/iterable-element.d.ts","../../node_modules/type-fest/source/entry.d.ts","../../node_modules/type-fest/source/entries.d.ts","../../node_modules/type-fest/source/set-return-type.d.ts","../../node_modules/type-fest/source/set-parameter-type.d.ts","../../node_modules/type-fest/source/asyncify.d.ts","../../node_modules/type-fest/source/jsonify.d.ts","../../node_modules/type-fest/source/jsonifiable.d.ts","../../node_modules/type-fest/source/find-global-type.d.ts","../../node_modules/type-fest/source/structured-cloneable.d.ts","../../node_modules/type-fest/source/schema.d.ts","../../node_modules/type-fest/source/literal-to-primitive.d.ts","../../node_modules/type-fest/source/literal-to-primitive-deep.d.ts","../../node_modules/type-fest/source/string-key-of.d.ts","../../node_modules/type-fest/source/exact.d.ts","../../node_modules/type-fest/source/readonly-tuple.d.ts","../../node_modules/type-fest/source/override-properties.d.ts","../../node_modules/type-fest/source/has-optional-keys.d.ts","../../node_modules/type-fest/source/writable-keys-of.d.ts","../../node_modules/type-fest/source/readonly-keys-of.d.ts","../../node_modules/type-fest/source/has-readonly-keys.d.ts","../../node_modules/type-fest/source/has-writable-keys.d.ts","../../node_modules/type-fest/source/spread.d.ts","../../node_modules/type-fest/source/is-tuple.d.ts","../../node_modules/type-fest/source/tuple-to-object.d.ts","../../node_modules/type-fest/source/tuple-to-union.d.ts","../../node_modules/type-fest/source/int-range.d.ts","../../node_modules/type-fest/source/int-closed-range.d.ts","../../node_modules/type-fest/source/array-indices.d.ts","../../node_modules/type-fest/source/array-values.d.ts","../../node_modules/type-fest/source/set-field-type.d.ts","../../node_modules/type-fest/source/shared-union-fields.d.ts","../../node_modules/type-fest/source/all-union-fields.d.ts","../../node_modules/type-fest/source/shared-union-fields-deep.d.ts","../../node_modules/type-fest/source/if-null.d.ts","../../node_modules/type-fest/source/words.d.ts","../../node_modules/type-fest/source/camel-case.d.ts","../../node_modules/type-fest/source/camel-cased-properties.d.ts","../../node_modules/type-fest/source/camel-cased-properties-deep.d.ts","../../node_modules/type-fest/source/delimiter-case.d.ts","../../node_modules/type-fest/source/kebab-case.d.ts","../../node_modules/type-fest/source/delimiter-cased-properties.d.ts","../../node_modules/type-fest/source/kebab-cased-properties.d.ts","../../node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts","../../node_modules/type-fest/source/kebab-cased-properties-deep.d.ts","../../node_modules/type-fest/source/pascal-case.d.ts","../../node_modules/type-fest/source/pascal-cased-properties.d.ts","../../node_modules/type-fest/source/pascal-cased-properties-deep.d.ts","../../node_modules/type-fest/source/snake-case.d.ts","../../node_modules/type-fest/source/snake-cased-properties.d.ts","../../node_modules/type-fest/source/snake-cased-properties-deep.d.ts","../../node_modules/type-fest/source/screaming-snake-case.d.ts","../../node_modules/type-fest/source/split.d.ts","../../node_modules/type-fest/source/replace.d.ts","../../node_modules/type-fest/source/string-repeat.d.ts","../../node_modules/type-fest/source/includes.d.ts","../../node_modules/type-fest/source/get.d.ts","../../node_modules/type-fest/source/last-array-element.d.ts","../../node_modules/type-fest/source/global-this.d.ts","../../node_modules/type-fest/source/package-json.d.ts","../../node_modules/type-fest/source/tsconfig-json.d.ts","../../node_modules/type-fest/index.d.ts","../../node_modules/msw/lib/core/handlers/RequestHandler.d.mts","../../node_modules/msw/lib/node/index.d.mts","./src/routes/auth/auth.server.test.ts","./src/routes/auth/auth.test.ts","./src/routes/chats/chats.test.ts","./src/routes/chats/runs.test.ts","./src/routes/chats/steps.test.ts","./src/routes/organizations/agents.test.ts","./src/routes/organizations/members.test.ts","./src/routes/organizations/organizations.test.ts","./src/routes/otlp/convert.test.ts","./src/routes/otlp/otlp.test.ts","./src/routes/otlp/gen/opentelemetry/proto/logs/v1/logs_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/metrics/v1/metrics_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/profiles/v1development/profiles_pb.ts","./src/routes/otlp/gen/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.ts","./src/routes/tools/exa.test.ts","./src/util/chat.ts","../../node_modules/@types/aria-query/index.d.ts","../../node_modules/@types/aws-lambda/common/api-gateway.d.ts","../../node_modules/@types/aws-lambda/common/cloudfront.d.ts","../../node_modules/@types/aws-lambda/handler.d.ts","../../node_modules/@types/aws-lambda/trigger/alb.d.ts","../../node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts","../../node_modules/@types/aws-lambda/trigger/api-gateway-authorizer.d.ts","../../node_modules/@types/aws-lambda/trigger/appsync-resolver.d.ts","../../node_modules/@types/aws-lambda/trigger/autoscaling.d.ts","../../node_modules/@types/aws-lambda/trigger/cloudformation-custom-resource.d.ts","../../node_modules/@types/aws-lambda/trigger/cdk-custom-resource.d.ts","../../node_modules/@types/aws-lambda/trigger/cloudfront-request.d.ts","../../node_modules/@types/aws-lambda/trigger/cloudfront-response.d.ts","../../node_modules/@types/aws-lambda/trigger/cloudwatch-alarm.d.ts","../../node_modules/@types/aws-lambda/trigger/eventbridge.d.ts","../../node_modules/@types/aws-lambda/trigger/cloudwatch-events.d.ts","../../node_modules/@types/aws-lambda/trigger/cloudwatch-logs.d.ts","../../node_modules/@types/aws-lambda/trigger/codebuild-cloudwatch-state.d.ts","../../node_modules/@types/aws-lambda/trigger/codecommit.d.ts","../../node_modules/@types/aws-lambda/trigger/codepipeline.d.ts","../../node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-action.d.ts","../../node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-pipeline.d.ts","../../node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-stage.d.ts","../../node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/_common.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/create-auth-challenge.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-email-sender.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-message.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-sms-sender.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/define-auth-challenge.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-authentication.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-confirmation.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-authentication.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-signup.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation-v2.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation-v3.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/user-migration.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/verify-auth-challenge-response.d.ts","../../node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts","../../node_modules/@types/aws-lambda/trigger/connect-contact-flow.d.ts","../../node_modules/@types/aws-lambda/trigger/dynamodb-stream.d.ts","../../node_modules/@types/aws-lambda/trigger/guard-duty-event-notification.d.ts","../../node_modules/@types/aws-lambda/trigger/iot.d.ts","../../node_modules/@types/aws-lambda/trigger/iot-authorizer.d.ts","../../node_modules/@types/aws-lambda/trigger/kinesis-firehose-transformation.d.ts","../../node_modules/@types/aws-lambda/trigger/kinesis-stream.d.ts","../../node_modules/@types/aws-lambda/trigger/lambda-function-url.d.ts","../../node_modules/@types/aws-lambda/trigger/lex.d.ts","../../node_modules/@types/aws-lambda/trigger/lex-v2.d.ts","../../node_modules/@types/aws-lambda/trigger/amplify-resolver.d.ts","../../node_modules/@types/aws-lambda/trigger/msk.d.ts","../../node_modules/@types/aws-lambda/trigger/s3.d.ts","../../node_modules/@types/aws-lambda/trigger/s3-batch.d.ts","../../node_modules/@types/aws-lambda/trigger/s3-event-notification.d.ts","../../node_modules/@types/aws-lambda/trigger/secretsmanager.d.ts","../../node_modules/@types/aws-lambda/trigger/self-managed-kafka.d.ts","../../node_modules/@types/aws-lambda/trigger/ses.d.ts","../../node_modules/@types/aws-lambda/trigger/sns.d.ts","../../node_modules/@types/aws-lambda/trigger/sqs.d.ts","../../node_modules/@types/aws-lambda/trigger/transfer-family-authorizer.d.ts","../../node_modules/@types/aws-lambda/index.d.ts","../../node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__generator/index.d.ts","../../node_modules/@babel/types/lib/index.d.ts","../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__template/node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/index.d.ts","../../node_modules/@types/babel__traverse/index.d.ts","../../node_modules/@types/babel__core/index.d.ts","../../node_modules/@types/connect/index.d.ts","../../node_modules/@types/body-parser/index.d.ts","../../node_modules/bun-types/globals.d.ts","../../node_modules/bun-types/s3.d.ts","../../node_modules/bun-types/fetch.d.ts","../../node_modules/bun-types/bun.d.ts","../../node_modules/bun-types/extensions.d.ts","../../node_modules/bun-types/devserver.d.ts","../../node_modules/bun-types/ffi.d.ts","../../node_modules/bun-types/html-rewriter.d.ts","../../node_modules/bun-types/jsc.d.ts","../../node_modules/bun-types/sqlite.d.ts","../../node_modules/bun-types/vendor/expect-type/utils.d.ts","../../node_modules/bun-types/vendor/expect-type/overloads.d.ts","../../node_modules/bun-types/vendor/expect-type/branding.d.ts","../../node_modules/bun-types/vendor/expect-type/messages.d.ts","../../node_modules/bun-types/vendor/expect-type/index.d.ts","../../node_modules/bun-types/test.d.ts","../../node_modules/bun-types/wasm.d.ts","../../node_modules/bun-types/overrides.d.ts","../../node_modules/bun-types/deprecated.d.ts","../../node_modules/bun-types/redis.d.ts","../../node_modules/bun-types/shell.d.ts","../../node_modules/bun-types/experimental.d.ts","../../node_modules/bun-types/sql.d.ts","../../node_modules/bun-types/security.d.ts","../../node_modules/bun-types/bun.ns.d.ts","../../node_modules/bun-types/index.d.ts","../../node_modules/@types/bun/index.d.ts","../../node_modules/@types/bunyan/index.d.ts","../../node_modules/keyv/src/index.d.ts","../../node_modules/@types/http-cache-semantics/index.d.ts","../../node_modules/@types/responselike/index.d.ts","../../node_modules/@types/cacheable-request/index.d.ts","../../node_modules/@types/cardinal/lib/highlight.d.ts","../../node_modules/@types/cardinal/lib/highlightFile.d.ts","../../node_modules/@types/cardinal/lib/highlightFileSync.d.ts","../../node_modules/@types/cardinal/index.d.ts","../../node_modules/@types/configstore/index.d.ts","../../node_modules/@types/d3-array/index.d.ts","../../node_modules/@types/d3-selection/index.d.ts","../../node_modules/@types/d3-axis/index.d.ts","../../node_modules/@types/d3-brush/index.d.ts","../../node_modules/@types/d3-chord/index.d.ts","../../node_modules/@types/d3-color/index.d.ts","../../node_modules/@types/geojson/index.d.ts","../../node_modules/@types/d3-contour/index.d.ts","../../node_modules/@types/d3-delaunay/index.d.ts","../../node_modules/@types/d3-dispatch/index.d.ts","../../node_modules/@types/d3-drag/index.d.ts","../../node_modules/@types/d3-dsv/index.d.ts","../../node_modules/@types/d3-ease/index.d.ts","../../node_modules/@types/d3-fetch/index.d.ts","../../node_modules/@types/d3-force/index.d.ts","../../node_modules/@types/d3-format/index.d.ts","../../node_modules/@types/d3-geo/index.d.ts","../../node_modules/@types/d3-hierarchy/index.d.ts","../../node_modules/@types/d3-interpolate/index.d.ts","../../node_modules/@types/d3-path/index.d.ts","../../node_modules/@types/d3-polygon/index.d.ts","../../node_modules/@types/d3-quadtree/index.d.ts","../../node_modules/@types/d3-random/index.d.ts","../../node_modules/@types/d3-time/index.d.ts","../../node_modules/@types/d3-scale/index.d.ts","../../node_modules/@types/d3-scale-chromatic/index.d.ts","../../node_modules/@types/d3-shape/index.d.ts","../../node_modules/@types/d3-time-format/index.d.ts","../../node_modules/@types/d3-timer/index.d.ts","../../node_modules/@types/d3-transition/index.d.ts","../../node_modules/@types/d3-zoom/index.d.ts","../../node_modules/@types/d3/index.d.ts","../../node_modules/@types/ms/index.d.ts","../../node_modules/@types/debug/index.d.ts","../../node_modules/@types/doctrine/index.d.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/estree-jsx/index.d.ts","../../node_modules/@types/mime/index.d.ts","../../node_modules/@types/send/index.d.ts","../../node_modules/@types/qs/index.d.ts","../../node_modules/@types/range-parser/index.d.ts","../../node_modules/@types/express-serve-static-core/index.d.ts","../../node_modules/@types/http-errors/index.d.ts","../../node_modules/@types/serve-static/index.d.ts","../../node_modules/@types/express/index.d.ts","../../node_modules/@types/fs-extra/index.d.ts","../../node_modules/minimatch/dist/commonjs/ast.d.ts","../../node_modules/minimatch/dist/commonjs/escape.d.ts","../../node_modules/minimatch/dist/commonjs/unescape.d.ts","../../node_modules/minimatch/dist/commonjs/index.d.ts","../../node_modules/@types/glob/index.d.ts","../../node_modules/@types/tinycolor2/index.d.ts","../../node_modules/@types/gradient-string/index.d.ts","../../node_modules/@types/unist/index.d.ts","../../node_modules/@types/hast/index.d.ts","../../node_modules/@types/html-to-text/lib/block-text-builder.d.ts","../../node_modules/@types/html-to-text/index.d.ts","../../node_modules/@types/jsonwebtoken/index.d.ts","../../node_modules/@types/keyv/index.d.ts","../../node_modules/@types/marked-terminal/node_modules/marked/lib/marked.d.ts","../../node_modules/@types/marked-terminal/node_modules/chalk/source/vendor/ansi-styles/index.d.ts","../../node_modules/@types/marked-terminal/node_modules/chalk/source/vendor/supports-color/index.d.ts","../../node_modules/@types/marked-terminal/node_modules/chalk/source/index.d.ts","../../node_modules/@types/marked-terminal/node_modules/marked/lib/marked.d.cts","../../node_modules/@types/marked-terminal/index.d.cts","../../node_modules/@types/marked-terminal/index.d.ts","../../node_modules/@types/mdast/index.d.ts","../../node_modules/@types/memcached/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/mysql/index.d.ts","../../node_modules/@types/normalize-package-data/index.d.ts","../../node_modules/@types/oracledb/index.d.ts","../../node_modules/@types/pg-pool/index.d.ts","../../node_modules/@types/retry/index.d.ts","../../node_modules/@types/proper-lockfile/index.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/react-syntax-highlighter/node_modules/@types/react/global.d.ts","../../node_modules/@types/react-syntax-highlighter/node_modules/@types/react/index.d.ts","../../node_modules/@types/react-syntax-highlighter/index.d.ts","../../node_modules/@types/resolve/index.d.ts","../../node_modules/@types/statuses/index.d.ts","../../node_modules/@types/tar-stream/index.d.ts","../../node_modules/@types/tedious/index.d.ts","../../node_modules/@types/trusted-types/lib/index.d.ts","../../node_modules/@types/trusted-types/index.d.ts","../../node_modules/configstore/index.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/primitive.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/typed-array.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/basic.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/observable-like.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/internal.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/except.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/simplify.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/writable.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/mutable.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/merge.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/merge-exclusive.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/require-at-least-one.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/require-exactly-one.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/require-all-or-none.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/remove-index-signature.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/partial-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/partial-on-undefined-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/readonly-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/literal-union.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/promisable.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/opaque.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/invariant-of.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/set-optional.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/set-required.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/set-non-nullable.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/value-of.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/promise-value.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/async-return-type.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/conditional-keys.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/conditional-except.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/conditional-pick.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/union-to-intersection.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/stringified.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/fixed-length-array.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/multidimensional-array.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/multidimensional-readonly-array.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/iterable-element.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/entry.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/entries.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/set-return-type.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/asyncify.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/numeric.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/jsonify.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/schema.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/literal-to-primitive.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/string-key-of.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/exact.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/readonly-tuple.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/optional-keys-of.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/has-optional-keys.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/required-keys-of.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/has-required-keys.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/spread.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/split.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/camel-case.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/camel-cased-properties.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/camel-cased-properties-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/delimiter-case.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/kebab-case.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/delimiter-cased-properties.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/kebab-cased-properties.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/kebab-cased-properties-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/pascal-case.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/pascal-cased-properties.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/pascal-cased-properties-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/snake-case.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/snake-cased-properties.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/snake-cased-properties-deep.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/includes.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/screaming-snake-case.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/join.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/trim.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/replace.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/get.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/last-array-element.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/package-json.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/source/tsconfig-json.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/node_modules/type-fest/index.d.ts","../../node_modules/cli-boxes/index.d.ts","../../node_modules/@types/update-notifier/node_modules/boxen/index.d.ts","../../node_modules/@types/update-notifier/update-notifier.d.ts","../../node_modules/@types/update-notifier/index.d.ts","../../node_modules/@types/use-sync-external-store/index.d.ts","../../node_modules/@types/whatwg-mimetype/index.d.ts","../../node_modules/@types/ws/index.d.ts","../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"71cf8049ea8d435bcdf47408dac2525c","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"24660545bd04f64286946ca58f9461fc","impliedNodeFormat":99},{"version":"006807822602069b83b496ad7e25e6ca","impliedNodeFormat":99},{"version":"4d9b146f28d6be2c3542b08b595febfe","impliedNodeFormat":99},{"version":"455ea9b314b4d327c535fb65bd954959","impliedNodeFormat":99},{"version":"c079fccc6ede08aa4f8ca702c3ba328e","impliedNodeFormat":99},{"version":"c349310240662575d10e855fb8cff0b9","impliedNodeFormat":99},{"version":"4ccba7d48aa8b5a54b56f9a48b076496","impliedNodeFormat":99},{"version":"92ef9b8df31d3a08512928a3066d8fa9","impliedNodeFormat":99},{"version":"43f782dfe0cfccc03603dff6d7ffbe56","impliedNodeFormat":99},{"version":"af52c5f9c7d4f8a91e85748a8ab9c442","impliedNodeFormat":99},{"version":"1bd73602c7001221ecdb45a83c47f811","impliedNodeFormat":99},{"version":"9cf691967d2e0b0210f5864fdf1ad87a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"8485851ca9672f7054ee1193bc9229b5","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"751a26973b059fed1d0ecc4b02a0aa43","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"be28f9bf546cb528601aaa04d7034fc8","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"3bc4e9a53ee556f3dc15abc1179278dd","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2c63fa39e2cdd849306f21679fdac8b1","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e1a9f024b1a69565194afcdb4b57ef1d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"9fa1fffd5b2b67d8d8c33e295cb91a9f","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4d8ab857b044eaa0661bd0aebebc038b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"748df784ad0b12a20c5f5ce011418c3c","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"1f3a8dca322a95bc3ffc20a28e72893a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"d901677b09e934598f913e2c05f827b0","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"ab7a40e3c7854c54c6f329376cf3f9b6","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"00ece0060faf280c5873f3cfe62d7d19","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"cf5a418e3fbdb27a784c5fc37be6797a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"a73a6f599fda19ffee929d4386bab691","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"14475f4288b8cf4a098c2806834a1c0b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"fbae9331a88fa1a8a336fe90253cbbc7","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"d4124f01474cfa693099d8be321979e4","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e3e80cf65ee855fd4a5813ea19701f93","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"cd8650f4caf8166f19fd93217907da21","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c39604220a24016cb90fe3094a6b4b56","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2652c52b1c748791681ca0a4d751b09b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"9540816cf2a3418a9254e43f1055e767","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"f9616d828e6afe0f8146e9ac3b33fa59","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4f00a6f131995907fe9b0faf4dbabc18","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"47f85dd672027fda65064cbfee6b2d71","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"8adddec358b9acfa3d65fd4d2013ac84","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"8170fe225cf3b8b74c06f1fe8913924f","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c9dbd0e301b2bd8fc6d5dcb75dc61ec4","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"3a64170086e7ddb980f07478f95f7c49","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"a804e69080dc542b8de4079fdde7ebef","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"783d6e41b4c30cc983d131b2f413044a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"11b11ae792c173835b03d064a0853462","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4cdc220ae24b55dcc69d30252c36ce9d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"36fd93eca51199e9dfee76d7dbbf2719","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"7fc46463d5c6871146e3aac105f21a2d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"21ed16210f33f30f1e2df6dd5bc584d9","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"b2d1055a33f1612669aed4b1c06ab438","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"6779bb060769fcc1b3063d7d6dacca83","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"5de91aed11cf11bbf79c2323600f2a28","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2843d76b135201d1ba75d56f45238760","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"98afe632d712655c371691bc02dd15f8","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e33a3b1212a9f61f3d7229e068573681","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2be269e94382bba86f42d7d4109c6ddc","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"045bc80bcb8ba75cf56e2c9af4636a06","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"5c327c3a580ef35777e7f2b97b6b23e4","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"9965653fed0cc40aff9f23e6250e449a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"3f0224f4e28ecc5c714451c6fe9ed637","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"31bf9dad4e4564649a923b1f8e9fe016","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"ab498520bb087228060205c259f9f1db","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2ed49ae6f083c5ceea392013d5500bd1","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4f1fc94e4ceefdf65dfae80b7ca74761","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"bb0f36efb1ca5ac2c05b884ea9eb300d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e7e8f73cc8fbc557946f3c599af084dd","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c108a3fdbc1f311f3505db4b5d6d4311","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"bf2ba43f37aefa733d387c1b1477906b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"b5af3bd27050b2af3ba57b2b37f431f6","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"91cfeba82a5dd4c400c77ab8b5af4bc7","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"0ddc167cfc604225cb84a9620926049e","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"f244cb057e35de9b71f7d2e330a684dc","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"6ff13a1f4d84ba0dfb73813250150f0a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c277a50101d5ab0655c320101c70d3a2","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"815784e3a8d0d7682680536b3f7a25bc","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"59ae3ec3878ab72bfbfb82c7593d3a52","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"43bb073f85094030dbdac6036ec860d0","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"142e3750ad8fcff9893edc2eed0affcb","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"75f52d5da55e5899f01782e3b911d988","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"45c91c5f844a9ee1df11d1b71c484b0e","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"39e009135c77d60baa790854b51d2195","affectsGlobalScope":true,"impliedNodeFormat":99},"75af214146a5669542c74170d8ba1426","bbaa64d11b49a5511f78feed2948117a","ca12d9dc1a997586508bec402fd3ab75","f4a7721bb7864b0587a34eac21bdfb9f",{"version":"df5dfe46e135b8e5d3fc4f7a2dd7dc45","affectsGlobalScope":true,"impliedNodeFormat":1},"e7943b38d409d884a588b81e9498b7ee","2685d6050222c030d8880cc283a9997d","5f65afd424d50de7f939dadc91ee7bbe","3333247facc8903d90a9b006f2c60f89","899f5bd6f280315dacce7b3e90e44c9e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","07a970ee7c3ff3c7e5c52d238d62c520","07a970ee7c3ff3c7e5c52d238d62c520","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","07a970ee7c3ff3c7e5c52d238d62c520","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","561f804466f205f73f3cc4c59baf01a8","858e55326c7b6438e6e28307dc831ffd","cdd02c041a3cc6361fe7c287727433c1","907ae20c7c3f1ac9cad51295a5490530","20220050d20ec9dcc49650b0ae7ae6f7","1cf58e1a20498dcb6cbcc8bc7947af7b","1eea9456ee5717b119c17e90b684fcc7","bb6bec8f299bdf7197d23f9717be2a66","1cc59f020b9d62d875bdb28a6e2f745b","85035df3c3e673ced76f6e81e8011815","3cb6ae40a0ec69a4917962acac1d747f","008a044437730ef792d0f178852a0d7d","2ec272900a05d1b72baff78e2ac4b5a8","dec40354e62d8ca81f5996c1760bc6da","a9356de7c324c6f49c15587032b1f65f","11438b42a23b61e96b102fe60b2ee256","f06e385eca707a7f458b12579fac7033","36e44d66b242e6176176dc6d1ee825ea",{"version":"c70b0e85544d842e2cc497fd996ae1e9","impliedNodeFormat":99},"103e91984cbc1b6f8710542be58cb09a","f4ebcc7392593490ac52d69171b544ab","616fdc342e5f30cb0aa90f69441ddca0","78cdd7d6fcc343136ba8b52ed754a971","26cc32869d8b950cb0f0d526a824d646","fd743101a978158919239001d8f2ba49","3d09c4a71884a36bfa2d0ca10e69e75b","c8468714a3d17fcb54967665fc0a1827","6f2a7f08d2b896e6ea3fcc050752727a","a181e2f4e0ea142154934acab40f62a9","259d920dfff27dfba05c2475a1a8c877","af3e7ccf973e817d2c0f3d1d51b397a3","db8be451ca85c5aed9d98b490abd8a4b",{"version":"3f40f3dfae7ab4804f5fe218adcf70ef","impliedNodeFormat":99},"46299aac8bfa2b32c00bba1ebf58932f","bbaa64d11b49a5511f78feed2948117a","5b9b11013c6d2710f34a99a9832abfa3","a33ec838d3afa0053a989cc843be3c26","904c558da6cb62827fab0494f676d985","b53e5eafe089103ad7be4f243fb517d4","ebb3a0af4d6e917f467ec795b2e899bd","b77e4c0f4f6658a5315c206e2035354c","2b76267afeb2e83dff758e3fba2faa8a","662eae47724ed2ca873fb608034d0645","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","eded9cbb38a7e6d17d9014675f81cef8","daada721cfdc43aa8e7c2e2d14d760de","a21f1b172546b6a64cc7ddea394b54ea","d695b3ee3257a30539a09560afac31a5","5f3c015bce4302b247acedb9ec20e302","b3d7ae3cb2ed173b11f2d2d7bcbd1a4d","737c96105c8743cd1dcfd7fe8183430d","1cc59f020b9d62d875bdb28a6e2f745b","a06c5977df8ff3f289f16a7505c8d539","c7b6d357255c49e69b2798e7ae4b8f84","f04158c558df8c51d46a1fb44c832c1c","d1ab6402ad42100de1cf3f5d15aa9d27","dec40354e62d8ca81f5996c1760bc6da","a9356de7c324c6f49c15587032b1f65f","e04f60dec493fd81dd3c785d6c0682ce","ec7a3f5e189221b1a18bed55a592c89d","96bd5e12ec79916d7679da2de1ce52bb","cf25a3ee33909f413bc7c54332a67862","da7bfefe2fc9e8e0585731eae593e999","f21b0cac1cc1660f03100c19ea5ad6ce","f05941b4badccad76dc807153120ed1a","da251217111629b56efd856cdeac0a31","87be01ef252a07d166177fd7bfe24419","759f36640d607a4021e79357319dab37","ef54e30ca5824492e5f5c3a5549a3b2d","b628ec4c4df8862128859ee28c186a8a","f1926e0c00597a969ec6df9cbdd0f9de","0a32685184e03cd5b84c25f017bd3c17","33560758617c74c8ec9de02a119176e1","f23b096393b50a79a71cc701e637e88f","d25d4164a5ee91cf9565ff58bc11192b","c60cb8c3b549dfedb0b4c7a9102b9a2e","f5340529f334aeda48e0d1acc719ac2e","76efa1ec64fd885c3acef57e5af814cf","43daa9bd5e906ae3abb8cbcb74c69e78","8c3fbeeb80bf925163d2b605ce8a1c19","87c8a1975886c9695cf89841fb8322df","0c3be1780884a15e39b84633040d69d4","8bea0b0e309a3323272cd69dc2c124fa","463b87882610ef829309c1295d7a7202","43e9f729349175eb07e72ba6be849299","209ab7e32d80320d6bccc7862640e9a0","8f74e9826719670e9937c08eeff088ea","ab16dd88cbfff339c3edead904b6e470","a684f053c33dd09551b22bd5bc0dc30c","974744772966eb6eb67a536714686f5b","1f0a0f2fa5f7530b91a8052a8577b646","d70dff8f11e6b3e716f8e0bf19bcf855","0800f7f1fbbd0f4f4eaa0e505250e21d","643d3c0db96562dec0a80d2ba7df8353","c665788419f40e45c4ec32a3bb8dadb3","4fb4e7528259d93edb4b01d8ca1ea8f5","c162c8659840769f65ee9f8f1327c584","ccb396a398b985ea2e0d45bdc0052244","e3105e2112412126bfa3963de197ff74","2cd29888220b1a60b567e245398a766d","0e85c9ec9ebee83469cf4507c3cf4b2c","6826fe2b1104a1a76927ea4e79b08a8d","b2c555fb57de20e58df2c31b79ed4f99","20e347e26d36ddeb125e4acbc1970d5c","b3de58dade44970fbdde37d2770b3ce5","db902331ca29dac243f752e0fa815d6a","78b093712b6a30c0c0e0c968e2707cc1","e9d7e6b7d30ece2bc321521312f0d32c","42f064a7909385742496a84508847f61","4e89eeecdd77fb0529ab0e34eddcc139","a802149f1013baadb8a502f3baeae587","a8a50c5544d675a1c98d68ab9d95efa2","733727567a3ca2b6be10a1957f9165f1",{"version":"fb4513dc923a4aaba7a12c80431292ce","affectsGlobalScope":true,"impliedNodeFormat":1},"5672b8859ea1487b5344140b9c11f020","b0233544d7eb27e2b3e75f22fa7ef8cc","96bd952d0511e7128d68ddb50b446004","1481c34e5d10f570b8e478279362c392","ce4c9f1142c3c21a79f6d3ecd9c01f06","f45f47e4821610b33f86fd770ba47aa4","526145d96c3d16c13a5b736e0bffbb73","0ce920bb95c98bfc18b9bc6312cb8e38","9afab2b97479bd1ef668c8ae03c498ce","11d1b1a77e7f929d19971b36b3f2b7c7","8d0429f85301b72db55a275e395ab6d3","cc4dc43d7dba264246cf79a4829160fc","d1a82e2f68380792f316bfeb3e7013de","af01c555133a36f327121d0114982c33","a058200038281fa99d43dcd69e5fc64a",{"version":"62a67f3a8120709289227e5be308c10a","impliedNodeFormat":99},{"version":"8a8b2d5deca54d839dc693340434d782","impliedNodeFormat":99},{"version":"cccbe878cb7b9afc128a4a8e53e85d13","impliedNodeFormat":99},{"version":"e0605615ad5e676614a7fc0b3c7ecfff","impliedNodeFormat":99},{"version":"1becc1e19e851ad836d596f8434d3271","impliedNodeFormat":99},{"version":"8c5237669908f99ab24e38cd357da8c4","impliedNodeFormat":99},{"version":"16e451df6c7027c0855a1a2580456c1f","impliedNodeFormat":99},{"version":"11dacada23b9870ea4ff568ba98c4768","impliedNodeFormat":99},{"version":"245d64ea96096b7f3816492e621e8699","impliedNodeFormat":99},{"version":"2d9dd7c7c861507b59e60a0f7369fc64","impliedNodeFormat":99},{"version":"25370c36608ecb290e8e151eaba407a7","impliedNodeFormat":99},{"version":"02695cf4366044943228470e15e6083e","impliedNodeFormat":99},{"version":"8b146f4737056970bda55b3b664c3f1a","impliedNodeFormat":99},{"version":"ce3aa97a4d695082064b97259f278851","impliedNodeFormat":99},{"version":"b9dc2507202435ef128a7bda60bbf683","impliedNodeFormat":99},{"version":"4c8d390f052d2d99305f1263eb8bb06e","impliedNodeFormat":99},{"version":"bbced735f7d244b222537b7d21665a4b","impliedNodeFormat":99},{"version":"ba4640773fedc12deb937e4ca3e84939","impliedNodeFormat":99},{"version":"91dc486bc33ecac4af3c03434a514a11","impliedNodeFormat":99},{"version":"f75e91de0227c5b01ded6e9e69486921","impliedNodeFormat":99},{"version":"c83063ee05d8171087cf38ccbb29d77c","impliedNodeFormat":99},{"version":"17cc16422dc68cc5e68bdaf3821f1984","impliedNodeFormat":99},{"version":"f04e510d59c58ee735277d0bba804fb6","impliedNodeFormat":99},{"version":"47325513ca94a5aa1057ec674fff7567","impliedNodeFormat":99},{"version":"ef5f316934345b96cf0eb6b7919db50c","impliedNodeFormat":99},{"version":"bfa33b3094f0b391476240a90d77f975","impliedNodeFormat":99},{"version":"8687f8b4c9fd660886061a97edfdd0a9","impliedNodeFormat":99},{"version":"1bc707bd6701c9a8c6fd0c88f0ce6931","impliedNodeFormat":99},{"version":"90e188f809022533ec9532cbdf623cb9","impliedNodeFormat":99},{"version":"eab00d49dbad942fa647dc0e0ff50743","impliedNodeFormat":99},{"version":"cd7f924167b0a3ce5aa9629784fc6aab","impliedNodeFormat":99},{"version":"9db2b28f411bf9fa76367548da795895","impliedNodeFormat":99},{"version":"38b058d0bb233d750cc55e4ceb7501f0","impliedNodeFormat":99},{"version":"af221a73f9b97f78f377f294d10a86dc","impliedNodeFormat":99},{"version":"054af8d05b48e3617c2d17b2128d143c","impliedNodeFormat":99},{"version":"402cabd2a26e5d484927b338c28bafbf","impliedNodeFormat":99},"e6b7f00fa140dbb8fafe40e6cee34286",{"version":"382cd17f11a0c451277fad1346d29186","impliedNodeFormat":99},{"version":"8109244f814ec5158d6be767cd6a177a","impliedNodeFormat":99},{"version":"ee984dfeb210e48f3eb3da30056ef60a","impliedNodeFormat":99},{"version":"ec95180c7b518ffe251dd3c0eed5434f","impliedNodeFormat":99},{"version":"d7c7eaef25eb17593cb243645f87ea9b","impliedNodeFormat":99},{"version":"d35a9115e33b7acfad63c267755498f8","impliedNodeFormat":99},{"version":"1bcd650858a7a3e2f040ce0ca875e7bd","impliedNodeFormat":99},{"version":"4f55e08d99a9cf6a835fa37eb746670d","impliedNodeFormat":99},{"version":"33d6f414aa26e190c91ea17f616589fe","impliedNodeFormat":99},{"version":"3137c6cf441455cb175b0eadcb0ad8a6","impliedNodeFormat":99},"9cedafca8812ddc9031011997919d8f8","7692924c06be97d56dd20d6501ba77a2","c4cee6ba3b9db6d81cc40343095bd9ca","e16fc34a994baa7486c6b98f82f3e424","f443759315f4f6b17344b00f2aebfcaf","a7ae20fdb32308ec8118b0a344bd5710","993d3d9422e7b14ce0e0be532632ead4","a4c782c415b268144728d43a877da724","8f8aabaa555db49c417bb0bfc3dda465","54403e3af011d6d5736f5ac2168303f4","37d4d4722da7f700a6c01d52a88a0780","3f3eb6a993610722a7ccff2717c285f4",{"version":"ca4f88a96405c804f5495d1c4a1a4ab3","signature":"d01848a4bdf09c37c3dfb589b5ce93a9","impliedNodeFormat":1},"723ec2668f37f6ba3d82b3211486be96","6dea6a05551d7b426d37eee7f8a48998","df4c4949af33641d6345e077659cc26b","729276f204af7b8d5fe274e7a67c7043","e81eff0561aa42dc659c665609deaa4f","f897c8e842d2e8eec30acc4d79f1c68a","073a8b27119322961a035a79291a505a","aa41e27d2de5e6fc1a0e600e4ec4e182","eaf576958a7cfe1b174e88c36f46b10e","0de5de48793d4849a34bde012ba9e5f0","f9d16c4caf4f08ac576134c42b092b07","4b8940d74c778cf0f932627ef8d8cfdf","2535b342c241ef37934a42c70ffa0412","dce04013f3791a607b3a37efa8da16a5",{"version":"693c27f12cf61f3ce4740c1c9728b2a4","signature":"7929756de8b45766c504b7019dd854fc","impliedNodeFormat":1},"bbaa64d11b49a5511f78feed2948117a","5b9b11013c6d2710f34a99a9832abfa3","a33ec838d3afa0053a989cc843be3c26","904c558da6cb62827fab0494f676d985","b53e5eafe089103ad7be4f243fb517d4","ebb3a0af4d6e917f467ec795b2e899bd","b77e4c0f4f6658a5315c206e2035354c","2b76267afeb2e83dff758e3fba2faa8a","662eae47724ed2ca873fb608034d0645","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","eded9cbb38a7e6d17d9014675f81cef8","daada721cfdc43aa8e7c2e2d14d760de","a21f1b172546b6a64cc7ddea394b54ea","d695b3ee3257a30539a09560afac31a5","5f3c015bce4302b247acedb9ec20e302","b3d7ae3cb2ed173b11f2d2d7bcbd1a4d","737c96105c8743cd1dcfd7fe8183430d","1cc59f020b9d62d875bdb28a6e2f745b","a06c5977df8ff3f289f16a7505c8d539","c7b6d357255c49e69b2798e7ae4b8f84","f04158c558df8c51d46a1fb44c832c1c","d1ab6402ad42100de1cf3f5d15aa9d27","dec40354e62d8ca81f5996c1760bc6da","a9356de7c324c6f49c15587032b1f65f","e04f60dec493fd81dd3c785d6c0682ce","ec7a3f5e189221b1a18bed55a592c89d","6c528c765a73009890ab2b7da78818ac","57a4f24cb0d115c4b63a361727798794","4f53464e24c20570df7f23002a321ca7","04e44450f1bc7f25b84524ed0a0a7b95","518b8111106987397ac0cf9ddd0ca0a1","275f1804a407be7658d6835d8a7b00dd","2d2de5fb8e2d8d68cd70049fff2a3b1f","1914c9735462c6dc79947e3850bb0bc4","9412f7dd2bd6db22b3e45babc49fa9be","17d5338af953775756cf1bc3e03057f1","25dcc9b2bcf13ffe89a86152eeaeb488","68c56bcaa4ef20ebaa912a081f6cf165","4d7a128b52e320c0dedf1f739d6bd3fb","544bc37c9ca1dff3d09a081757ca0540",{"version":"31f07bde14ebbb2713f8783cfa0c273b","impliedNodeFormat":99},{"version":"ea5291477315dfd3ee2f5b0b6dcd56f6","impliedNodeFormat":99},{"version":"7a28cfc6db1de4c36567717cb2c0c2bd","impliedNodeFormat":99},{"version":"1dba4766d338d4506868ff86dc3e5f02","impliedNodeFormat":99},{"version":"89da1b5a153b9206d3f6859d738d63ea","impliedNodeFormat":99},{"version":"71995c49ebe073b4616af907aa1e16c4","impliedNodeFormat":99},{"version":"8226db1a93549ba98a2693b8369dae64","impliedNodeFormat":99},"e8f08b002941f6d87b1e9ca64a443e42","d56fd819e4780cd02665342e4e3a3064",{"version":"c1ded7597c41588046e95c8874d25494","impliedNodeFormat":99},{"version":"33fd5f0affe2be46c4ffb0e84e160208","impliedNodeFormat":99},{"version":"a5f5f30dd85a37a680d291d49c53d602","impliedNodeFormat":99},{"version":"f17d8fc8242dce89af9f0c12863f102e","impliedNodeFormat":99},{"version":"6c8be5ba744175c78cf6241796932dee","impliedNodeFormat":99},{"version":"244ad2becb3ad5c5f98463ea0725b238","impliedNodeFormat":99},{"version":"9cfbd07a016ca09c104051685e9a3784","impliedNodeFormat":99},{"version":"3e14d31a22696ce97f338881e4dfc08e","impliedNodeFormat":99},{"version":"f158befb6cef0a5f1a1f16c4b08c3929","impliedNodeFormat":99},{"version":"19c371e835a95fff444e5724ae0a78c9","impliedNodeFormat":99},{"version":"421b2cfcb8ac95d292250f6064249d5c","impliedNodeFormat":99},{"version":"d8a3f0ecb939bfa535f612f1c4204289","impliedNodeFormat":99},{"version":"6c6d1447ba679d0d682733dc6177a6fc","impliedNodeFormat":99},{"version":"e873e0d214cc9b46fc54e7008a64933b","impliedNodeFormat":99},{"version":"a1a7b7471a22df76c4e17ec6c6d67eee","impliedNodeFormat":99},{"version":"714c3b19603665cb8e057d724eeebf63","impliedNodeFormat":99},{"version":"2de22ca61fc431c5b4a81427fa496d6f","impliedNodeFormat":99},{"version":"3264eabeff0614d94f1ebdcb10bc1c41","impliedNodeFormat":99},{"version":"50a00fffc935465eb3a3c3d6c45c5e19","impliedNodeFormat":99},{"version":"53ce8a3655a6e93536504948b2a2ace8","impliedNodeFormat":99},{"version":"71be3a1fbaeafcb72240a3df20b9420a","impliedNodeFormat":99},{"version":"45148e2f69a9a924a74d078edc004206","impliedNodeFormat":99},{"version":"d5f6ccf24276c260654795378a8d6a2d","impliedNodeFormat":99},{"version":"04835d550ac62fff566961417b0c5375","impliedNodeFormat":99},{"version":"ce0594dba7d746322d88a3cdf1611ffe","impliedNodeFormat":99},{"version":"421de23f3d1be0c2fb233ccb1c16127c","impliedNodeFormat":99},{"version":"0fdbaedd3b6948cbccf1d7e8cad037e5","impliedNodeFormat":99},{"version":"c2297c6416d3faa3588a68449106229e","impliedNodeFormat":99},{"version":"e3aa16c37d19ffa4fd876a477ac05baa","impliedNodeFormat":99},{"version":"63dd986d8cff3b083fc876bfb7e967ab","impliedNodeFormat":99},{"version":"158f07052c77f60420d86ffba1e63318","impliedNodeFormat":99},{"version":"777bf33aa0d11cca892bef7fba82b3dc","impliedNodeFormat":99},{"version":"a7200addb4789cf3af83a4af2b2d50dd","impliedNodeFormat":99},{"version":"641499f82d31a45b4809871c5a27d3d7","impliedNodeFormat":99},{"version":"dfb7c510a82db29a7cceb26a3e2750ac","impliedNodeFormat":99},{"version":"130f03b971a9788cfb9841304305426b","impliedNodeFormat":99},{"version":"2ab66bf7af8a816cf801d80c1b97633a","impliedNodeFormat":99},{"version":"c0bf4c4c2cdbb269274f99a6c5847543","impliedNodeFormat":99},{"version":"10b0b412842c2638c0b3cf6a23ebb197","impliedNodeFormat":99},{"version":"1a3b14bd42f516d756697a807f9b73bf","impliedNodeFormat":99},{"version":"76bbf3f95ed56aa8bb1d5cae265744c7","impliedNodeFormat":99},{"version":"5a73c53443773203126be23537951100","impliedNodeFormat":99},{"version":"4d5d7d16502ef0c0e662e74cf71b4e46","impliedNodeFormat":99},{"version":"cff0b6900594eefe75c53fd3400c5f46","impliedNodeFormat":99},{"version":"42fdfb52d5090c57501739f14ccc84e4","impliedNodeFormat":99},{"version":"3fd92a23bea9bd488a462d2983dc178f","impliedNodeFormat":99},{"version":"99be9d74bf16ca8913b18d10942b42c4","impliedNodeFormat":99},{"version":"cc014ccd8a07364131560d57c35e58ab","impliedNodeFormat":99},{"version":"2d70827e5c726df5563503adb77bcb51","impliedNodeFormat":99},{"version":"38b5ee980cb5d2e10f877ff9c122b1b9","impliedNodeFormat":99},{"version":"728fcea29d3ee6c4d1df5800fe0d6874","impliedNodeFormat":99},{"version":"b587b52e217b826fdd34a926f507103f","impliedNodeFormat":99},{"version":"a76c321e655ffa2c6217d48d973cfb5a","impliedNodeFormat":99},{"version":"8a3b19b0a44d977b52b2256cbd637870","impliedNodeFormat":99},{"version":"52d92f48b1024f3c2e4d9159563ef9ba","impliedNodeFormat":99},{"version":"e6e091fdc426a1dd8639d5ff49026362","impliedNodeFormat":99},{"version":"ca00e233ba211cddf06219e985198452","impliedNodeFormat":99},{"version":"454fdf3e6e103168cffe857b9f5f11da","impliedNodeFormat":99},{"version":"fa9b5cb09517f78df337e3abdad120db","impliedNodeFormat":99},{"version":"e712b89011797425da5e1c452439f9b7","impliedNodeFormat":99},{"version":"132b6d9834e7b8079aed5cead6017dd7","impliedNodeFormat":99},{"version":"da3078066ffba61e5e8cc8993e3d8812","impliedNodeFormat":99},{"version":"aedc3701edad1aeef09e9a5344b9590f","impliedNodeFormat":99},{"version":"cbb54e391247768364940692edc52946","impliedNodeFormat":99},{"version":"a245c03af28b08fa0e07fe931fba5fe9","impliedNodeFormat":99},{"version":"ee495c35b8c7b44e06e24852b5eec676","impliedNodeFormat":99},{"version":"ab95ab31c974cbf30d4fd989cd7da1a8","impliedNodeFormat":99},{"version":"596df3ea2d65b9076c30326bdff1a3e3","impliedNodeFormat":99},{"version":"9cffa02d4f826137fe78396def70d095","impliedNodeFormat":99},{"version":"3e7215589ffcaf220a8ac75a35cf4f27","impliedNodeFormat":99},{"version":"7062897043c83beb13eb806e1a82511b","impliedNodeFormat":99},{"version":"f07be65f526cf3dc0deb5f9f61902035","impliedNodeFormat":99},{"version":"6fe1bbe6db22c40ce5ff83e8e0822606","impliedNodeFormat":99},{"version":"99489cff48a97fa96990cf226b85ba33","impliedNodeFormat":99},{"version":"c9d8f611ba1d2486bf96eae198a1ea69","impliedNodeFormat":99},{"version":"266a36660d26dff8a5cf2aa64007c6d0","impliedNodeFormat":99},{"version":"bc264b8aea87c8cd0e621d7773b09b07","impliedNodeFormat":99},{"version":"4b33cfcc431db1b5ca01ca41af308638","impliedNodeFormat":99},{"version":"385a10d6cbc8908e0d4642dda53ab490","impliedNodeFormat":99},{"version":"05576823701c81e06117ef80e25756ed","impliedNodeFormat":99},{"version":"4d20d19a3ec5f2a912410381c1fe972e","impliedNodeFormat":99},{"version":"95c8b86ad7c8aebef6c8033752c89527","impliedNodeFormat":99},{"version":"4b6261b53a0f050c2d5d363b61422d41","impliedNodeFormat":99},{"version":"393e05015ea2a53da316969f412ca210","impliedNodeFormat":99},{"version":"5ebe1f5d885317fa481951f4656c7631","impliedNodeFormat":99},{"version":"7d28e9eabbf2b4e36583ccefdbf8ca93","impliedNodeFormat":99},{"version":"a0bdc7a8117a065214b3a1b4d5886052","impliedNodeFormat":99},{"version":"6a094e7d9214a543fdb8ba4e3aea5cb6","impliedNodeFormat":99},{"version":"942a7ef0bd1e93b2116bc4c2203a5c7d","impliedNodeFormat":99},{"version":"d6feae9e78b3d1554f6c1b361646be15","impliedNodeFormat":99},{"version":"13acd0d4a2982cf9dba9fdea4927472d","impliedNodeFormat":99},{"version":"5fd7be43bc1e648ce7f4df800f8165ed","impliedNodeFormat":99},{"version":"e95c411d759f9a4ba7ecc69e2044a36a","impliedNodeFormat":99},{"version":"154ae6c19ad95fbcc9d4087f7aa7be0e","impliedNodeFormat":99},{"version":"b572c264b3b23642a3490cfb35f74e83","impliedNodeFormat":99},{"version":"44fd556d8d3c804a6656b2d69bf791ff","impliedNodeFormat":99},{"version":"5fffe82238f68ae4c56679b439b4a9be","impliedNodeFormat":99},{"version":"247c66b726df9b473cd34e34f76af2ae","impliedNodeFormat":99},{"version":"f29faf2b0c42fdb94408f60a5b3231f0","impliedNodeFormat":99},{"version":"3c82e5b3068987219f3ffff6174ba1b9","impliedNodeFormat":99},{"version":"b56e16cfbda18e5f708d921811c02787","impliedNodeFormat":99},{"version":"787362ce0e33339d46bfa67abf7e9d35","impliedNodeFormat":99},{"version":"adff67c922260166df80fe3e4146eb9c","impliedNodeFormat":99},{"version":"1677f777316365dee684e28c4a823002","impliedNodeFormat":99},{"version":"350420b547a7089cf6b97149b35b342a","impliedNodeFormat":99},{"version":"e567d099c8d8e697d31ed9958c682cea","impliedNodeFormat":99},{"version":"0da6e0bd9e15a17a8bd47edbc2b9481e","impliedNodeFormat":99},{"version":"b87b8ebec3030da2b3343e82d513c4ee","impliedNodeFormat":99},{"version":"0658d55f148de0ca14f1baa3b33decab","impliedNodeFormat":99},{"version":"66852df55bfd9514fb8e64942c486c13","impliedNodeFormat":99},{"version":"c0a6b900fead67770da671cfe0e23bce","impliedNodeFormat":99},{"version":"dfd61b749d7d7c17eb4ef0b1add220e7","impliedNodeFormat":99},{"version":"85a2361345e408351fe8a3ab84ccace6","impliedNodeFormat":99},{"version":"2b87e0279491fc45df00204431fc622a","impliedNodeFormat":99},{"version":"4765e5dfb370873ab2b8a21117bae2f4","impliedNodeFormat":99},{"version":"5572a7b80b2768850b7dee787c235e70","impliedNodeFormat":99},{"version":"18f29d7b4028275dcff292b29e489509","impliedNodeFormat":99},{"version":"2db08c91470c4595f01b088deb5dc86c","impliedNodeFormat":99},{"version":"8a39f07479899bffc37f343b0d8f1ce7","impliedNodeFormat":99},{"version":"ea58a2a7264807cf162586a952989b13","impliedNodeFormat":99},{"version":"c160e01866fbb3a36f1edc60664ec2ad","impliedNodeFormat":99},{"version":"cafd9c4a056e3d25b63e6e13a11e417d","impliedNodeFormat":99},{"version":"ea238b095e40da52a5f02e19f0c28fc0","impliedNodeFormat":99},{"version":"30cb5bc2c6b2b14e5839320e07297c0e","impliedNodeFormat":99},{"version":"efdd2c846698446a335d4de01c80d161","impliedNodeFormat":99},{"version":"c2d5d95f61b2d635e8efce1758922432","impliedNodeFormat":99},{"version":"7399c52ee359f7b58a1e749c64702259","impliedNodeFormat":99},{"version":"e986679987b25d735ea33528cfaf8c72","impliedNodeFormat":99},{"version":"98c682adb0b14dee06e7b644845f7436","impliedNodeFormat":99},{"version":"3f20530cf5e9b0ed0a50dd160243ca57","impliedNodeFormat":99},{"version":"06b52fda7714c3936168498df22e07ac","impliedNodeFormat":99},{"version":"edc0009d28d7ef63c391cc5c10b4df94","impliedNodeFormat":99},{"version":"4f60ac62bc23947ba653716865dcc67a","impliedNodeFormat":99},{"version":"86e357ccdd9f5ddde78b86ba72d28102","impliedNodeFormat":99},{"version":"7355f93367a933267bd049d1bb20a497","impliedNodeFormat":99},{"version":"cc05f18035ba000464c04751ebb1041b","impliedNodeFormat":99},{"version":"8da0726eef4e731ea100c9ebeee43537","impliedNodeFormat":99},{"version":"ddb6b3b4f622e9b842f776b6b2f5b119","impliedNodeFormat":99},{"version":"bba7fd58e6cceeedeadfd27a1b71c144","impliedNodeFormat":99},{"version":"192557d44db1e7867b2c7b4b49ddcf05","impliedNodeFormat":99},{"version":"fd03d9d88d6839cb621080ee954773e3","impliedNodeFormat":99},{"version":"625d872e702cfb2d1847f9fb18bbcbb3","impliedNodeFormat":99},{"version":"2684947271453465345771ca1a0dcc2e","impliedNodeFormat":99},{"version":"0082ad514f1dae7317ebd84135c6b392","impliedNodeFormat":99},{"version":"ffe85605f10a4ac25a9e53faecde8406","impliedNodeFormat":99},{"version":"ce182ade28a5c8b8dd00902e56fc0edb","impliedNodeFormat":99},{"version":"6753409e942625d54a8cd67ea2c32fad","impliedNodeFormat":99},{"version":"387bf665a440625da9a9a651e0f60bc4","impliedNodeFormat":99},{"version":"7aba8ebe33e187effe616f4a7ecd3ef9","impliedNodeFormat":99},{"version":"3a34facf379b84727df2b048a2979296","impliedNodeFormat":99},{"version":"3ca44087cf45107a76804bd49a4b01a7","impliedNodeFormat":99},{"version":"ce0a4546543d94637fc54ce4409e64a4","impliedNodeFormat":99},{"version":"3f49ef61b7a2149be98e77ba998c0c97","impliedNodeFormat":99},{"version":"02738fb76c7f205409fc2d2ccb20157a","impliedNodeFormat":99},{"version":"faa5230e17d5d7a2eab4e9773ec45629","impliedNodeFormat":99},{"version":"748c85ea5a8c25c002996a96c7d8c7e8","impliedNodeFormat":99},{"version":"62fafabfb7f754441b2916ac8d21d361","impliedNodeFormat":99},{"version":"df930773057e4c6e27cd09a051fa66d2","impliedNodeFormat":99},{"version":"50b7db2244b7141ed4989310354b964f","impliedNodeFormat":99},{"version":"1cdebd8c78f4374dcc646249dbc32f71","impliedNodeFormat":99},{"version":"0b76ab6a3c832f69518118690032fa0a","impliedNodeFormat":99},{"version":"a8d16c5059e6c03842d0a07520eeb033","impliedNodeFormat":99},{"version":"c85e75bd3ca44ea3a932b7aa9c6c6092","impliedNodeFormat":99},{"version":"ce580b6683e6960705e8740d3b5b0c58","impliedNodeFormat":99},{"version":"bc3aa19e57b9a19391d40140d46740ed","impliedNodeFormat":99},{"version":"3ff9a6ec605db1baa78163a9746b4d34","impliedNodeFormat":99},{"version":"31fbda5edf5e6a3bda99b80d1e7c6e78","impliedNodeFormat":99},{"version":"1675425c54145a3b3db57fda3d491ec9","impliedNodeFormat":99},{"version":"72322957431ec1d62bef38a7ffde9373","impliedNodeFormat":99},{"version":"dcc95a8e967596b09b7dfde970d0a7fe","impliedNodeFormat":99},{"version":"3a2414c7ba4d703d4cc7831ae631d9d1","impliedNodeFormat":99},{"version":"ee56c2811f83885fd4ca8bfb20afefaf","impliedNodeFormat":99},{"version":"bfaf410d09222779f9ddc04b30fcb782","impliedNodeFormat":99},{"version":"be0d22690abad33e958641c940cb68bc","impliedNodeFormat":99},{"version":"cfd910cf39289cdea7b98fc618c2271b","impliedNodeFormat":99},{"version":"94c677b43f12f2bf6d43b09bc3f77fed","impliedNodeFormat":99},{"version":"ec3c5e884931d957648c371a94b60725","impliedNodeFormat":99},{"version":"41325ae0b770172ef7702647692d53bf","impliedNodeFormat":99},{"version":"3c750d09a9d2591733681fdb606141e6","impliedNodeFormat":99},{"version":"340d6b1c4a27934ac21d0f9c2a39ee6c","impliedNodeFormat":99},{"version":"7bb0bebe2218d2f8d076f3b68588ce72","impliedNodeFormat":99},{"version":"231ae9bf54e0e970b98cd4610063a9fd","impliedNodeFormat":99},{"version":"1cde5ae9abe99befa4cb98a40ddb84e3","impliedNodeFormat":99},{"version":"d0f94532a7212eacc30a045017bf708f","impliedNodeFormat":99},{"version":"9f7307c24ba9b0ad6e790c0ef33f13a6","impliedNodeFormat":99},{"version":"31e84ddd97eb1074536b2c6a7b95ddad","impliedNodeFormat":99},{"version":"dd2a8754d54cf6daec39408e4e1bfe99","impliedNodeFormat":99},{"version":"29fe01646d39a3a3dce34cac90a3dda1","impliedNodeFormat":99},{"version":"ce51852bb1ef980da62e790bd1b6d529","impliedNodeFormat":99},{"version":"0a08799eddcfec892f0f55f7686ee86c","impliedNodeFormat":99},{"version":"018bf658e4c59bb289c936cb52a40b50","impliedNodeFormat":99},{"version":"362625241687ab9dc344831b9c5b2729","impliedNodeFormat":99},{"version":"0a911cca463a242b0b723fbf9ad339a6","impliedNodeFormat":99},{"version":"0e15368f4ae8993e5d28a1e1b50cc2dd","impliedNodeFormat":99},{"version":"8efac2639cbd1e7272a333002763e51f","impliedNodeFormat":99},{"version":"e00b8c7984e3cb3bf880a5984d028ec1","impliedNodeFormat":99},{"version":"63dd409f8cc61165249b476b97f1c58e","impliedNodeFormat":99},{"version":"d2648446db218900426e83aee8f1cf4d","impliedNodeFormat":99},{"version":"c91935a679a9a2a1fc5528b8ba21b7a8","impliedNodeFormat":99},{"version":"9a6fd59814a6d3de4e2d84c851dc5de0","impliedNodeFormat":99},{"version":"a6b26e870aa2b21247e1518f2885f8e3","impliedNodeFormat":99},{"version":"62f17b531125e850653607cce218e80d","impliedNodeFormat":99},{"version":"1b4e0a02431cfd8c09e85956fa8a5dc8","impliedNodeFormat":99},{"version":"ea7fabbe4d18dd4ac8fe62e338eb5e0d","impliedNodeFormat":99},{"version":"beb84ca1fed59406f80b4f1bfab116a1","impliedNodeFormat":99},{"version":"fadfcc50157250d6f4a81df0e0b2a24f","impliedNodeFormat":99},{"version":"ae07ff4b5bcdadcff098c7d740e699db","impliedNodeFormat":99},{"version":"25d19972df6e9330f6080257b37787d7","impliedNodeFormat":99},{"version":"5ebe1f5d885317fa481951f4656c7631","impliedNodeFormat":99},{"version":"0f34343037d1be4c66f3e19f27ed4c9a","impliedNodeFormat":99},{"version":"9a3852a39b6aa67f234a1a6105393a2f","impliedNodeFormat":99},{"version":"242af76f9b2b9d79431d08f551c464e3","impliedNodeFormat":99},{"version":"995257d393770315c191991a5ff87371","impliedNodeFormat":99},{"version":"e811462d14e11a7ba9947ec052a5910f","impliedNodeFormat":99},{"version":"84180235511c07768c4d690d0c8176a0","impliedNodeFormat":99},{"version":"22752b6c2d5f021ad330028a86c74f74","impliedNodeFormat":99},{"version":"52e361ed326cfd9f73c4ca05a6e3e9c7","impliedNodeFormat":99},{"version":"5a37909f317adcd49d750df39aca92c4","impliedNodeFormat":99},{"version":"686a1eb64bd5067d0ebfb902257a570d","impliedNodeFormat":99},{"version":"63b429f873385a42c62e9f5d37d2a2b7","impliedNodeFormat":99},{"version":"fb26b490d6206aaafd9ecf4df57104f6","impliedNodeFormat":99},{"version":"1235e224787acb209c09edf3dfc2eabf","impliedNodeFormat":99},{"version":"36126c950758ce897a8708ca016ee5b0","impliedNodeFormat":99},{"version":"ab09f8b6fd356ffb8ccfe5bdda7ba662","impliedNodeFormat":99},{"version":"87bacf4fcaff0ffc4587febd90e5182a","impliedNodeFormat":99},{"version":"71d73744fd8910454768e89ae1263541","impliedNodeFormat":99},{"version":"d54b7d9dd15af8e1b3713fc0639aaa24","impliedNodeFormat":99},{"version":"8cefec0466ed138cc0940d3b0afbed94","impliedNodeFormat":99},{"version":"f32fa1c8142e413d5ebb33562aeca6aa","impliedNodeFormat":99},{"version":"8851e2f16ea37bb22dc4648c475c0279","impliedNodeFormat":99},{"version":"7ece064083b071c6e0d92d7b5b2661c9","impliedNodeFormat":99},{"version":"1498f4121d36e96c95370c2c83d67c3f","impliedNodeFormat":99},{"version":"91bc1eec4bef0ca5c0c9be30a3b09361","impliedNodeFormat":99},{"version":"ba5784db94097fc80734f127b53f0b53","impliedNodeFormat":99},{"version":"fe61751de6dd78217a073651be48f7f0","impliedNodeFormat":99},{"version":"c848a582ae8d1c4ffa47803fdb908e20","impliedNodeFormat":99},{"version":"47a9f2193a09d79aa1665eae97b02256","impliedNodeFormat":99},{"version":"007d28832acc0101e2a1534792eb026a","impliedNodeFormat":99},{"version":"c1a1c3aa8f5f106084a6468110194603","impliedNodeFormat":99},{"version":"54ca104df5771ec669d6e7db4faf8b1c","impliedNodeFormat":99},{"version":"0829e05ed0c182ce3743c9535c5cc713","impliedNodeFormat":99},{"version":"379c604911c6397b68dd927654bc1d3e","impliedNodeFormat":99},{"version":"0123b9f073faf89a041828bfa537def1","impliedNodeFormat":99},{"version":"0270d491887438eb19ee00dd15a8a9b6","impliedNodeFormat":99},{"version":"f409c1a9d4c1160b1ea10b2cd7aaaa1c","impliedNodeFormat":99},{"version":"8d2927e8b320cbd391b5ce99178d2d4e","impliedNodeFormat":99},{"version":"01304432d7302c48feeb3558e161f270","impliedNodeFormat":99},{"version":"dc5b24b3223f8a1dd082297a3bbbd2fe","impliedNodeFormat":99},{"version":"96ba6613308b7482fac819993ff68fab","impliedNodeFormat":99},{"version":"62fe60faa182bb481ee1bb8835b73a7c","impliedNodeFormat":99},{"version":"3e1df7c99cfcafcc45534787411dd025","impliedNodeFormat":99},{"version":"2af434d779a01096da0b5aa6f93acd3d","impliedNodeFormat":99},{"version":"d67ddcb237741616ff89e3643a559a58","impliedNodeFormat":99},{"version":"9e3210c161b803bb71775583bb2ac2e4","impliedNodeFormat":99},{"version":"fb00105ab243f75f44675b1be9bba9b1","impliedNodeFormat":99},{"version":"4e2517d29aeb12e05e32975d94cd6692","impliedNodeFormat":99},{"version":"9b560f52cc8597ede7e90633ae667181","impliedNodeFormat":99},{"version":"8000e11325f89d37e871f968e9cdc416","impliedNodeFormat":99},{"version":"f299a219276456a7a342cefc1820835a","impliedNodeFormat":99},{"version":"e3c1a70524cc3c74a53837b90e41395c","impliedNodeFormat":99},{"version":"a76bbc6829ef180c87fa604a532e0363","impliedNodeFormat":99},{"version":"685f0b246f56b0962ef72f42d812b64c","impliedNodeFormat":99},{"version":"44832394608e7bc44524c47cac415908","impliedNodeFormat":99},{"version":"96b65b20e0273b38b71892f2b3ca5f82","impliedNodeFormat":99},{"version":"bba7fd58e6cceeedeadfd27a1b71c144","impliedNodeFormat":99},{"version":"438f9beaba749edfcb652e65215c8d4f","impliedNodeFormat":99},{"version":"c72c96f8b66a74eb849e966f4f52b766","impliedNodeFormat":99},{"version":"066b9765815cca5f99ffdd227e123bda","impliedNodeFormat":99},{"version":"9f607ca746f6a50bfba1530c9b03ac43","impliedNodeFormat":99},{"version":"acab2e4611597d2ca2f40b502f9dcb83","impliedNodeFormat":99},{"version":"9d498c4bf7e5934f2f025c338ff36fcf","impliedNodeFormat":99},{"version":"57662a90ecdbdea32204d1a1927d3878","impliedNodeFormat":99},{"version":"2d826128de9730bec19d0e6c31b50ba4","impliedNodeFormat":99},{"version":"2d3482473679745fabae85324fbd87a3","impliedNodeFormat":99},{"version":"30285cfc3bc00b32e12c51a7dd5b2095","impliedNodeFormat":99},{"version":"720e8c0fd3ce5946baa869aa4e20dddb","impliedNodeFormat":99},{"version":"def3374f0af6764bea1b6d60b13f85dc","impliedNodeFormat":99},{"version":"559ad1857f1f86afa2fe373eb60ac8ad","impliedNodeFormat":99},{"version":"f7b69347094ab7ab5c47f10661d55699","impliedNodeFormat":99},{"version":"e401b0d3aaf2203a80829a75fd8466f8","impliedNodeFormat":99},{"version":"d5a5db70373ccb7b5a4790fe20d24429","impliedNodeFormat":99},{"version":"d86ec77ad2687aac2ef98b11cda58180","impliedNodeFormat":99},{"version":"9300dbc8247d3575635d072b7d6cae48","impliedNodeFormat":99},{"version":"0d4e75cb1ba7efd298b865833a885c87","impliedNodeFormat":99},{"version":"e2d8a6a2b3415959fbe9d6aec85a03e3","impliedNodeFormat":99},{"version":"8d134eedc0b8ff43c57971b8ddff623d","impliedNodeFormat":99},{"version":"f8ed19bc10876e40ca0c265738e7278d","impliedNodeFormat":99},{"version":"c19119ebb42d76233f10cff5ff2e8478","impliedNodeFormat":99},{"version":"bba7fd58e6cceeedeadfd27a1b71c144","impliedNodeFormat":99},{"version":"d087f658bd76ed450bd5d4ce506eb116","impliedNodeFormat":99},{"version":"79d22ae71a6246cc98cbc32f7b233716","impliedNodeFormat":99},{"version":"0780dfc40b204f8bf07cf40243f6e60f","impliedNodeFormat":99},{"version":"471ce59dc22c51788bb80a7f684d2636","impliedNodeFormat":99},{"version":"fc21b1a6f6bb562900e49828d58a44c9","impliedNodeFormat":99},{"version":"cd152c1b036c45a640a43a9b0a2832bb","impliedNodeFormat":99},{"version":"ef421774c5ecb5867f63217e6a3b72e6","impliedNodeFormat":99},{"version":"fefd8b78e9e09dca447381c16be0c079","impliedNodeFormat":99},{"version":"376a5e43adec4c567581e0c47025b4e6","impliedNodeFormat":99},{"version":"5c7b7541573946ad3459c89563bbe562","impliedNodeFormat":99},{"version":"25a6407fb3740eace0f5d7fd6e37c2ca","impliedNodeFormat":99},{"version":"30ed220e43073e1c224602703cf384cb","impliedNodeFormat":99},{"version":"dd9ba488ccc254b50a2efc8c991cfdd4","impliedNodeFormat":99},{"version":"64fa3a9664365ac69c8c1bcae894ec63","impliedNodeFormat":99},{"version":"8a62bc6926321b876c227277072541b0","impliedNodeFormat":99},{"version":"637b9fa09d03d462acdc2f85054790c2","impliedNodeFormat":99},{"version":"1521836305c934e63d8b37df49fb8fe6","impliedNodeFormat":99},{"version":"bda02c3326827e48ba13c42ea306da8d","impliedNodeFormat":99},{"version":"3585ebdd7e5d494d7f139ccc81a360f8","impliedNodeFormat":99},{"version":"15f5e660d1ccc494e5ea12ee9dedd0f4","impliedNodeFormat":99},{"version":"d6b0b8924a5009851c4a532b42da3ca7","impliedNodeFormat":99},{"version":"491a08861a422c017967a574015b16a3","impliedNodeFormat":99},{"version":"a67ee837404f22476afa0fc77a48e78c","impliedNodeFormat":99},"168d3779a8cc8afed49487ada145003b","c14a0db8d95eb76bedb007263d517d6d",{"version":"a36c13283f16ab3631c2b1c90abe6ef8","impliedNodeFormat":99},{"version":"b50f87570a01f782cfa3401a3e6b3602","impliedNodeFormat":99},{"version":"6f47562fea657617d51178a6b628d1df","impliedNodeFormat":99},{"version":"ad12786d0b3f0dc2f1de4fe315b26b7e","impliedNodeFormat":99},{"version":"aa85a9e8e0f5ca21dde7e0298b2b8146","impliedNodeFormat":99},{"version":"1551f5acd9d5a85310b725414d0b4fa5","impliedNodeFormat":99},{"version":"3a625e8d4174dc6919bd049c31ca6b20","impliedNodeFormat":99},{"version":"394af2608e902900680cd67fa065f6c6","impliedNodeFormat":99},{"version":"cc4e641a1cb6c071372873d1ca2fee40","impliedNodeFormat":99},{"version":"150b410f8058ea9e39790e6d2ac3d32d","impliedNodeFormat":99},{"version":"1b0ea2d3e52774945764baea8eb10b91","impliedNodeFormat":99},{"version":"c6961b4ba8702bb2542fcfa461550151","impliedNodeFormat":99},{"version":"d6a199693f2d5a2a224c7e35b3826e9d","impliedNodeFormat":99},{"version":"e600b341a3395e7da358b367546a3fa3","impliedNodeFormat":99},{"version":"39328de4080d47acd2e4421605ab13df","impliedNodeFormat":99},{"version":"cb649b306728659696c74598e74c2b74","impliedNodeFormat":99},{"version":"23d47d5e271225f54f94ac4ff632b962","impliedNodeFormat":99},"0b91e143673250def74a5b36732498ce","57c770a104667fcd3b84386cb790ba4e","2fbadd8fcc861a73bd534a510f7ff818","cb1e5798bc8d5656fff05c3e1de644f4",{"version":"2514e9a2749c0fc18d2f478e9e1e641e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6ae4c332ecb24e76c1e47c0e21d4663d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ee0752d1e70c56ca160360425752a9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf33440030f0a0fae7d1efd6c293a8d2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9af0a7e3ef1c42cd066b9f8d365cc1ba","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7b772cebc7136c34fc77954aef70519d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9eca652586205dc5b07f9ba57b1c8500","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ec5f75939754ce94652189ec7d0d3058","affectsGlobalScope":true,"impliedNodeFormat":1},"27ac8812a712750df047dfd949bc28f3","49133c0dfbc32ab95668c3443dea49e5","85c2cf74d24d4069fac4686501a2d7e3","83f416ded62bb31c035580c3b5a8d334","d261ae135609468365bc2d32742d3e0d","60c67c092ae78d2e7858ca0a88f54659","9508c917bd7e458745e222a82dd24ef0","fcd1a513c1e5802916fa602e8b8e64bc","9cf55e98366383279869ace31be98079","8e2bc11d0328ba95e490a741c44a215d","f36661bccb8b9a0b5ccb8539ae751cb3","705645fe223430c696f47b708d592ca8","28d57c837c94adb42add03d499793cab","8c01a9bbae8449be21b3e018d59a74ac","705c3696b9d9681bf22181718bb08ffc","679024f8e9f58a112f4badf119c4d612","16f740a706028e841b09fb8b1aa8faaf","e6828eaf960f006eb1adb6e7df8913c0","6fdde11403da5129f4388a489f361535","d7e5f7a0f1f883f28458f684106e7643","c2364011a80b6a9e3cc0e77895bad577","38da5c670190f4a35cbc204ca6c616bf","d95cc0eb29beed58f5ce72db21398f53","ecd53256b1ec7379c73316eaf392a69c","db5a9211b779628398011a5b8f5b8b5d","69c7bb9c3befe9ae37eed0e6a6310fee","1cba93fafccb7b2655f0e75229185e83","094ecadae30f65a82b77343dde77a666","f75df12d75dd783b03a0329b95abdb25","b438b08b2f0ed94a95a75c8990d9021b","771a77c9bec862600c95f7a563871b5e","c665284a9cb3dd886b14663cd04742e0","1c3833453f6ed0acab1b4663ccdbd310","0468c0ccd0ec7770b76481b165564d62","188234d616a4f50ed9b14c8f84a39f33","4c116bcf0a47ea8fbf4072f380925fa7","1948703c2f27e582e0a0cc37bd67a868","add85ec26ba695fc99c698dbec065f8c","73ba12091cff7d4499df83bbe40d777b","b744265d8ad12b7d4d5c5dc35d18d44e","eff32168b8348b822afeed9cbf61afa7","af51e27e980746d79714b72188b3ee40",{"version":"26bd041dafacc7f2f6339882e6514fdc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"292c9398a407b33b1d9c9812b673387a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"45df94b3c51b898624bacc2bcd6d9eb2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7d352f71d1b1bcc12c79dd0e4597537c","affectsGlobalScope":true,"impliedNodeFormat":1},"db11b80743ed5356b81d763a708788e6","39078ea063fcaf72bd3cca7e0d13d017","f81aa09811fa65ac6f354ab0018d3c38",{"version":"282318b178d190157a4deacb14f3040a","affectsGlobalScope":true,"impliedNodeFormat":1},"8808902c9175daaaa4cb55f549a45608","54c5c3dcfdb5f7cf5fbbccfff6ead3fa",{"version":"dc14f078230582a2f8fb2138bfcf4f85","affectsGlobalScope":true,"impliedNodeFormat":1},"b2b472cd0bf0f8d5f022e00ca1c401f4","973ebe6a8aa5a2455e23a1dbaa0ad02a","39b3089f3df8d14e0f2ddac0479872d9","cc7a57e86f908c313649aea8d90377e1","5c271f10d8a9b9a1206bc82a4fe5b84d","fbe31979333ec391d8b59e8f42236e8e","6f97553fd1690f568365155d4c51a3b5",{"version":"a3f111d2a29b6cdd04fc4b41aa560c86","affectsGlobalScope":true,"impliedNodeFormat":1},"0129a9b584d122e462a189e3e80eaf21","59e2209cde19223aaac28f3a0269b908","08f313fad74e540b259ad22c66ec6522","86978b8f91524043f71ff8dfaf83288b","4acfe57fcd69b01ad21cb5a7655dfaf2","579675a2c3b0f8c532a82ad9cbd5d384","6c4de7becb0d667144a298a048daa5f8",{"version":"2e0aa7aecec3c5e9ab4a64d08399e9d8","affectsGlobalScope":true,"impliedNodeFormat":1},"b59cb5a2a891b4a59040eecaa4e4fd92","c9053dbbe4fa2853f2d3f73b9a2fee81","bf912705027b3eabad67f9d8ce7d89be",{"version":"c30a191ddcdb0b73c5f4982f6fd2eeb2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b94ac10d8de340fe748ac6d14e67206","affectsGlobalScope":true,"impliedNodeFormat":1},"6b26581aa2587701d570206a0db8c9ee","88a29e2aac8082c0910733950159e1ca","609d3ac6ba921e6e83c5da182c204fb8","0f80958d77cd6301b43c1d7904e3e4bc","3bdc645524ab0d2f6795d3a008833bd7","deb50b47eb75a5566532a763fa1324fa","60ce7e2b7ea6ef20a957106c8bff3756","7e470eddc0bd0486dc2a8ab902de79b7","c8206d568b54e5ea06131963eecd576a","15878f4f50c2e562c0768eb735c2aed5",{"version":"20812a39f9b1118fdea02b1c9c624c3a","affectsGlobalScope":true,"impliedNodeFormat":1},"dd404118e8bd70aff746f7d31e46270b","d84798d74cff30203ab77a949c8e3b33",{"version":"6b8649a280031d9e86955db721cfad87","affectsGlobalScope":true,"impliedNodeFormat":1},"4bc8f13c472858fb74f77388c0c5d885","d2f2e30b61d71ff76f1a5832deb2586e","c72d2516d1e8910caca33c4dff75fcd4","f0231f36cb7117fbe9271ff19ef0f5f4",{"version":"e995f9c4853f0e5bcfafddb750fb9cf9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"05b61990a35c8c3ddca8ab7c65d6ad9f","affectsGlobalScope":true,"impliedNodeFormat":1},"53754b619210c571daf58c393ea6bf83","9d0a504d30d1e9052afa9f6a5a9426c5","9268959cff1006c82e6abbd73824db97",{"version":"a08438ea6c1ea2f0cf4aa6835e2cf1d1","affectsGlobalScope":true,"impliedNodeFormat":1},"595eb99a4776c696a2fe27ca8d877652","eb567c7b5824aab578f75bbccf9f4b05","25d40df8bff69a330a687d98bdbc2eb6","87175b4aa2f6ef2d25834a1969a45b51","be8b3bcdd2ba7d7c8c87946a20626c5b","f0f40afc5586d9d11f26c43bf265945a","cd8070bba6df1e7a7b65224ab106d7d0","ce15efa1c092340d16d533b69f4fb1a9","920ad63d18cbe3c2117863eff71fe2cd",{"version":"d24ce383e45fc15d6fa9f750441ba231","impliedNodeFormat":99},{"version":"f3b58d74034c2cbbe8af62152e6c926f","impliedNodeFormat":99},{"version":"902e1e4fd8aaa166e216774393fe14ac","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},"941ad8d874584aaa6384a0ed3c0e43be","2a9a869b48b51e21fb3af2babdde9e34","e1de687778006f76916fd39071e71191","1b43c0fa1c9bb812c42bb04f3894b1c7","10849ab9efb7726169229bc2fd31f9d8","3cf327b4fc097a00fcfc9509925855a8","912dbef0e5dd9fc128b7a8465afe4542","4d13d472a0eeb8e1335c4b58b48d41bf","d0bedf6110fbe75d494cd427be969430","42f52a3286f0d6c52b8625b1d665b2d3","a35c1b81aa4e197bee807e7d3fc9b28d",{"version":"8670027a58140f8dc67c23721e0e3a11","impliedNodeFormat":99},"3a66f588b23a76ede1a4ac23a1d1b5e1","4b6c40e16b9a1305063d189a2c688db4","e3995d33a68af07aaa4b7b321a68dd3b","1facce710e94f8fc601043414705e744","68196474663f6345892867f2e303dbe4","557ec5a5a1e6c41d2e0f42dbf6d543ea","c4656b6279c7b922f1f9025d5507d87e","2471ae38c1899583c631cc4c48efef0b","44e488758c977db024b5f97e3ca9ce17","8b63786267b0189134cd4010c5891c3b","2723c065a7c792c375c2823d7585940c","f8c2e4a426a01894dccc398837f44183","00aff1ba543fa1a179cc53bc24c811ee","faef1f953f7d33d1ac7911bf97811791","5df2405c989234303f482f9c474bb096","3182e548de117030953d82b704645808","f1679a2d56b509464ba314d362e7eab7","9095e0d77c0b94ea0f8fb1559947b30c","98781e48e50eeea2c2c89e35ba4bcb91","cc5dcf7e06a97af4ae8a9c42ce307a85","5adcb49566a6bedbc40cd4632839cfa2","e2a1e99e776152174af86e1354eb0b9e","0141d4c68c4d1ee7263899cbfb0df04a",{"version":"2f9498c2061f774ea9dafecb26e18722","impliedNodeFormat":99},"b87a472dc37926b272732ec21854ff6b","4e37229cfa546306fee6629b508f6f0a","d75f89ad9e87dcbd1a92bd3306116a9f","5a01c2acb8e79383694a50e9fd11853e","6b5a87b2c93fb94f00bb518345c66e88","d59097f9336ddfc36482d3d1e72a9b1b",{"version":"09df6a4cdbad13fa010749e928be4a2f","impliedNodeFormat":99},"85596d15f809e86aaca8e46f3b2a3741","d3fb3e811354e1ceb074384d87063905","21a214be56411696570ca11b6dd852d4","b351f9addc52920698cf61e04e636e3b","9ceab95f057623586adddc82d72ee521","ed0d6bc2c247885f087a18f2ae144eb2","cdfe0a05503a5838e2e696f9dc2a31bc","5fe67e51d8c03d4bf3a28522469af0cc","252d32f6cce0fb543a4e5c67bb2a5ffd","85dfa6bb53e322653b1441c5c298dd39","a4ca25b71185cc75e10ec30d39969590",{"version":"4ee1af84823a6b3819011b5cf5b5620f","impliedNodeFormat":99},{"version":"ca23d2c5f54ae1283546398f5361eb0b","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},{"version":"ef1554b8d4fb03fcdf7d11b62cfb2a4f","impliedNodeFormat":99},{"version":"d522b150f5fbc8d7da4848f5a3daaa88","impliedNodeFormat":99},{"version":"563355c252792fcb5242b47bce6dafe6","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},"9ef287f966c57850323bc727f2770bac","8c489bd949e73193a0da0e925691ff71","c1c332ba0a82dcf43531e8d213b140cf","0d0684223b4838ad062abc687df788d2","bd6e66547e34d08cc76155a1a57fdd48",{"version":"755636ad6f32b63f262ec9940496a366","affectsGlobalScope":true,"impliedNodeFormat":1},"fdca13c9e1b0225fe2ea7411fc134684","b6ea0e1699f2d02d1cf8f6e6022f6245","185369e9cbacc14aa83d7d0193f93fc8","01f891a35535ebd0fd24e9b940881758","13f5b00c289665472dc750badeb9d715","93dd4d63dfbbb6f746e285de62812363","55ce024f7888843d49d00bdddc3ba682","d8ba7376f3b35f8cc5f50fb3ed2bd1f7","4033a9897d60c6f83c6975b734f0c13f","643c46addabde5baaba3ab0630d20424","6bd36b776fa86d30f858cc9e07b31067","5b6b14985cac10390b95bad1ea280aff","b300f098595fa25855bcf9a07c4b2f61","c90f220839bdfb394e1fdfc655c61ada","ea6748dd32bf97439a319e18622c815d","92e1b8f0ec34a8a338314b875a4f4dda","610857e04fc41f46b898ce8b95ab9ce6","2de9a99d45da4cf7172ab4b1dc3496ba","80f2b47d1743c461729693ec3be96322","fcfa5caa44cfe0df7ad490493979af7c","3bce9ef8645d8e72e1856bac8a3dff8e","dfccdb34d654062d6487df5dcae223fc","79ec89acf4e8de8d193d883bdac4b10d","a381e73420da70378a15097a8a96fbc9","70c6c18728a6374e67cf5608cd141cdc","25af5e370edf42b6e9b75f7162106430",{"version":"3278d2f47bbab46ebb5893edc159e830","impliedNodeFormat":99},{"version":"107ac14ea994fa179905b8e7b0d606fe","impliedNodeFormat":99},"a6e8ac6b6370525f5d3e72031a9d822b","63e641a9874e472580e11c273f0da9cb","66b529641e4b8cf2a7808d7e180eebd6","73bf1f0057f53050b691cddf53a0793c","adcb6de27b66010302a3a68733d1b6d1","652f1c1c32d0d2466721a2057e101a90","abeaf75e215dfdc898b41c847a0dd5b4","be8de95e3dcf3aee54e0018cdc824789","52b2909c81c56a0f709ffe3213611d74","a0ef726f48a18d6e8d1693f530acee45","31f8d48e463fc19b1703d364feeb8f11","eba0d6fcfae019d4d9b811f796a6e913","830cb1756bf82e65e2735c4d9f642607","d4c9dd13369a29538f79533de8d014ab","777dd48c43522cbcfab93078662fa0db","7fab4371d80efbfbd610fff7bb1c44f9","4659c946b8b50c23d6ab6d9d947dfb59","efda03ea9f457674502fc3457d5dcb08","3feefbf24698c6a56023f46c3eeaf02c","490ddd1ba22d6960ff649d8f25378bf4","761bcea360606ed9081c7a5e806a9010","0dad9e9118b3732f722300f42fdd92da","0bf7790025cbd2b20c36373321cb0b53","99eec783c51e95ad70cdfd33ee47f9be","3d6a7cfa1c5e75120f0b9e001ccfbc42","62c58bb7671fa28768cf09548db9d462","2548cfce31dabd2b226037c66f2e25f3","6cdc10cc57e1a3bb69a6a8f94d2d3ac7","a7f9ecdaac25ce37e391eeef7db1d3e2","ac6f0c30bf3f9fb56fe024ef5fc7b378","7fe4b420e7518eb7f86f698c7d99d4fb","b34fbc6ab79802331010e208d1a1edfc","683dce7cdd06b1a97808f5f2403f9f70","06d997e09e8b96500bf98f06e76a0c41","39626b35f5587c20f6a20d44354de290","9e090107f4b291b62d2818eda5fda036","2a5100d3e4435d40c9f842073e9d83dc","2053fcc907c642ab7858e17969e43c02","f500b12edcec293c345ac3ed92a09a73","484530ae3ae947736b72c6a3e326c655","c071364a8e40a22c1cea684e3e83d4a3","4e2c11273d5ce6f083473b6ae7b5bdc8","2a73a1ec9d4d8ce35f17ea751b9cefde","d4987dc2bf1a81fdc058ff02737bb0d2","07ad8b02d6f8634cd67df4e70d12c0fb","6dd1fed87793c21edc3d51107519cc4e","882a58ead748c678b1e4929fd927e9e5","e25605752a0cd89708d4e8ccb0edd48c","84651f599946f9bc7f43b84873b1434d","0b18dfc85d3f397fb29c31672733985f","b004146b7c0f3e8b44a4d5711336b02e","a5415be2fa39cebe44ebdd94023789a6","639bae50ad00219967683569ce6f3cc7","eeb284f1b4c204f87e874954d03e41e2","3973944f94e414c45428cf2928f8246f","0abda9dd1466005c495dbc7435927cb1","db9c9aa7a90cf749f23b4bee2197e6ca","2cd2f64f0798e891fd6fad5ab17d1c06","a8ee1a3a17abfb465088c2940ed77acc","fe116f1eaa2c432e4ef7aef141a2ef20","1300b77c7979611c313742c33b9597a5","7ba8209f3cc3e78aba28aee321644dab","2cead7a06eebcde3fe77592741217a67","ac499a36735f6327b19db79d460aeda9","05c26276920d16255314a671a8948f5e","5f44905319a0c0db1bd0c403573d0b0f","0e378ab9c2b6f2c0e05be27fd36ec418","a49cf3b3b215d79c56e2b1dc1b4157f0","bf0b2ab59e6ffc0f7f592f22aa161026","8a6f3f7ec4ce0a1524485e6377ee2e29","9c9314a28313b4fa73d4d03653ead17b","239094b102bde2d77ac1e0f42aca4279","05f37085ad6ebbf03dbc5c96ca6d6096","ae346dedc7e2fc7df134722977bcc799","05a9ab3d42ed20a7c5d34c5087159b63","af0be2a0247ede152dba22a10df7bf38","0fd6fcd43adf7d519d14e45d25a5151b","2aca0dc9ec8c7285ddffc459b1e39f74","337b848a18c7ecdffd0462031baec56c","41540e3e1791e28464e8dd52e21cf6c9","870fa507476ae88353f887014511c545","281df0a93c010e2092ab4675a2f175da","34d392dc9e10950b9cfbfc1f8ee9301e","0ba8af5f7f4977a786b95e6b7a75e00a","06539dd329d3ef0e14a4e81ed9f46b73","6ba14730da5edf4556621b49f546e9f1","ac7c59aa27d3bff3e984dbc6eac637be","a77d94ca10b1008a9cdb69e115abf0b8","ce77d6c39c997f62ef40282402568d39","099d7c36fd8a4d4358a6dce6ea380246","46d916bacf2a1cb63b93d6e7faad799f","1850795984582659d633b9073b5b28bc","fa24e17a6f52bdcaa3a45267c82d8a4e","729a267d663ee03249253f11e61a6d7f","651048195cf97c67229be3884302c603","92499c0b418c73cb55c733208e0166c7","0ca6a847d88382f51debfcc4e428b142","40f4aa6107030ca08ed526a010cad9c4","0dd496a43b85c7210455891fed751d68","14d8e6f1c632de09afb626e5220a92d6","0ddeb12297d4ff5db0526703a6a0beb4","9c35ac2fb90907e17f42b4b9aa7826e9",{"version":"e52778c0d4ea21d3dd4c7ae301f6b76e","impliedNodeFormat":99},{"version":"4a9a29a5b36fad5bc9c8853b641c9d0c","impliedNodeFormat":99},{"version":"30d6e8c1d3c52c4f396803c69abc0dd9","impliedNodeFormat":99},{"version":"4004701fa1a41c4e8d60d47efeb5abae","impliedNodeFormat":99},{"version":"2d6370fa0614bc7314a0b620a84fd562","impliedNodeFormat":99},"31d3e9fe16fd0d04de2ca205061a52b4","4894bf49985d166e122100154c8f9a01",{"version":"4fbb8b4bbc0ec00f5362b274c4807e9e","impliedNodeFormat":99},{"version":"a6a9efef2d0b60305d8c4ebcfa12a9e5","impliedNodeFormat":99},{"version":"4e5cfb74f8dbc894bac4a48c2804cd4b","impliedNodeFormat":99},{"version":"756a1fc8ba15aea14e16cc28a9ab34fd","impliedNodeFormat":99},{"version":"f206fd0f3d39aa6206487066b6bd03d1","impliedNodeFormat":99},{"version":"83520dfc231337bd844cdfe4c67e648a","impliedNodeFormat":99},{"version":"acf032a0b44759558a8c8b42593a34b0","impliedNodeFormat":99},{"version":"d74e28793b35a3d6f33542803bcecbc2","impliedNodeFormat":99},{"version":"9226a1abec401daf9c0b3e7be61e4056","impliedNodeFormat":99},{"version":"b365928e7533f9e97a34231aec3f7340","impliedNodeFormat":99},{"version":"0b15359aa792c52e7184fa734b41fa22","impliedNodeFormat":99},{"version":"b4b660f702e084943080ca85d16f4379","impliedNodeFormat":99},{"version":"5de1c2782f95467a95615878d52e5917","impliedNodeFormat":99},{"version":"834ad65de8e4834cb4acb02cc980fe99","impliedNodeFormat":99},{"version":"8ba997b1c401d59dd2fc8bf3cc9007c5","impliedNodeFormat":99},"f7ddb706be7b25db72c13420fdec72d6","ad33e60cc1333c53c4652c161034f41a","c79ecc916d6e08c034239e67140b21c8",{"version":"c0f2f13d8a55bae831561593760c74de","affectsGlobalScope":true,"impliedNodeFormat":1},"d037ba3d388a84e2afbd1c3000f45e9f","4bad84c0650065522c9f22491ae9c2f6","b81b16804145eb7c7d5f3ae632b51cbe","2f6e6ca2087ded2723eef041a1d6a9a3","4e8be0e726b15b0fca0f9ca8e2fd955d","f68b36ec0b7a57f64ff2c972da1c9328","fd8664656e07c580c939f1efabede5aa","9cc993caf73f9538b9c1ad57bd42a344","8708d827925cb33eb8485fc7c628807b","a6b54bb487feb25c646c511df19be1f0","7f60e3fee27191c4908293766a8fa416","0e3e417baea7189f78e4621a84508931","008537c5ddbb781e961cad13e3c911ce","24203b06192da0c4f72855937fde32f2","40d2c52fcf763be07ea4b2526ae00673","5a92658de5c8584a027b4bc1712cb4d7","de459fa6b7917d07e06a43e14fa3b196","518c9cb5d1a940212e888dbb44127af7","01808f02c4d6f82135f51984c090c8cc","1b5ac595af525e7fb152609aa7ace20e","3a0270fe1327a5cfb1e319cf7d9e315f","d39a0edd6e9938b039cc4a9363289f8b","9684f7504fc1151ee89d572cefc83a09","15d213753116727f331d2890e738aa9c","0e92fd34f2a1256ca3bcaadc20e99ca8","6401cdfb0a84d9b92fc9ab51e0a62390","197d54232861245a69cbf3566e6672b7","ccfbc718606f75a748f610ba08f2b032","21c41fa2a52a9c3cfb4289535a9c1987","8659c1dc5cbed85a36445ace25f5a0b4","b3d04b8055b7b818aefe2d07890adf32","4657b4aeaf52b812f7c6e91a295ce20c","af861bfae2c5b6ce6df996b8efdf0574","01105e8a6a4ea2aad0d9989774ee05c1","59a0fffc5a561f169f6a836b02355371","77411765e75596ecbc6511096a6f1da6","445236511d16dac569e2ec783498725c","06caec9c6386e31603e970a5d8bac35f","63aab4b525d9bc2a16a320e86819eea2","16e66f2ca312f0b8b5e8cf74c3048a4e","caa20b65dcaab53dca143065155ef0f6","6c96af5e2443cf054a12a5e36f30129b","1bce4905fada3081f120496541d9f565","69e22e9a6d6a05e9a12e03a718d57cdd","585589a931147897366f5d7a9a62516c","505084df51a8c79775872b328c3fa0f6","35eb6eff78734feeb34e80cc44fce399","99c7c5d4395a7c576cb1a7b3b9636f28","143a3c87d58b5f42212746b94229d5df","02129355d6d7a4235d19d2a0bd03e23a","ef7ab8a5346e9ec99a83321699bd1b31","b1cb9e15161d96477fcd9ed8a6ee2076","5b732137308752e0fb878ba3d546523f","d0ec153ba6ccb174a1a9eef444aa1397","b02989afcfd55c5e758d18816fb1a153","75e9eaf78e7db9fc8ada4517f47d1db9","5ab9a6b1fed9a23ee87f3f00db9a3162","7137a02eea81271e9bc247352b72bf98","5a95c51f8c8bca347fc420ff0ec9b17f","40e289625278f9baf51d3e3c0361153d","25c68c3334613e13642bddeb5b32b682","ccd2480455ab762fee780e352883fb9c","adc26f64b592d4e8fdcfd1461d9fa2b1","83719bea40bbbc08446dffb13557e1ec","2f7b8e3fcd863aa2e60b70a579a098d4","9c84bb6f7194a7cd637e7b6deef68b00","e7141352031eabe460f437eeb661f973","fa8786762ed8aa6474d08e30c5cf3f11","2430ab1f7a016d7fa7f19af5cf174252","a4a909e5d7a14b605f14294f61053678","7308e4145a6e3daca95d5052901896fc","33833c7f3ca4d644741ff2d33aae0728","617280050d0ea7dc43f340d5fe2294fe","3b4c455c5efa9989bcb6f401c49cdf9b","961a346852f3db70d79cc1ea6f81d763","4d82eccff186948c5e6082166cf24fc9","1daa06e9ad14015965068d1fe96e2a9e","4a14a453cfc0f7841eab57de6fba7b0e","e7fc70930279659c53c6d3471c96029c","7a06dd6f5c956b5719bc890fd3842674","684ccfc4ac646603dddcae8b29bfa5b0","276a62cbc2cbd4934c9a28da17026eff","33eb76cf826d5e08a98c5c6e5aa7c8d2","ea1792413c858251f152e8929b40edaf","dfac1e72e47eb5171490e71099b67a30","5ae21e2b5cb5fbe917e1c0f0ecf8d2c8","84e1cc09c6dce8f4921424b568fcb338","f8a203966a52438b9866a494e0e49b96","f280efa3c70c18ec26a1caaf17fa6453","6ed92497dc264af14f17612a7d5dd7cc","c38090e0e8261eec6e07d197528d850d","2fbbda94bfc2af11def2b1812e0cffcf","f10b944eea0479a5209ea0b733bcaaba","0d32c4e85af5b4452063cefddd553ef3","eeefe107a68a3d5968a5d95fcd5e688c","1f2a2ac516c83add3d9e177cb7a19c62","e0a903154b8361f27d030633b62b7c07","6f7fc89240e68db25854a3b30cabb233","3a7ad9b2398fe3d076b6b47aff4400b7","71970e27ebe78dec2c831e6071e75930","de7ffd6283aca9741c3bb5efe88b6643","7663747fc64750fa261fc42806aa93fb","ca1d2c14a81f3fb0ed33b73f83483905","c206c5d415b28603d436d94b2727bc46","0e1d6a528190a28a6ac493d54e8634cd","46000883e8b5ed1db7ab54f68b607927","3555a0bec43f0cc53dfa222876a713fd","3394b4f829a0a92a93c8431f50d32bcc","32a28e526f0aa70aee5fae32aab9a875","4ed240cbb3e50b2eef9f7601773e5cdc","e414776ff591e117fc0357cac74d8b02","02a9a66691e8c17a99311bacdbffec2e","5c0a4e9d4733a68ded16228c5c7eae4a","816ddfab5be89e811805145daa260890","b452b0d8dc787ca19d23f5141a8ac4bf","8b56852b0fee3c97d508b72797905c79","97df6efd96f84b8401f778a7712e8ae5","d76014de6103073f458946e2d02ed4de","d755768ece3a232d2b8d57cdb90c65eb","5b7afbdee2690be6bbf0c1fd9d1ed2c4","f0063073d9a914ddd0b203d8cf3e1a2f","823182db3970b37f6d5aa767223f4fbe","7edd49b079e2e5e85a85c68763e17b48","17224bbbe5741e50b441aaa006645411","79b2f4aad51216904e9cf9f526aafd22","c5e6a307f94e0d68f965a1adf14a0470","9ff3e6a8955beedc7411b4b81208ff21","fe6575a7274769cf89ef14e56944c670","ee8e1b437964f688824fce0601ba98fa","2bc9f6917c7270e2149d35c24167acc7","ff3d4558cf7ad45d4b5d5acd2c1e96af","c8f3a55f64825b8fc1e7818b071cdb1c","c82e137d7c2ddd67a9b701524bff9a4a","ad9044ac9c8795cdb71cae06c48f51a5","2eda3749b703eab91086b716da112e5c","88c0e4a50c0be054666f69866766eed3","4889bef43c36055faa693c260fa18026","43fd70a7729eea11d92658f1c41a5816","c8d9d995ea20bb0d49ecce90b7007dec","d3d3caf7dfe7552d1de05d4036a65bb8","2df54275ca18b440759553e0eeea734f","acdfac8cdcf49ef7386d6ddb11ab4b82","1a4252d161104b6da374910f5e4a2cd5","467293192e608f66d181aa8ea8eeeabe","7c5bb00ac918a50e5434829ee8f6d541","f291ea624acab71743b1871f48a633b6","2f7ba4e1367ea9d23ade115c7d3e458e","e5768ca3d2b57534fc8e1951c5c8e760","a734e962cf7c479c553985a963a83849","7cf40d776d2e52a696d7eb6c400ba1fc","26a67a83137f61edc9ad71b60911ca00","799a7a4cd666475a607068a0d859b838","1c7284c71052c6c354054128a3c67e9f","b6e2179457f5acbbbf1e7513b89970bd","d31e3c61f17db5a47cc15da7b9407e17","66cde9aa090d033a9e71e4b4e958c7d0","28a502e4a2a6ce39a17964ce60e1f15e","3837b90897d3c8974f7da6ab8a2072e2","d188c9031d5600a8429389c2b9e8aa82","7d028f585c287304ea1e80f3dbded285","1e4615c864f153ff2f0bbdf057732a2d",{"version":"20bb6da6111adf285874a1d6d782edd7","impliedNodeFormat":99},{"version":"0858f1c4a2994450631222395224afaf","impliedNodeFormat":99},"f066a265e816451811d3e6d54657e1dd","bd4928b197a5aa6ce4432a6d80b79e93","a2114c0efbb92a1723064cb3291922ec","f27b97e2d7142ec08e5887895f0622d3","1b98adb9b94f359b7c823fde91d02976","d0d1874ecab211190d6f849e6b6b18c3","d4cceea2ac475b0796a2dbef7cceec1e","56489e8cce06f36f1522b781971e5248","d6e085d96ad580280f0f2887cc4847df","224bb5d88e3a553682770b0628aa6575","188e98e28be388e69ef97b201432860b","7a230c0d589d7e562256cc9e2e59f056","a9fa2b6dc6fdc8f840826607ecee4f3b","af9a4c0dfb988778db7cca7edae80f64","dfb0f9238a3009f1e0a2b908bf3431ee","91e5cbc267a5506b430db58385f24dcd","216c43467a6607517ab83cb2813a182d","237b0738e3b3d8c3f68566d54f9bc40e","56d080dfccb3c53a2d6c74c4f24252e3","46115cdcc505390fc179c8044784bfdb","09236d421d18c90c9cf2b1a62df88e93",{"version":"9928d2f8e89c54210e9468c439af7e46","affectsGlobalScope":true,"impliedNodeFormat":1},"9da7817000afeeeea3222d0ff2a686c6","2cfba9984aed78da242b0a21e3f38a2a","e93eb137b979617ec06b22a362976ce6","c0ec98811b4559ddda1f61ba53e1d2d4","9de6d4b67fc1b39b6dda81b6f93579dd","f150286488a8ca9e5402dd15c8957340","31ce40f173f27100522a719437fcfd9c","01253493709f6c42fb5b70e764ef90cc","7aa0667e23415be0a645dfcf2b47c82e","4efac62cab7941afad9cadf1d94be7f3","e0f557cdd6695b87547a877b69ca38b9","70ad1c3b71a769b2a1a584c774788db7","642f6536f2a6b5bdbafd4e25f407d2c7","1db38078e8dbd37f16947069fd0093c6","fe812c7b8986cf1c50ce352e9e3f8c89","a9b6a70f9e138db0cacf973b904f9ce8","138603e1e6787901dc8761a2803a6310","8cdf819bc802d165541b23781a845948","23133f69c05e8d7c456e1a9d68c1fffc","89bcd59d3d48cb11935ff1cfa15070f3","6502191f732e6a899b71d18f2cb7a669","83a6c12fe0d568638a6e8db98c137c49","eaf3ad596f3125f9a6a6986afbc4a730","3c2f892a82b351392b98c312e067fa15","cc262de9275b1c5fa529688f33ceae7f","7acde96d9deadd2884a93ae4bba972da","b7f217cb2b3f9082360e5684f55f8cc1","bffc4e97a99bff31a3686a5c688581f0","8ce2d57bab6ef91e5eddacbf7d7f0181","0331baa726704b161af0efe64f980e41","3e47b1dab9282fd8fd4922d3f0655314","0e52a45f8d24b10b300a582bbc389238","38586984d045a69166f13015d71501b2","256153f676e34a933916962fe97f4749","da107fb4df9e8676ccef0f7b37ea53ce","5351296bd2f9878156aef8c681e4d66c","eac13417806e20f52577313fcc91eaf0","5ef004c7759cbb3c9b824228ae4f502a","6f29a9c10351aafe84986db22f67df8a","b41b7744429d74640dd2a1cb87b3199e","09182295d359b15a9facd08f8fd51966","6c7c40d6161213505b0b2a0991aa708b","c61dcede83e20904c8751b2d08beb296","6a1ef55dc603c92ba031491cf46c78a6","6d6c5e4f921002d2a37f4e7750513f8c","d9d2d04eb9d7c7a35ea9249d96ab66e9","c92e37bef68312b0809b209dd35bc2ee","46d5eb0382f3ca27ce2af109ac132709","1f9ff9d0706bcf42c48445798e0aa736","18c29f2c9116baa565528501a8d7a367","0fba992bccaca17b160c8f20986c8b30","a4e850cd58d40f96cca03c145e523ea7","1f18f87f73dd7802d6ac6d69f9791f58","cd88c0466b9ef15bdbc49bfe4acd11d5","640946e7d029e8acebd2aafdb55d0d59","04092ab5516d57c53e4b6d4385217184","1372fea4f73fc1f594cf3ffa58c56484","c8693ee5630c780142bb6a834f71cb9d","296385a085b040854ed133988295df0e","421894f071bd25962a3a1be53b0d4dcc","c3f349926d6adec4cca7f8537dce5cf7","4af073c9eb91788541927099f308efd7","296385a085b040854ed133988295df0e","03f871959764d576bb2b840df3a913a6","9a71410b4f55fc6bb470c04302216657","b003047926d90418666cdbf32e9c25bb","8a9f1f50e123261c03d7cf6e5d17cbc0","fbb1086d78fad2e81eefa859d53b6ffd","fa614d3a843db2f4f4f804155cf537a6",{"version":"db16c16573abd51fedfa8192d0ceeb79","affectsGlobalScope":true,"impliedNodeFormat":1},"7c4aed4001ce0cf61ea56e4fe170a8aa","d92ae047ecefd1ea6f15d92508c96cf7","bc705196fbb186534806f8d052a7939c","4381addfae837b659452efdd7b8192a4",{"version":"803b0e4e42d25332e9f22f1b5f31e50d","affectsGlobalScope":true,"impliedNodeFormat":1},"ca4dd245f2032f512d1330de2593acd9",{"version":"3585cc524c08b2eb40ab817052f89462","affectsGlobalScope":true,"impliedNodeFormat":1},"bb3aaf40646363c84e7f812662701116","2640ffe7f041f216a14f18785059f706","f54c29ade8d0c2940399d6ce4c07f4d8","ed4ce0ea67836b63d1620265be339a88","25d3d41f8140ef5f43c8793a0e21a8e5","704e32e377e486f16b2694b56868448f","67fd4c2cdeac0ac2b2f81f5a4e5412a1","5945eb052c3c7a4e81ba8edc80bbd6e0",{"version":"9b0e3ece53adb5a199e3ea7f284d6831","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6de7bcb8b8e5eb18762490bcd9523753","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a48d8bdcd3d359b71b899ac61f8982df","affectsGlobalScope":true,"impliedNodeFormat":1},"6959ae08cf99993a8c4c7a323e8550b7","d1258ed760464b2fdf7b9387e8a2a0db","a90efa10f81813510ca62670ce290c06","b6b079b1f78ec10c992182bad5ca395a","2f2991fcd85839574abe82038a21cc1a",{"version":"783c17923bf66c26b45994a454207a72","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"97960cd63d59c4ff1d7b2bb54433554e","affectsGlobalScope":true,"impliedNodeFormat":1},"b210cf73199ba01431d4c87407e1deea","db4704d82c740ed3bd067c9bae72d092","597ac0f5916eb7fa9012761f13f56093","cade96afa826037ecc01613844c9264c","d5795c50bb51df53fe14a492eb745d0a","3756c284197b7679cf049e3c5b561a23","7690938217c0e7ee0751d190811c76b4","b9b06180330b55ae7dbc2d2848642a40","2059c86da9fd1f7265a8fe7b9a8cb7b5","83f489584487628e64b36bbf3acffb5e",{"version":"3bcebaa5da25566448298cb46f5aaac2","impliedNodeFormat":99},"ae443423f1f2fd06240155e9d13009ba","7011843cccd5b9a4e2798fb084f284f5","0ea2880ef03abbe71a6e0abf72cce1b6","7421c201da65708fe0237a754f1380e8","4765edb50ad147e6aa1c96977edd4567","9ab5b4a18e12baa493c9fbdd71496f10","b89fc8302f8afcfa697dadae9ef5ea0c","d7a42093e5556613a04148b815a17354","d021b5aa98a36283b12956ce0733d9b2","11054621fce4b336988bec4c039bac01","4d9121aa9ddd26756748a8b9ad966489","a2a3fa7e62a92716d943ed59878a4628","47760859353f290db4ec4e84f32a459f","34baea148056e93e872e6aa6bd2ebe68","a42fb0e64eb607778703a2a9321123f0","042d2c6925f675618fda31b31c13291c","96573853f39a929ea01fc2a7e505b7cb","7c057d778d43602ac8eaa52ec0845917","cd07fc30e4bc989a49610f7c66a0f9a8","1b7943114efb1d152140a212acea79e3","ef877e162fc332990af7cacdea08b150","13de4e76fae71b4f364037d7401a1fe0","58265df132896c62d1f7a04f0e7879cf","ebcd8513410ff2683462e70ed75833ea","ea34d9a27f0e45fe8ffc8dfb27629397","143fd82e3c67465fc746543814fb4f37",{"version":"cf6773490f99c8404606148fe34472ea","affectsGlobalScope":true,"impliedNodeFormat":1},"7b3afeab1ca6d7c835f0fa63ebcb17a0","81de33ebc29f505cbb508380190230b0","2e0b6e283edd09a579e5fa94f5d5b4b8","7fca34cfd03e5f967757d90489dd67d0","926a3938324f8233423a6413815bc16d","58e9b716b50fdc8506289bd37edd9a55","8f4109203208f26263f439ab576f3820","308eafbeb74b0d55baadf9acf5c5ecea","4501167a04f84205017251407e6ed43b","023aeb43ff88750e72f190940351f626","f14756420aae9617233a625a700df307","2ce69d3c855f80ec61d119235ae9bce4","f9057fec5678e25d677852bc661b241e","cd5c183c2bad150213a0cccaafe937e2",{"version":"550c8e0d05da86873f96cf1a314ef941","affectsGlobalScope":true,"impliedNodeFormat":1},"f8059a9ddf1aeefd103fce9c853541b9","beb511f00867fd1032ebfaf27853a298","0a234d3f5a48c7eb32f674452b53c71c","3b8ac2fdcfccd4da572be2710fa7cb56","8482ca4197b18e383c3025ec8da61820","0cb20331bc79bb7b2a009c05f0e1a6c5","48921367483ebd5bff9f1f0f1c3280de","bd56909ab3d1944a9148a0c1dbdb5527","2fdd8675f5ae7c7ad8e5bfe385e8700d","810e99a35d5ec71e035dc00ce00964da","1fef7e952b2e7ece565f3cd6627dcec4","705d9a55ffbe7c9e6c69adfa0a202d0b","5304fb07071dbacfe90bbb62e9fc5c20","b85d5dd3038737c150ebb8d52b9d5fdf","bc1224d7e481d8bb465c663ca09f6368","b344c7f362a9fb040f4e7ddfaadffe07","077261d407cb2ac05d75b8cda6435896",{"version":"fd1fdb774a7f964aef7223f4f3f44400","impliedNodeFormat":99},{"version":"a37fd350b6509fd0ff581ff3af3466eb","impliedNodeFormat":99},{"version":"504f4ee233c3468d53b420bc78fbaff0","impliedNodeFormat":99},{"version":"13f46a1ecb38682e78f9743987e7cd41","impliedNodeFormat":99},"fd1fdb774a7f964aef7223f4f3f44400","7583963971ebd5ce1c35de4774a9cc7f",{"version":"4774e503a887997ab39616bc309b4047","impliedNodeFormat":99},"0687bd368bb58e631325f24b294b8bb7","f8a3459527842c574d07391d5d5af982","f36ef158a27bafd05c828f466c95be53","7581ecf75f8008c8d76a81e8fb1b4e6a","8829f5982af596616a839da1807c12a2","bdeeaeff364a742f0364498ae0973d5f","a1e866545efcb5dd341dffd8fee3e983","c8f34ec4a4abd4cc9eec05948a3bd865","968806db178428f9e76ca510bde79ac5","4a78b9a5bd3caac42b4460ab801ccc0e",{"version":"755636ad6f32b63f262ec9940496a366","affectsGlobalScope":true,"impliedNodeFormat":1},"d50c07fb8c9a5dfb9a15181ac8968175",{"version":"7f1d6a5aa7d29c543afca00e231eee8f","affectsGlobalScope":true,"impliedNodeFormat":1},"26d00631c44d3a50d5a92da1414e0c88","694a9a06d2a5a74c1d3603382cdf3e5d",{"version":"b8c16bbf6b5f0211d603d4fec7888d86","affectsGlobalScope":true,"impliedNodeFormat":1},"5319babd4c1595ff849a69d798322c13","60fd3a4d43d3eb45a3ada54ebb7db1ec",{"version":"aea9663d5c1569f8b4df17c10d3eae93","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74357a6c193bd291d596dde293031f2d","impliedNodeFormat":99},"f7ddb706be7b25db72c13420fdec72d6","ad33e60cc1333c53c4652c161034f41a","5e4e8b12286a657fc5e3ddac2c80aaaa",{"version":"c5b1892fde348ffbb41951f57c97e586","affectsGlobalScope":true,"impliedNodeFormat":1},"9cf20b56f3bc85d966b23b332105d75e","26545b8a6dac33cc00ad7464f01859a3","084cc74d2b652ce07736f1ff0758c18f","8be0e931560df6b79381f64de8c7b2cd","7a3d0dcc3a43d5b05f235871b6d51ba6","0c192d9e7b8f52a4303aad785fbd0f53","b02989afcfd55c5e758d18816fb1a153","cd7942cf590c3a6113ed43616b362db8","0dc21776bf1e43121fb5f0166c388f2b","077183ae76bf300c0d7ad6801a17afb7","7a085ea1e3db3700f44fd4771fd458b2","8cdd2af96c604db37589b1e5b0edb8e4","0af42c5ac59b4d86bb7ae541acb1468c","ecb0015cc65f2d5549fd9cf669fd1a63","cd8b51b1af9e959af6a46b5be2e7ba2d","961a346852f3db70d79cc1ea6f81d763","d8038c8ab2de2e6c8491ec90db2b1a71","ced5686adcd51265e7bc2662d0915168","6d2ae5afca0eb14e0c433d03299abe31","8e40eee2d4d850f8606360ddaaf0952a","6d6a2cd9c0ddf7bed38ba9c177aafb13","dfac1e72e47eb5171490e71099b67a30","ec4a6fb6da0976feaa6d2b348b24ff3a","8471ef9dedb3ac13ffd6a445f3ac882f","c14003c53fec963482de538b7bd6ed96","77f73791444537342e4b4be5aafc17bf","37ca91b0f503868a15d9931cd6c09b42","1f3989f599be7361b4e56ccefc031412","eb87f57191e15fe17e9a95de2173dfd7","40dbabc8ea7010226036b2b6bc9d44cb","2c1c06e01060291282f3c3ee4bb8c88c","1681ef5d38499b145f59e59fdc3e4ba5","6f9792a3a0013713c3c018d9fdaf341b","15809f6f54746f8ed983d8cecc3ebe0c","f88212b10fb6a4517f50e82f0f8590d8","975baad43a0634f6bedbc2ca43053aa4","f6cb107aea5022c0c76c49705663c8fe","5c08b27e30f64bc614248033fd91e44e","076a89f65b442c841819c0729b9dd220","500771332b1a5f0ea339543ae8a7ae46","a95e526fd4bb8013eb63bdb05323d375","5c0a4e9d4733a68ded16228c5c7eae4a","98be00d3ab9d40e3bb3c8c59267f05d4","b452b0d8dc787ca19d23f5141a8ac4bf","f7c46f00ac22078ad06d86214ec75b1c","461c5b952082676766c77b527cb77a35","c4fc6b9462c7a8871fe7017e6a2cae49","de67266a6da2ff74a284ead6acb791de","a91be27bf306a0772c42877137a205b5","a8dd6c8b4079d2d5bf81af3386b7aa2c","e543e87e9e7036cd9516ed130d95f3e4","21b39293a6e5b2379acdcfc1b2db66ab","302f9c9e1a7feb11e58850f5e7ab1eca","7b1fa01f8125020e65d81d49714b595c","31687a1bae65eacc7f2879f9e24f7513","73cac4f0263748025fab6ffcaa081fd5","06f34447fb77d1409de3c23a5393c2e9","fee41cae8c8892a4af8800b5c3748710","640c81b2963796dfb4153cf4f6c6e2ea","b690b1cef01610d8758caa19a2266204","131f9b1813cfae832c26a348b48b1df2","d376e8e9d0f94b49177af3b9d5af2f67","9db55f843e7e80fb568d006942712933","5ea86b3d836fb7928b542db49b8f6c72","f38edec409a5c4de1cd44380c5750c49","6c6066b61bd3a47d8cac572fb359e776","ec0209ccda4e46bbc5c2a0bb66050380","e331128364d4d92bc8e2964e28a3986f","0c9933e12631751ce20ea3411ad66945","0aadc61f2a52b1048745d6f7c42b7a48","c5a07295375d5c65ed0c52a7abdcaf45","aed2abb53b939a5403222ec2a785e7c0","b96890fa5058d514f37daf1b373d92ce","c8d92f3366c1fca91747b77a29b0f959","2ee9afa170b5b33f780dd0baad75f2c8","68e97bdc2522969cf924786e93fd6273",{"version":"06769bc8f9ac8e77aa17063aa24033e3","impliedNodeFormat":99},{"version":"298d3f955f2c6c35717e5ef85bbd6127","impliedNodeFormat":99},{"version":"78b86c3ccfe242695b88e6bc7f931e65","impliedNodeFormat":99},"338b28a2c204c2ab22a76913ac769f3e","0872f8d2736041c859ccad95e00ef424","19c7641b62556c1c081bd997e2f32a2f","cc4d965d57755d023b98e1d0e29e7f16"],"fileIdsList":[[83,149,150,163,164,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,483,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,472,473,474,483,484,485,487,489,490,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,487,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,472,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,486,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,471,486,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,470,482,484,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,475,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,476,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,476,483,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,478,479,483,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,477,480,481,482,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,480,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,469,472,478,483,486,489,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,468,469,470,471,483,486,487,488,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1399,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,304,378,456,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,941,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[307,311,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[309,311,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[309,311,344,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[307,308,311,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[308,311,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[308,344,345,346,347,348,349,350,351,352,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[308,311,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[309,310,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,324,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[309,311,314,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,316,326,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[307,311,324,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[307,311,324,327,328,331,332,333,334,335,336,337,338,339,340,341,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[310,311,314,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[310,314,315,320,321,322,323,325,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,324,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[310,311,313,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,314,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[307,308,311,312,315,330,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[316,317,318,319,329,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[311,327,328,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[308,331,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1020,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1020,1133,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1021,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1020,1021,1022,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,927,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[249,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[252,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[257,259,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[245,249,261,262,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[272,275,281,283,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[244,249,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[243,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[244,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[251,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[254,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,284,285,286,287,288,289,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[260,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[256,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[257,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[248,249,255,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[256,257,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[263,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[284,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[249,269,271,272,273,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[272,273,275,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[249,264,267,270,277,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[264,265,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[247,264,267,270,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[248,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[249,266,269,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[265,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[266,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[264,266,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[246,247,264,266,267,268,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[266,269,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[249,269,271,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[272,273,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1342,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1336,1338,1340,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1336,1338,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1344,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1337,1338,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1349,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1355,1356,1357,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1359,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1341,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1340,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1338,1349,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1398,1399,1400,1403,1404,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1397,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1401,1402,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1401,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1406,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1433,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1436,1437,1438,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1440,1441,1442,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1443,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1446,1474,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1445,1451,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1456,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1451,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1450,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1468,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1464,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1446,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1446,1463,1474,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1445,1446,1447,1448,1449,1450,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1477,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1480,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1483,1484,1485,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1407,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1486,1488,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1494,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1496,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1498,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1500,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1501,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1477,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1443,1507,1508,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1443,1504,1509,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1505,1506,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,861,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,812,813,814,815,816,817,818,819,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,861,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,861,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,927,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,926,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,924,925,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1518,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,999,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1522],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,998,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1521,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,997,998,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1482,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1483,1487,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1528],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1612],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1609,1610],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1531,1532,1533,1534,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1557],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1557,1570],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1535,1584],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1585],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1536,1559],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1559],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1535],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1588],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1568],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1535,1576,1584],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1579],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1581],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1531],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1551],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1532,1533,1572],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1592],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1590],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1536,1537],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1538],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1549],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1535,1540],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1594],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1536],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1588,1597,1600],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1536,1537,1581],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523,1530,1611],[83,149,163,241,242,290,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[83,241,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,861,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,999,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,861,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,861,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1422,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1418,1419,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1418,1419,1420,1421,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1418,1420,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1418,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1426,1427,1428,1429,1430,1431,1523],[378,492,497,501,546,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,788,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,494,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,570,625,696,748,782,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,501,502,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,540,545,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,510,540,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,514,515,516,517,518,519,520,521,522,523,525,526,527,528,529,530,531,532,533,543,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,513,542,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,542,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,535,540,541,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,540,542,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,542,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,540,542,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,513,514,515,516,517,518,519,520,521,522,523,525,526,527,528,529,530,531,532,533,542,543,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,512,542,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,524,542,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,524,540,542,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,499,501,502,507,540,544,545,546,548,551,552,553,555,561,562,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,540,544,546,561,565,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,540,544,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,511,512,535,536,537,538,539,540,541,544,553,554,555,561,562,564,565,567,568,569,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,540,544,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,536,540,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,540,555,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,500,501,540,549,550,555,562,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,556,557,558,559,560,563,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,499,500,501,507,535,540,542,549,550,555,557,562,563,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,501,507,544,553,560,562,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,540,546,549,550,555,562,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,547,549,550,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,549,550,555,562,565,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,500,501,502,507,540,544,545,549,550,553,555,562,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,498,499,500,501,502,507,540,544,545,555,560,565,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,499,500,501,502,540,542,545,549,550,555,562,566,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,512,540,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,494,502,510,546,547,554,562,566,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,500,501,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,511,534,535,537,538,539,541,542,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,501,511,535,537,538,539,540,541,544,545,565,570,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,500,501,502,507,542,545,563,564,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,495,497,498,499,502,510,546,549,783,784,785,786,787,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,600,608,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,600,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,591,592,593,594,595,603,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,602,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,602,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,600,601,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,600,602,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,600,602,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,591,592,593,594,595,602,603,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,582,602,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,590,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,499,501,502,546,600,607,608,613,614,615,616,618,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,600,602,605,606,611,612,618,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,600,604,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,571,597,598,599,600,601,604,607,613,615,617,618,619,620,622,623,624,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,600,604,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,600,608,618,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,501,502,549,600,602,613,618,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,606,609,610,611,612,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,497,501,507,549,550,600,602,610,611,613,618,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,607,609,613,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,549,600,613,618,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,500,501,502,507,549,597,600,604,607,608,613,618,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,498,499,500,501,502,507,600,604,608,609,618,620,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,501,502,549,600,602,613,618,621,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,600,620,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,494,501,502,546,613,617,621,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,500,501,507,610,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,571,596,597,598,599,601,602,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,571,597,598,599,600,601,608,609,620,625,788,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,500,501,507,604,608,610,619,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,495,502,546,679,686,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,988,989,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,989,990,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,494,495,501,502,546,680,686,690,696,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,988,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,495,502,546,679,686,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,927,928,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,928,929,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,495,501,502,546,680,686,690,696,734,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,927,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,501,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,667,673,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,510,667,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,627,628,629,630,631,633,634,635,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,670,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,637,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,662,667,668,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,667,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,669,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,632,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,667,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,627,628,629,630,631,633,634,635,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,669,670,671,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,636,669,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,639,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,667,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,632,639,667,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,632,667,669,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,499,501,502,546,667,672,673,674,675,676,677,678,680,685,686,689,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,605,667,672,680,685,689,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,667,672,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,626,636,662,663,664,665,666,667,668,672,678,679,680,685,686,688,689,691,692,693,695,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,667,672,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,663,667,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,667,680,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,500,501,507,549,550,667,680,686,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,677,681,682,683,684,687,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,497,499,500,501,507,549,550,662,667,669,680,682,686,687,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,501,672,678,684,686,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,549,550,667,680,686,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,549,550,680,686,689,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,500,501,502,507,549,550,667,672,673,678,680,686,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,498,499,500,501,502,507,667,672,673,680,684,689,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,497,499,500,501,502,507,549,550,667,669,673,680,686,690,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,636,667,671,689,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,494,502,510,546,547,679,686,690,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,500,501,507,687,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,626,661,662,664,665,666,668,669,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,501,626,662,664,665,666,667,668,672,673,689,696,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,694,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,500,501,502,507,669,673,687,688,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,679,809,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,985,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,985,986,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,495,501,502,546,680,686,690,696,734,809,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,510,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,498,499,501,502,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,501,502,505,784,788,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,788,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,726,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,716,717,718,719,720,721,728,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,727,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,727,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,726,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,726,727,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,726,727,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,510,727,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,716,717,718,719,720,721,727,728,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,707,727,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,715,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,499,501,546,726,733,736,737,738,741,743,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,605,726,727,730,731,732,743,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,723,724,725,726,729,733,738,741,742,743,745,746,747,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,726,729,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,726,729,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,726,743,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,501,502,549,726,727,733,743,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,730,731,732,739,740,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,501,549,550,726,727,731,733,743,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,733,738,739,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,500,501,502,507,549,726,729,733,738,743,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,498,499,500,501,502,507,726,729,739,743,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,501,502,549,726,727,733,743,744,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,726,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,494,501,502,546,733,742,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,500,501,507,740,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,722,723,724,725,727,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,501,723,724,725,726,748,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,495,502,546,733,735,742,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,495,501,502,546,733,734,743,744,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,501,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,503,504,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,506,508,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,501,507,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,501,505,509,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,496,497,499,500,502,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,754,775,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,775,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,750,770,771,772,773,778,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,777,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,775,776,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,775,777,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,750,770,771,772,773,777,778,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,769,775,777,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,777,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,502,775,777,783,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,494,499,501,502,546,754,755,756,757,760,765,766,775,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,605,760,765,775,779,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,775,779,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,749,751,752,753,757,758,760,765,766,768,769,775,776,779,781,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,775,779,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,760,768,775,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,500,501,502,549,550,760,766,775,777,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,761,762,763,764,767,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,500,501,502,507,549,550,751,760,762,766,767,775,777,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,757,764,766,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,502,546,549,550,760,766,775,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,501,547,549,550,766,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,499,500,501,502,507,549,550,754,757,760,766,775,779,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,497,498,499,500,501,502,507,754,760,764,768,775,779,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,499,500,501,502,549,550,754,760,766,775,777,780,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,493,494,501,546,547,549,758,759,766,780,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,500,501,507,767,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,497,749,751,752,753,774,776,777,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,775,777,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,499,501,749,751,752,753,754,768,775,776,782,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,500,501,507,754,767,777,783,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,492,498,501,502,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,494,495,497,501,784,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1028,1034,1035,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1036,1101,1102,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1036,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1036,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1029,1030,1031,1034,1036,1039,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1030,1041,1055,1056,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1039,1040,1041,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1029,1034,1036,1038,1039,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1028,1039,1040,1041,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1026,1042,1047,1054,1057,1058,1100,1103,1126,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1032,1033,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1032,1033,1034,1035,1037,1048,1049,1050,1051,1052,1053,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1033,1034,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1028,1033,1034,1036,1049,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1034,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1034,1035,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1032,1034,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1041,1055,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1029,1030,1031,1034,1039,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1037,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1030,1038,1039,1040,1043,1044,1045,1046,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1029,1034,1036,1038,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1036,1039,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1038,1039,1040,1052,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1036,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1034,1039,1050,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1039,1104,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1036,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1034,1039,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1039,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1037,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1034,1039,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1059,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1039,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1028,1034,1038,1039,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1029,1034,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1029,1034,1040,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1029,1034,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1036,1038,1039,1040,1052,1059,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1052,1060,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1060,1062,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1027,1034,1036,1039,1059,1060,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[296,378,461,462,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,462,463,465,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[292,296,297,302,378,461,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[292,378,462,464,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[292,294,295,296,297,299,300,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[301,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,967,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[294,297,301,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[297,302,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[292,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[297,299,301,378,461,466,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[297,301,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[293,294,295,296,297,298,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[292,295,296,301,302,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[299,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,939,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1494,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1491,1492,1493,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1023,1024,1025,1127,1128,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1023,1024,1025,1127,1128,1129,1130,1131,1132,1134,1135,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1023,1024,1025,1127,1128,1129,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1128,1134,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1023,1024,1025,1127,1128,1129,1137,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1023,1024,1025,1127,1128,1129,1130,1131,1132,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1130,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1023,1024,1025,1127,1128,1129,1137,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1023,1024,1025,1127,1128,1129,1130,1131,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1019,1128,1134,1135,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1023,1131,1135,1136,1314,1315,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,490,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,921,922,923,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,921,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1184,1185,1186,1187,1188,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1203,1204,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1155,1165,1184,1191,1284,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1174,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1171,1174,1175,1177,1178,1191,1218,1246,1247,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1178,1191,1215,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1256,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1288,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1191,1289,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1289,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1192,1240,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1164,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1158,1174,1191,1196,1202,1241,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1240,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1172,1187,1191,1288,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1191,1288,1292,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1288,1292,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1155,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1184,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1254,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1150,1155,1174,1191,1223,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1174,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1216,1219,1266,1305,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1177,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1171,1174,1175,1176,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1160,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1272,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1161,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1271,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1168,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1158,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1163,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1222,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1223,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1246,1279,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1215,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1164,1165,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1166,1167,1180,1181,1182,1183,1189,1190,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1168,1172,1181,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1163,1165,1171,1181,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1155,1160,1161,1164,1165,1174,1181,1182,1184,1187,1188,1189,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1167,1171,1173,1180,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1171,1177,1179,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1150,1163,1168,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1169,1171,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1150,1163,1164,1171,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1164,1165,1188,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1152,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1151,1152,1158,1163,1165,1168,1171,1191,1223,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1288,1292,1296,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1288,1292,1294,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1154,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1178,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1185,1264,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1150,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1185,1186,1187,1191,1196,1202,1203,1204,1205,1206,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1184,1185,1186,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1174,1215,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1162,1193,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1169,1170,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1163,1165,1174,1191,1206,1216,1218,1219,1220,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1187,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1152,1219,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1163,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1187,1191,1224,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1289,1298,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1158,1165,1168,1177,1191,1215,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1154,1163,1165,1184,1191,1216,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1164,1188,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1164,1188,1191,1192,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1164,1188,1191,1209,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1288,1292,1301,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1184,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1184,1191,1216,1220,1236,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1184,1191,1192,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1191,1223,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1168,1191,1206,1214,1216,1220,1234,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1160,1165,1184,1191,1192,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1163,1165,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1163,1165,1184,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1202,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1159,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1172,1175,1176,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1161,1184,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1171,1172,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1191,1245,1248,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1151,1261,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1171,1179,1191,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1171,1191,1215,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1165,1188,1276,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1154,1163,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1184,1192,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,827,830,833,834,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,830,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,830,834,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,824,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,828,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,826,827,830,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,824,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,826,830,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,821,822,823,825,829,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,830,838,846,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,822,828,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,830,855,856,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,822,825,830,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,830,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,821,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,824,825,826,828,829,830,831,832,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,856,857,858,859,860,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,830,848,851,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,830,838,839,840,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,828,830,839,841,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,829,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,822,824,830,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,830,834,839,841,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,834,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,828,830,833,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,814,822,826,830,838,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,830,848,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,841,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,824,830,855,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1425,1426,1427,1428,1429,1430,1431,1523],[378,791,792,793,794,795,796,797,799,800,801,802,803,804,805,806,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,791,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,791,798,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[139,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[162,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[151,152,163,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[153,154,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[151,152,153,155,156,161,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[152,153,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[161,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[153,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[151,152,153,156,157,158,159,160,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[139,142,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[132,139,140,141,142,143,144,145,146,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[147,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[139,140,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[139,141,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[85,87,88,89,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[85,87,89,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[85,87,89,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[85,87,88,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[85,87,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[85,86,87,88,89,90,91,92,132,133,134,135,136,137,138,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[87,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[84,85,86,88,89,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[87,133,137,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[87,88,89,90,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[148,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[89,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[236,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[228,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[228,231,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[222,228,229,230,231,232,233,234,235,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[228,229,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[228,230,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[167,169,170,171,172,223,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[167,169,171,172,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[167,169,171,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[166,167,169,170,172,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[167,168,169,170,171,172,173,174,222,223,224,225,226,227,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[169,172,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[166,167,168,170,171,172,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[169,223,226,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[169,170,171,172,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[171,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[239,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[164,165,237,238,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[359,363,366,367,368,369,370,372,374,375,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[376,378,381,458,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[343,378,467,491,808,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,949,984,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,343,367,378,467,491,790,807,808,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1000,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,999,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,467,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,936,937,949,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,238,239,304,305,306,359,360,361,364,365,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[239,343,366,378,467,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,937,940,943,949,954,955,956,957,958,959,960,961,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[305,343,378,467,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,933,940,943,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,459,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,305,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,305,306,378,467,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,937,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,359,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[360,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[360,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[368,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[343,378,467,491,790,807,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,938,940,947,948,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,948,949,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[361,378,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,363,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,343,363,364,378,790,807,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,362,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,343,362,365,378,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,358,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[359,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[359,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,933,963,964,965,966,971,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,963,994,1003,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,808,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,491,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,973,994,1149,1316,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,367,378,467,491,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,968,973,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[164,237,238,239,291,362,363,366,368,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,292,343,369,378,467,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,943,944,945,947,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[363,378,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,946,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,343,362,378,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,946,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[377,378,380,459,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,807,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[239,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,460,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,971,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,371,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,371,372,378,467,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,291,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,343,368,378,460,467,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,943,946,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[343,378,460,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,947,994,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[239,366,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,943,962,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[371,378,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,940,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,371,373,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[374,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,937,940,943,978,979,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,354,355,356,357,358,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,343,354,356,357,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1327,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1329,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1331,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,356,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,354,355,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,353,354,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,357,358,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,949,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[342,354,355,356,357,358,378,467,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,949,981,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,239,376,378,456,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[367,378,457,491,807,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,968,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[343,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,971,983,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,949,994,1149,1316,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,457,459,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,969,970,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,375,378,807,808,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,937,940,943,983,984,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,786,809,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[237,304,343,358,359,360,376,378,467,790,807,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,933,934,935,946,947,950,962,971,972,974,975,976,977,980,981,982,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[304,378,459,491,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,933,983,992,993,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[164,237,291,304,376,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,933,936,949,954,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,963,964,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,951,952,953,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,951,952,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,951,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[303,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,292,302,378,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,453,454,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,454,455,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,453,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,379,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,452,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,444,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,444,447,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,438,444,445,446,447,448,449,450,451,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,444,445,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,444,446,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,383,385,386,387,388,439,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,383,385,387,388,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,383,385,387,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,382,383,385,386,388,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,383,384,385,386,387,388,389,390,438,439,440,441,442,443,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,385,388,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,382,383,384,386,387,388,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,385,439,442,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,385,386,387,388,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,387,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,789,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,942,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,788,790,811,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,930,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,696,809,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,987,988,991,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,696,788,789,790,809,810,811,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,931,932,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[291,378,696,788,789,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523],[378,696,790,814,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,933,973,992,1408,1409,1410,1411,1412,1413,1414,1416,1417,1423,1424,1426,1427,1428,1429,1430,1431,1523]],"options":{"allowJs":true,"esModuleInterop":true,"jsx":1,"module":99,"skipLibCheck":true,"strict":true,"target":4,"verbatimModuleSyntax":true},"referencedMap":[[165,1],[83,2],[484,3],[486,4],[490,5],[473,6],[472,2],[485,7],[470,7],[474,8],[487,9],[488,10],[468,2],[476,11],[475,12],[477,13],[480,14],[483,15],[479,16],[481,17],[478,2],[482,3],[489,18],[471,2],[1400,19],[1399,2],[942,20],[334,21],[312,22],[344,23],[345,24],[346,25],[347,26],[348,27],[353,28],[349,26],[352,27],[350,29],[351,2],[308,22],[333,21],[311,30],[335,31],[340,32],[336,21],[328,33],[338,34],[342,35],[332,21],[307,2],[339,21],[341,2],[320,27],[315,36],[326,37],[321,27],[322,27],[325,38],[314,39],[323,40],[310,27],[313,27],[324,23],[327,33],[337,34],[331,41],[317,2],[316,2],[330,42],[329,43],[318,2],[319,27],[309,44],[378,45],[1133,46],[1134,47],[1022,48],[1021,46],[1023,49],[988,50],[1020,2],[251,51],[254,52],[260,53],[263,54],[284,55],[262,56],[243,2],[244,57],[245,58],[248,2],[246,2],[247,2],[285,59],[250,51],[249,2],[286,60],[253,52],[252,2],[290,61],[287,62],[257,63],[259,64],[256,65],[258,66],[255,63],[288,67],[261,51],[289,68],[274,69],[276,70],[278,71],[277,72],[271,73],[264,74],[283,75],[280,76],[282,77],[267,78],[269,79],[266,76],[270,2],[281,80],[268,2],[279,2],[265,2],[272,81],[273,2],[275,82],[150,2],[1335,2],[1336,2],[1337,2],[1338,2],[1396,83],[1339,84],[1385,85],[1341,86],[1340,87],[1342,84],[1343,84],[1345,88],[1344,84],[1346,89],[1347,89],[1348,84],[1350,90],[1351,84],[1352,90],[1353,84],[1355,84],[1356,84],[1357,84],[1358,91],[1354,84],[1359,2],[1360,92],[1361,92],[1362,92],[1363,92],[1364,92],[1374,93],[1365,92],[1366,92],[1367,92],[1368,92],[1370,92],[1371,92],[1369,92],[1372,92],[1373,92],[1375,84],[1376,84],[1349,84],[1377,90],[1379,94],[1378,84],[1380,84],[1381,84],[1382,95],[1384,84],[1383,84],[1386,84],[1388,84],[1389,96],[1387,84],[1390,84],[1391,84],[1392,84],[1393,84],[1394,84],[1395,84],[1405,97],[1398,98],[1397,2],[1403,99],[1402,100],[1401,2],[1404,19],[1407,101],[1434,102],[1435,103],[1439,104],[1443,105],[1440,106],[1441,106],[1442,106],[1444,2],[1406,103],[1445,2],[1447,107],[1448,107],[1449,2],[1450,2],[1452,108],[1453,2],[1454,2],[1455,107],[1456,2],[1457,2],[1458,109],[1459,2],[1460,2],[1461,110],[1462,2],[1463,111],[1464,2],[1465,2],[1466,2],[1467,2],[1470,2],[1469,112],[1446,2],[1471,113],[1472,2],[1468,2],[1473,2],[1474,114],[1475,115],[1476,116],[1478,117],[1479,2],[1481,118],[1480,2],[1486,119],[1489,120],[1490,103],[1451,2],[1495,121],[1497,122],[1499,123],[1501,124],[1500,125],[1437,2],[1487,2],[1502,126],[1503,103],[1509,127],[1510,128],[1507,129],[1505,2],[1506,2],[1508,2],[1504,2],[1511,123],[1512,103],[1482,2],[1513,2],[1477,2],[1514,130],[866,131],[867,132],[868,133],[814,134],[869,135],[870,136],[871,137],[812,2],[872,138],[873,139],[874,140],[875,141],[876,142],[877,143],[878,144],[879,145],[880,146],[881,147],[882,148],[815,2],[813,2],[883,149],[884,150],[885,151],[919,152],[886,153],[887,154],[888,155],[889,156],[890,157],[891,158],[892,159],[893,160],[894,161],[895,162],[896,163],[897,164],[898,165],[899,166],[900,167],[901,168],[903,169],[902,170],[904,171],[905,172],[906,173],[907,174],[908,175],[909,176],[910,177],[911,178],[912,179],[913,180],[914,181],[915,182],[916,183],[816,2],[817,2],[818,2],[819,2],[862,184],[863,2],[864,2],[865,185],[917,186],[918,187],[1515,2],[1516,103],[1517,188],[927,189],[926,190],[925,189],[1519,191],[1484,2],[1485,2],[1520,192],[1523,193],[1521,2],[1522,194],[997,2],[999,195],[1524,2],[1438,103],[1518,2],[1483,196],[1488,197],[1525,2],[1526,103],[1527,130],[1496,2],[1529,198],[1528,2],[1498,2],[1613,199],[1611,200],[1609,201],[1558,202],[1571,203],[1533,2],[1585,204],[1587,205],[1586,205],[1560,206],[1559,2],[1561,207],[1588,208],[1592,209],[1590,209],[1569,210],[1568,2],[1577,208],[1536,208],[1564,2],[1605,211],[1580,212],[1582,213],[1600,208],[1535,214],[1552,215],[1567,2],[1602,2],[1573,216],[1589,209],[1593,217],[1591,218],[1606,2],[1575,2],[1549,214],[1541,2],[1540,219],[1565,208],[1566,208],[1539,220],[1572,2],[1534,2],[1551,2],[1579,2],[1607,221],[1546,208],[1547,222],[1594,205],[1596,223],[1595,223],[1531,2],[1550,2],[1557,2],[1548,208],[1578,2],[1545,2],[1604,2],[1544,2],[1542,224],[1543,2],[1581,2],[1574,2],[1601,225],[1555,219],[1553,219],[1554,219],[1570,2],[1537,2],[1597,209],[1599,217],[1598,218],[1584,2],[1583,226],[1576,2],[1563,2],[1603,2],[1608,2],[1532,2],[1562,2],[1556,2],[1538,219],[1612,227],[1614,2],[1615,2],[1616,130],[1617,103],[81,2],[82,2],[13,2],[14,2],[16,2],[15,2],[2,2],[17,2],[18,2],[19,2],[20,2],[21,2],[22,2],[23,2],[24,2],[3,2],[25,2],[26,2],[4,2],[27,2],[31,2],[28,2],[29,2],[30,2],[32,2],[33,2],[34,2],[5,2],[35,2],[36,2],[37,2],[38,2],[6,2],[42,2],[39,2],[40,2],[41,2],[43,2],[7,2],[44,2],[49,2],[50,2],[45,2],[46,2],[47,2],[48,2],[8,2],[54,2],[51,2],[52,2],[53,2],[55,2],[9,2],[56,2],[57,2],[58,2],[60,2],[59,2],[61,2],[62,2],[10,2],[63,2],[64,2],[65,2],[11,2],[66,2],[67,2],[68,2],[69,2],[70,2],[1,2],[71,2],[72,2],[12,2],[76,2],[74,2],[79,2],[78,2],[73,2],[77,2],[75,2],[80,2],[291,228],[242,229],[241,1],[973,2],[820,2],[1411,230],[1432,2],[1426,231],[1413,232],[1429,233],[1412,234],[1410,235],[1414,236],[1408,237],[1415,2],[1433,238],[1416,239],[1425,2],[1427,240],[1409,241],[1431,242],[1428,243],[1430,244],[1417,245],[1423,246],[1420,247],[1422,248],[1421,249],[1419,250],[1418,2],[1424,251],[1610,2],[1530,2],[998,2],[785,252],[494,253],[734,254],[493,2],[496,255],[783,256],[784,257],[492,2],[786,258],[567,259],[511,260],[534,261],[543,262],[514,262],[515,263],[516,263],[542,264],[517,265],[518,263],[524,266],[519,267],[520,263],[521,263],[544,268],[513,269],[522,262],[523,267],[525,270],[526,270],[527,267],[528,263],[529,262],[530,263],[531,271],[532,271],[533,263],[554,272],[562,273],[541,274],[570,275],[535,276],[537,277],[538,274],[548,278],[556,279],[561,280],[558,281],[563,282],[551,283],[552,284],[559,285],[560,286],[566,287],[557,288],[536,258],[568,289],[512,258],[555,290],[553,291],[540,292],[539,274],[569,293],[545,294],[564,2],[565,295],[788,296],[495,258],[605,2],[622,297],[571,298],[596,299],[603,300],[572,300],[573,300],[574,301],[602,302],[575,303],[590,300],[576,304],[577,304],[578,301],[579,300],[580,301],[581,300],[604,305],[582,300],[583,300],[584,306],[585,300],[586,300],[587,306],[588,301],[589,300],[591,307],[592,306],[593,300],[594,301],[595,300],[617,308],[613,309],[601,310],[625,311],[597,312],[598,310],[614,313],[606,314],[615,315],[612,316],[610,317],[616,318],[609,319],[621,320],[611,321],[623,322],[618,323],[607,324],[600,325],[599,310],[624,326],[608,294],[619,2],[620,327],[990,328],[991,329],[989,330],[929,331],[930,332],[928,333],[498,334],[691,335],[626,336],[661,337],[670,338],[627,339],[628,339],[629,340],[630,339],[669,341],[631,342],[632,343],[633,344],[634,339],[671,345],[672,346],[635,339],[637,347],[638,338],[640,348],[641,349],[642,349],[643,340],[644,339],[645,339],[646,345],[647,340],[648,340],[649,349],[650,339],[651,338],[652,339],[653,340],[654,350],[639,351],[655,339],[656,340],[657,339],[658,339],[659,339],[660,339],[679,352],[686,353],[668,354],[696,355],[662,356],[664,357],[665,354],[674,358],[681,359],[685,360],[683,361],[687,362],[675,363],[676,284],[677,364],[684,365],[690,366],[682,367],[663,258],[692,368],[636,258],[680,369],[678,370],[667,371],[666,354],[693,372],[694,2],[695,373],[673,294],[688,2],[689,374],[986,375],[987,376],[985,377],[507,378],[500,379],[549,258],[546,380],[550,381],[547,382],[745,383],[722,384],[728,385],[697,385],[698,385],[699,386],[727,387],[700,388],[715,385],[701,389],[702,389],[703,386],[704,385],[705,390],[706,385],[729,391],[707,385],[708,385],[709,392],[710,385],[711,385],[712,392],[713,386],[714,385],[716,393],[717,392],[718,385],[719,386],[720,385],[721,385],[742,394],[733,395],[748,396],[723,397],[724,398],[737,399],[730,400],[741,401],[732,402],[740,403],[739,404],[744,405],[731,406],[746,407],[743,408],[738,409],[726,410],[725,398],[747,411],[736,412],[735,413],[503,414],[505,415],[504,414],[506,414],[509,416],[508,417],[510,418],[501,419],[781,420],[749,421],[774,422],[778,423],[777,424],[750,425],[779,426],[770,427],[771,423],[772,428],[773,429],[758,430],[766,431],[776,432],[782,433],[751,434],[752,432],[755,435],[761,436],[765,437],[763,438],[767,439],[756,440],[759,441],[764,442],[780,443],[762,444],[760,445],[757,446],[775,447],[753,448],[769,449],[754,294],[768,450],[499,294],[497,451],[502,452],[787,2],[966,2],[164,2],[1036,453],[1103,454],[1102,455],[1101,456],[1041,457],[1057,458],[1055,459],[1056,460],[1042,461],[1127,462],[1027,2],[1029,2],[1030,463],[1031,2],[1034,464],[1037,2],[1054,465],[1032,2],[1049,466],[1035,467],[1050,468],[1053,469],[1048,470],[1051,469],[1028,2],[1033,2],[1052,471],[1058,472],[1046,2],[1040,473],[1038,474],[1047,475],[1044,476],[1043,476],[1039,477],[1045,478],[1059,479],[1122,480],[1116,481],[1109,482],[1108,483],[1117,484],[1118,469],[1110,485],[1123,486],[1104,487],[1105,488],[1106,489],[1126,490],[1107,483],[1111,486],[1112,491],[1125,492],[1119,493],[1120,467],[1121,491],[1113,489],[1124,469],[1114,494],[1115,495],[1060,496],[1100,497],[1064,498],[1065,498],[1066,498],[1067,498],[1068,498],[1069,498],[1070,498],[1071,498],[1090,498],[1062,498],[1072,498],[1073,498],[1074,498],[1075,498],[1076,498],[1077,498],[1097,498],[1078,498],[1079,498],[1080,498],[1095,498],[1081,498],[1096,498],[1082,498],[1093,498],[1094,498],[1083,498],[1084,498],[1085,498],[1091,498],[1092,498],[1086,498],[1087,498],[1088,498],[1089,498],[1098,498],[1099,498],[1063,499],[1061,500],[1026,2],[463,501],[464,2],[466,502],[462,503],[465,504],[301,505],[968,506],[302,507],[461,508],[343,509],[467,510],[938,511],[934,511],[299,512],[293,2],[294,2],[297,513],[298,514],[967,2],[295,2],[292,2],[300,2],[296,2],[940,515],[939,511],[1436,2],[1491,516],[1492,516],[1494,517],[1493,516],[1129,518],[1136,519],[1146,2],[1145,2],[1143,520],[1139,520],[1137,520],[1315,520],[1135,521],[1138,522],[1149,523],[1148,2],[1147,520],[1131,524],[1141,525],[1025,2],[1142,526],[1132,2],[1024,2],[1128,2],[1130,2],[1144,2],[1140,527],[1316,528],[491,529],[469,2],[924,530],[921,103],[923,531],[922,2],[920,2],[809,2],[1019,2],[1314,532],[1285,533],[1175,534],[1281,2],[1248,535],[1218,536],[1204,537],[1282,2],[1229,2],[1239,2],[1258,538],[1152,2],[1289,539],[1291,540],[1290,541],[1241,542],[1240,543],[1243,544],[1242,545],[1202,2],[1292,546],[1296,547],[1294,548],[1156,549],[1157,549],[1158,2],[1205,550],[1255,551],[1254,2],[1267,552],[1192,553],[1261,2],[1250,2],[1309,554],[1311,2],[1178,555],[1177,556],[1270,557],[1273,558],[1162,559],[1274,560],[1188,561],[1159,562],[1164,563],[1287,564],[1224,565],[1308,534],[1280,566],[1279,567],[1166,568],[1167,2],[1191,569],[1182,570],[1183,571],[1190,572],[1181,573],[1180,574],[1189,575],[1231,2],[1168,2],[1174,2],[1169,2],[1170,576],[1172,577],[1163,2],[1222,2],[1276,578],[1223,564],[1253,2],[1245,2],[1260,579],[1259,580],[1293,548],[1297,581],[1295,582],[1155,583],[1310,2],[1247,555],[1179,584],[1265,585],[1264,2],[1219,586],[1207,587],[1208,2],[1187,588],[1251,589],[1252,589],[1194,590],[1195,2],[1203,2],[1171,591],[1153,2],[1221,592],[1185,2],[1160,2],[1176,534],[1269,593],[1312,594],[1213,595],[1225,596],[1298,541],[1300,597],[1299,597],[1216,598],[1217,599],[1186,2],[1150,2],[1228,2],[1227,600],[1272,560],[1268,2],[1306,600],[1210,601],[1193,602],[1209,601],[1211,603],[1214,600],[1161,557],[1263,2],[1304,604],[1283,605],[1237,606],[1236,2],[1232,607],[1257,608],[1233,607],[1235,609],[1234,610],[1256,565],[1286,611],[1284,612],[1206,613],[1184,2],[1212,614],[1301,548],[1303,581],[1302,582],[1305,615],[1275,616],[1266,2],[1307,617],[1249,618],[1244,2],[1262,619],[1215,620],[1246,621],[1199,2],[1230,2],[1173,600],[1313,2],[1277,622],[1278,2],[1151,2],[1226,600],[1154,2],[1220,623],[1165,2],[1198,2],[1196,2],[1197,2],[1238,2],[1288,600],[1201,600],[1271,534],[1200,624],[838,625],[850,626],[836,627],[851,2],[860,628],[827,629],[828,630],[826,185],[859,103],[854,631],[858,632],[830,633],[847,634],[829,635],[857,636],[824,637],[825,631],[831,638],[832,2],[837,632],[835,638],[822,639],[861,640],[852,641],[841,642],[840,638],[842,643],[845,644],[839,645],[843,646],[855,103],[833,647],[834,648],[846,649],[823,2],[849,650],[848,638],[844,651],[853,2],[821,2],[856,652],[807,653],[792,2],[793,2],[794,2],[795,2],[791,2],[796,654],[797,2],[799,655],[798,654],[800,654],[801,655],[802,654],[803,2],[804,654],[805,2],[806,2],[935,656],[941,657],[153,658],[155,659],[162,660],[157,2],[158,2],[156,661],[159,662],[151,2],[152,2],[163,657],[154,663],[160,2],[161,664],[143,656],[146,665],[144,665],[140,656],[147,666],[148,667],[145,665],[141,668],[142,669],[136,670],[88,671],[90,672],[134,2],[89,673],[135,674],[139,675],[137,2],[91,671],[92,2],[133,676],[87,677],[84,2],[138,678],[85,679],[86,2],[149,680],[93,681],[94,681],[95,681],[96,681],[97,681],[98,681],[99,681],[100,681],[101,681],[102,681],[103,681],[105,681],[104,681],[106,681],[107,681],[108,681],[132,682],[109,681],[110,681],[111,681],[112,681],[113,681],[114,681],[115,681],[116,681],[117,681],[119,681],[118,681],[120,681],[121,681],[122,681],[123,681],[124,681],[125,681],[126,681],[127,681],[128,681],[129,681],[130,681],[131,681],[237,683],[232,684],[235,685],[233,685],[229,684],[236,686],[234,685],[230,687],[231,688],[225,689],[170,690],[172,691],[224,2],[171,692],[228,693],[226,2],[173,690],[174,2],[223,694],[169,695],[166,2],[227,696],[167,697],[168,2],[175,698],[176,698],[177,698],[178,698],[179,698],[180,698],[181,698],[182,698],[183,698],[184,698],[185,698],[186,698],[187,698],[189,698],[188,698],[190,698],[191,698],[192,698],[222,699],[193,698],[194,698],[195,698],[196,698],[197,698],[198,698],[199,698],[200,698],[201,698],[202,698],[203,698],[204,698],[205,698],[207,698],[206,698],[208,698],[209,698],[210,698],[211,698],[212,698],[213,698],[214,698],[215,698],[216,698],[217,698],[218,698],[221,698],[219,698],[220,698],[240,700],[239,701],[376,702],[459,703],[460,2],[995,704],[984,705],[1001,706],[1000,707],[950,708],[1002,709],[366,710],[962,711],[1011,709],[305,712],[955,713],[1012,714],[306,715],[956,716],[1013,709],[360,717],[957,718],[1014,719],[948,720],[949,721],[1018,722],[361,712],[958,723],[364,724],[959,725],[1015,709],[365,726],[960,727],[1016,709],[359,728],[961,729],[1017,730],[972,731],[1003,2],[1004,732],[808,2],[1005,733],[367,712],[1317,734],[974,735],[1318,709],[369,736],[946,737],[1319,714],[363,726],[944,738],[1320,709],[362,712],[945,739],[1321,709],[381,740],[975,741],[1006,709],[370,742],[976,743],[1007,709],[372,744],[977,745],[1008,709],[368,746],[947,747],[1009,748],[373,749],[978,750],[1322,709],[371,712],[979,751],[1323,709],[374,752],[980,753],[1324,709],[1325,754],[358,755],[1328,756],[1330,757],[1332,758],[357,759],[354,760],[1327,761],[1329,761],[1331,761],[355,762],[356,761],[981,763],[1326,764],[457,765],[969,766],[970,767],[1333,768],[458,769],[971,770],[375,712],[982,771],[1010,714],[937,772],[996,714],[983,773],[994,774],[238,2],[1334,775],[965,776],[964,2],[963,2],[954,777],[953,778],[952,779],[951,780],[304,781],[303,782],[455,783],[456,784],[454,785],[379,2],[380,786],[453,787],[448,788],[451,789],[449,789],[445,788],[452,790],[450,789],[446,791],[447,792],[441,793],[386,794],[388,795],[440,2],[387,796],[444,797],[442,2],[389,794],[390,2],[439,798],[385,799],[382,2],[443,800],[383,801],[384,2],[391,802],[392,802],[393,802],[394,802],[395,802],[396,802],[397,802],[398,802],[399,802],[400,802],[401,802],[402,802],[403,802],[405,802],[404,802],[406,802],[407,802],[408,802],[438,803],[409,802],[410,802],[411,802],[412,802],[413,802],[414,802],[415,802],[416,802],[417,802],[418,802],[419,802],[420,802],[421,802],[423,802],[422,802],[424,802],[425,802],[426,802],[427,802],[428,802],[429,802],[430,802],[431,802],[432,802],[433,802],[434,802],[437,802],[435,802],[436,802],[943,804],[810,2],[811,382],[931,805],[932,805],[992,806],[933,807],[790,808],[789,2],[993,809],[377,2],[936,2]],"semanticDiagnosticsPerFile":[[946,[{"pos":2914,"end":2919,"code":2322,"category":1,"message":"Type '{ [x: string]: any; id?: unknown; created_at?: unknown; updated_at?: unknown; created_by?: unknown; organization_id?: unknown; title?: unknown; visibility?: unknown; metadata?: unknown; archived?: unknown; status?: unknown; error?: unknown; agent_deployment_id?: unknown; agent?: unknown; }[]' is not assignable to type '{ id: string; created_at: string; updated_at: string; created_by: string | null; organization_id: string; title: string | null; visibility: \"organization\" | \"private\" | \"public\"; metadata: any; ... 6 more ...; expires_at: string | null; }[]'.","messageChain":[{"pos":2914,"end":2919,"code":2739,"category":1,"message":"Type '{ [x: string]: any; id?: unknown; created_at?: unknown; updated_at?: unknown; created_by?: unknown; organization_id?: unknown; title?: unknown; visibility?: unknown; metadata?: unknown; archived?: unknown; status?: unknown; error?: unknown; agent_deployment_id?: unknown; agent?: unknown; }' is missing the following properties from type '{ id: string; created_at: string; updated_at: string; created_by: string | null; organization_id: string; title: string | null; visibility: \"organization\" | \"private\" | \"public\"; metadata: any; ... 6 more ...; expires_at: string | null; }': expire_ttl, expires_at"}],"relatedInformation":[{"file":239,"pos":1648,"end":1670,"code":6500,"category":3,"message":"The expected type comes from property 'items' which is declared here on type '{ next_cursor: string | null; items: { id: string; created_at: string; updated_at: string; created_by: string | null; organization_id: string; title: string | null; visibility: \"organization\" | \"private\" | \"public\"; ... 7 more ...; expires_at: string | null; }[]; }'"}]},{"pos":6485,"end":6493,"code":2322,"category":1,"message":"Type 'unknown[]' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }[]'.","messageChain":[{"pos":6485,"end":6493,"code":2322,"category":1,"message":"Type 'unknown' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }'."}],"relatedInformation":[{"file":369,"pos":2874,"end":2910,"code":6500,"category":3,"message":"The expected type comes from property 'messages' which is declared here on type '{ id: string; created_at: string; updated_at: string; created_by: string | null; organization_id: string; title: string | null; visibility: \"organization\" | \"private\" | \"public\"; metadata: any; ... 7 more ...; messages: { ...; }[]; }'"}]},{"pos":7849,"end":7857,"code":2322,"category":1,"message":"Type 'unknown[]' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }[]'.","messageChain":[{"pos":7849,"end":7857,"code":2322,"category":1,"message":"Type 'unknown' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }'."}],"relatedInformation":[{"file":369,"pos":2874,"end":2910,"code":6500,"category":3,"message":"The expected type comes from property 'messages' which is declared here on type '{ id: string; created_at: string; updated_at: string; created_by: string | null; organization_id: string; title: string | null; visibility: \"organization\" | \"private\" | \"public\"; metadata: any; ... 7 more ...; messages: { ...; }[]; }'"}]}]],[947,[{"pos":4086,"end":4091,"code":2322,"category":1,"message":"Type 'unknown[]' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }[]'.","messageChain":[{"pos":4086,"end":4091,"code":2322,"category":1,"message":"Type 'unknown' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }'."}],"relatedInformation":[{"file":239,"pos":1648,"end":1670,"code":6500,"category":3,"message":"The expected type comes from property 'items' which is declared here on type '{ next_cursor: string | null; items: { id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }[]; }'"}]},{"pos":6770,"end":6778,"code":2322,"category":1,"message":"Type 'unknown[]' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }[]'.","messageChain":[{"pos":6770,"end":6778,"code":2322,"category":1,"message":"Type 'unknown' is not assignable to type '{ id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }'."}],"relatedInformation":[{"file":368,"pos":3191,"end":3227,"code":6500,"category":3,"message":"The expected type comes from property 'messages' which is declared here on type '{ messages: { id: string; created_at: string; chat_id: string; metadata: any; format: \"ai-sdk\"; parts: UIMessagePart[]; role: \"assistant\" | \"system\" | \"user\"; }[]; }'"}]}]],[955,[{"pos":1292,"end":1297,"code":2322,"category":1,"message":"Type '{ [x: string]: any; id?: unknown; number?: unknown; created_at?: unknown; updated_at?: unknown; created_by?: unknown; created_from?: unknown; agent_id?: unknown; source_files?: unknown; output_files?: unknown; status?: unknown; target?: unknown; error_message?: unknown; user_message?: unknown; platform?: unknown; pl...' is not assignable to type '{ id: string; number: number; created_at: string; updated_at: string; created_by: string | null; created_from: \"cli\"; agent_id: string; source_files: { path: string; id: string; }[]; output_files: { ...; }[]; ... 6 more ...; platform_region: string | null; }[]'.","messageChain":[{"pos":1292,"end":1297,"code":2322,"category":1,"message":"Type '{ [x: string]: any; id?: unknown; number?: unknown; created_at?: unknown; updated_at?: unknown; created_by?: unknown; created_from?: unknown; agent_id?: unknown; source_files?: unknown; output_files?: unknown; status?: unknown; target?: unknown; error_message?: unknown; user_message?: unknown; platform?: unknown; pl...' is not assignable to type '{ id: string; number: number; created_at: string; updated_at: string; created_by: string | null; created_from: \"cli\"; agent_id: string; source_files: { path: string; id: string; }[]; output_files: { ...; }[]; ... 6 more ...; platform_region: string | null; }'.","messageChain":[{"pos":1292,"end":1297,"code":2326,"category":1,"message":"Types of property 'id' are incompatible.","messageChain":[{"pos":1292,"end":1297,"code":2322,"category":1,"message":"Type 'unknown' is not assignable to type 'string'."}]}]}],"relatedInformation":[{"file":239,"pos":1316,"end":1338,"code":6500,"category":3,"message":"The expected type comes from property 'items' which is declared here on type '{ has_more: boolean; items: { id: string; number: number; created_at: string; updated_at: string; created_by: string | null; created_from: \"cli\"; agent_id: string; source_files: { path: string; id: string; }[]; ... 7 more ...; platform_region: string | null; }[]; }'"}]}]],[962,[{"pos":4996,"end":5001,"code":2322,"category":1,"message":"Type '{ [x: string]: any; id?: unknown; organization_id?: unknown; created_at?: unknown; updated_at?: unknown; created_by?: unknown; name?: unknown; description?: unknown; avatar_url?: unknown; visibility?: unknown; active_deployment_id?: unknown; pinned?: unknown; request_url?: unknown; }[]' is not assignable to type '{ id: string; organization_id: string; created_at: string; updated_at: string; created_by: string; name: string; description: string | null; avatar_url: string | null; visibility: \"organization\" | \"private\" | \"public\"; ... 4 more ...; user_permission?: \"admin\" | ... 2 more ... | undefined; }[]'.","messageChain":[{"pos":4996,"end":5001,"code":2741,"category":1,"message":"Property 'chat_expire_ttl' is missing in type '{ [x: string]: any; id?: unknown; organization_id?: unknown; created_at?: unknown; updated_at?: unknown; created_by?: unknown; name?: unknown; description?: unknown; avatar_url?: unknown; visibility?: unknown; active_deployment_id?: unknown; pinned?: unknown; request_url?: unknown; }' but required in type '{ id: string; organization_id: string; created_at: string; updated_at: string; created_by: string; name: string; description: string | null; avatar_url: string | null; visibility: \"organization\" | \"private\" | \"public\"; ... 4 more ...; user_permission?: \"admin\" | ... 2 more ... | undefined; }'.","relatedInformation":[{"file":366,"pos":2417,"end":2472,"code":2728,"category":3,"message":"'chat_expire_ttl' is declared here."}]}],"relatedInformation":[{"file":366,"pos":2417,"end":2472,"code":2728,"category":3,"message":"'chat_expire_ttl' is declared here."},{"file":239,"pos":1316,"end":1338,"code":6500,"category":3,"message":"The expected type comes from property 'items' which is declared here on type '{ has_more: boolean; items: { id: string; organization_id: string; created_at: string; updated_at: string; created_by: string; name: string; description: string | null; avatar_url: string | null; ... 5 more ...; user_permission?: \"admin\" | ... 2 more ... | undefined; }[]; }'"}]}]],[972,[{"pos":3810,"end":3816,"code":2322,"category":1,"message":"Type 'string | undefined' is not assignable to type 'string | null'.","messageChain":[{"pos":3810,"end":3816,"code":2322,"category":1,"message":"Type 'undefined' is not assignable to type 'string | null'."}],"relatedInformation":[{"file":965,"pos":234,"end":240,"code":6500,"category":3,"message":"The expected type comes from property 'userID' which is declared here on type 'UsageEvent'"}]},{"pos":7264,"end":7269,"code":2559,"category":1,"message":"Type 'Bindings' has no properties in common with type 'EnvLike'."},{"pos":8823,"end":8828,"code":2559,"category":1,"message":"Type 'Bindings' has no properties in common with type 'EnvLike'."},{"pos":12864,"end":12869,"code":2559,"category":1,"message":"Type 'Bindings' has no properties in common with type 'EnvLike'."},{"pos":14413,"end":14418,"code":2559,"category":1,"message":"Type 'Bindings' has no properties in common with type 'EnvLike'."}]]],"affectedFilesPendingEmit":[240,239,376,459,460,995,984,1001,1000,950,1002,366,962,1011,305,955,1012,306,956,1013,360,957,1014,948,949,1018,361,958,364,959,1015,365,960,1016,359,961,1017,972,1003,1004,808,1005,367,1317,974,1318,369,946,1319,363,944,1320,362,945,1321,381,975,1006,370,976,1007,372,977,1008,368,947,1009,373,978,1322,371,979,1323,374,980,1324,1325,358,1328,1330,1332,357,354,1327,1329,1331,355,356,981,1326,457,969,970,1333,458,971,375,982,1010,937,996,983,994,238,1334]} \ No newline at end of file diff --git a/packages/api/tsdown.config.ts b/packages/api/tsdown.config.ts new file mode 100644 index 0000000..d77ab48 --- /dev/null +++ b/packages/api/tsdown.config.ts @@ -0,0 +1,53 @@ +import { defineConfig, type UserConfig } from "tsdown"; +import { noServerImports } from "./scripts/no-server-imports.ts"; + +const commonConfig: UserConfig = { + format: ["esm", "cjs"], + outDir: "dist/dist", + dts: true, + outputOptions: { + inlineDynamicImports: true, + }, +}; + +export default defineConfig([ + { + ...commonConfig, + entry: ["src/client.browser.ts", "src/react/index.ts"], + target: "chrome100", + copy: [ + { + from: "package.public.json", + to: "dist/package.json", + }, + ], + plugins: [ + // This prevents any server code from being leaked to the client. + noServerImports({ + // Default patterns should work for your naming convention + // clientFilePattern: /\.client\./, + // serverFilePattern: /\.server\./, + + // You can add additional server patterns if needed + serverPatterns: [ + /\/server\//, // imports containing '/server/' + /\.server$/, // imports ending with '.server' + /middleware/, // middleware files (often server-only) + /database/, // database-related imports + /auth\.server/, // specific server auth files + ], + }), + ], + }, + { + ...commonConfig, + entry: ["src/client.node.ts"], + target: "es2020", + copy: [ + { + from: "package.public.json", + to: "dist/package.json", + }, + ], + }, +]); diff --git a/packages/billing/package.json b/packages/billing/package.json new file mode 100644 index 0000000..81e2c3b --- /dev/null +++ b/packages/billing/package.json @@ -0,0 +1,18 @@ +{ + "name": "@blink.so/billing", + "type": "module", + "exports": { + "./ingest-usage-event": { + "types": "./src/ingest-usage-event.ts", + "import": "./src/ingest-usage-event.ts" + }, + "./metronome": { + "types": "./src/metronome.ts", + "import": "./src/metronome.ts" + }, + "./money": { + "types": "./src/money.ts", + "import": "./src/money.ts" + } + } +} diff --git a/packages/billing/src/ingest-usage-event.ts b/packages/billing/src/ingest-usage-event.ts new file mode 100644 index 0000000..99b402e --- /dev/null +++ b/packages/billing/src/ingest-usage-event.ts @@ -0,0 +1,20 @@ +// OSS stub: Billing removed +import type { EnvLike } from "./metronome"; +import type { Money } from "./money"; + +export interface UsageEvent { + organizationId: string; + costUSD: Money; + transactionId: string; + eventType: string; + userID: string | null; + timestamp?: Date; +} + +export async function ingestUsageEvent( + env: EnvLike, + querier: any, + event: UsageEvent +): Promise { + // No-op in OSS version +} diff --git a/packages/billing/src/metronome.ts b/packages/billing/src/metronome.ts new file mode 100644 index 0000000..5bf15ec --- /dev/null +++ b/packages/billing/src/metronome.ts @@ -0,0 +1,4 @@ +// OSS stub: Billing removed +export interface EnvLike { + METRONOME_API_KEY?: string; +} diff --git a/packages/billing/src/money.ts b/packages/billing/src/money.ts new file mode 100644 index 0000000..7d9798e --- /dev/null +++ b/packages/billing/src/money.ts @@ -0,0 +1,22 @@ +// OSS stub: Billing removed +export class Money { + constructor(public readonly amount: string) {} + + static fromString(value: string): Money { + return new Money(value); + } + + static from(value: string): Money { + return new Money(value); + } + + toString(): string { + return this.amount; + } + + add(other: Money): Money { + const a = parseFloat(this.amount); + const b = parseFloat(other.amount); + return new Money((a + b).toFixed(10)); + } +} diff --git a/packages/blink/src/agent/agent.test.ts b/packages/blink/src/agent/agent.test.ts index 0811ba8..5ebf118 100644 --- a/packages/blink/src/agent/agent.test.ts +++ b/packages/blink/src/agent/agent.test.ts @@ -1,17 +1,17 @@ -import { expect, test, describe, mock, beforeEach, afterEach } from "bun:test"; +import { createServerAdapter } from "@whatwg-node/server"; import type { UIMessage } from "ai"; +import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test"; import * as http from "http"; -import { createServerAdapter } from "@whatwg-node/server"; import { api as controlApi } from "../control"; -import { Agent, waitUntil, api } from "./agent"; +import { Agent, api, waitUntil } from "./agent"; import type { AgentChat, AgentStore, + Chat, ID, NewMessage, SendOptions, UpsertedChat, - Chat, } from "./types"; // Create a mock API server similar to createLocalServer diff --git a/packages/blink/src/agent/client/index.ts b/packages/blink/src/agent/client/index.ts index de326a1..d420f3e 100644 --- a/packages/blink/src/agent/client/index.ts +++ b/packages/blink/src/agent/client/index.ts @@ -8,11 +8,10 @@ import type { EventSourceMessage } from "eventsource-parser/stream"; import { EventSourceParserStream } from "eventsource-parser/stream"; import { hc } from "hono/client"; import type { api } from "../agent"; +import { APIServerURLEnvironmentVariable } from "../constants"; import { convertResponseToUIMessageStream } from "../internal/convert-response-to-ui-message-stream"; import type { ID } from "../types"; import type { UIOptions, UIOptionsSchema } from "../ui"; -import { APIServerURLEnvironmentVariable } from "../constants"; -import { RWLock } from "../../local/rw-lock"; export { APIServerURLEnvironmentVariable }; diff --git a/packages/blink/src/agent/index.browser.ts b/packages/blink/src/agent/index.browser.ts index c3fd676..e357008 100644 --- a/packages/blink/src/agent/index.browser.ts +++ b/packages/blink/src/agent/index.browser.ts @@ -1,5 +1,5 @@ -export * from "./types"; export * from "./tools"; +export * from "./types"; export * from "./ui"; export type StreamResponseFormat = diff --git a/packages/blink/src/agent/internal/convert-response-to-ui-message-stream.ts b/packages/blink/src/agent/internal/convert-response-to-ui-message-stream.ts index 3c53938..e86d97f 100644 --- a/packages/blink/src/agent/internal/convert-response-to-ui-message-stream.ts +++ b/packages/blink/src/agent/internal/convert-response-to-ui-message-stream.ts @@ -2,7 +2,7 @@ import { createAnthropic } from "@ai-sdk/anthropic"; import { createGoogleGenerativeAI } from "@ai-sdk/google"; import { createOpenAI } from "@ai-sdk/openai"; import { createXai } from "@ai-sdk/xai"; -import { streamText, type UIMessageChunk, type LanguageModel } from "ai"; +import { streamText, type LanguageModel, type UIMessageChunk } from "ai"; import { EventSourceParserStream } from "eventsource-parser/stream"; import { StreamResponseFormatHeader } from "../index.browser"; diff --git a/packages/blink/src/build/esbuild.ts b/packages/blink/src/build/esbuild.ts index 5e88a59..0ab8de1 100644 --- a/packages/blink/src/build/esbuild.ts +++ b/packages/blink/src/build/esbuild.ts @@ -1,10 +1,9 @@ import type * as esbuild from "esbuild"; -import type { BuildContext } from "./types"; +import { mkdir, rm, writeFile } from "fs/promises"; import { builtinModules } from "module"; -import { mkdir, writeFile } from "fs/promises"; import path from "path"; -import { rm } from "fs/promises"; import { aiTelemetryPlugin } from "./plugins/ai-telemetry"; +import type { BuildContext } from "./types"; // Global esbuild instance that can be set by consumers (e.g., desktop app) let _esbuildInstance: typeof esbuild | undefined; diff --git a/packages/blink/src/build/index.ts b/packages/blink/src/build/index.ts index 5600c9e..2427223 100644 --- a/packages/blink/src/build/index.ts +++ b/packages/blink/src/build/index.ts @@ -1,7 +1,7 @@ -import path from "path"; import { existsSync } from "fs"; -import type { BuildContext } from "./types"; +import path from "path"; import { buildWithEsbuild } from "./esbuild"; +import type { BuildContext } from "./types"; export * from "./types"; diff --git a/packages/blink/src/build/plugins/ai-telemetry.test.ts b/packages/blink/src/build/plugins/ai-telemetry.test.ts index 8850ca8..b764a32 100644 --- a/packages/blink/src/build/plugins/ai-telemetry.test.ts +++ b/packages/blink/src/build/plugins/ai-telemetry.test.ts @@ -1,9 +1,9 @@ -import { describe, test, expect, mock } from "bun:test"; +import { describe, expect, test } from "bun:test"; import * as esbuild from "esbuild"; -import { aiTelemetryPlugin } from "./ai-telemetry"; -import { readFile, rm, writeFile, mkdir } from "fs/promises"; -import path from "path"; +import { mkdir, readFile, rm, writeFile } from "fs/promises"; import { tmpdir } from "os"; +import path from "path"; +import { aiTelemetryPlugin } from "./ai-telemetry"; describe("aiTelemetryPlugin", () => { const createTestBuild = async ( diff --git a/packages/blink/src/build/plugins/ai-telemetry.ts b/packages/blink/src/build/plugins/ai-telemetry.ts index 6bc32bf..0fc5733 100644 --- a/packages/blink/src/build/plugins/ai-telemetry.ts +++ b/packages/blink/src/build/plugins/ai-telemetry.ts @@ -18,11 +18,11 @@ */ import type { - Plugin, - PluginBuild, - OnResolveArgs, OnLoadArgs, OnLoadResult, + OnResolveArgs, + Plugin, + PluginBuild, } from "esbuild"; export interface TelemetryConfig { diff --git a/packages/blink/src/build/util.ts b/packages/blink/src/build/util.ts index 67a19e6..f53e036 100644 --- a/packages/blink/src/build/util.ts +++ b/packages/blink/src/build/util.ts @@ -1,5 +1,5 @@ -import { dirname, join } from "path"; import { stat } from "fs/promises"; +import { dirname, join } from "path"; /** * Finds the nearest entrypoint in the directory tree. diff --git a/packages/blink/src/cli/chat.ts b/packages/blink/src/cli/chat.ts index f3c5284..b66fb98 100644 --- a/packages/blink/src/cli/chat.ts +++ b/packages/blink/src/cli/chat.ts @@ -1,4 +1,3 @@ -import open from "open"; import { WebSocket } from "ws"; import { WorkspaceConnect } from "./connect"; import { openUrl } from "./lib/util"; diff --git a/packages/blink/src/cli/compute-server.test.ts b/packages/blink/src/cli/compute-server.test.ts index dce0d0e..e1d15a7 100644 --- a/packages/blink/src/cli/compute-server.test.ts +++ b/packages/blink/src/cli/compute-server.test.ts @@ -1,11 +1,11 @@ -import { expect, test } from "bun:test"; import { Client } from "@blink-sdk/compute-protocol/client"; import Multiplexer, { Stream } from "@blink-sdk/multiplexer"; +import { expect, test } from "bun:test"; import { Buffer } from "node:buffer"; import type { AddressInfo } from "node:net"; import { createServer as createNetServer } from "node:net"; -import WebSocket from "ws"; import type { WebSocketServer } from "ws"; +import WebSocket from "ws"; import serveCompute from "./compute-server"; type RawData = WebSocket.RawData; diff --git a/packages/blink/src/cli/deploy.ts b/packages/blink/src/cli/deploy.ts index f98e25d..109d0bd 100644 --- a/packages/blink/src/cli/deploy.ts +++ b/packages/blink/src/cli/deploy.ts @@ -1,22 +1,19 @@ -import Client, { - type AgentDeploymentUploadFile, - type ListAgentsRequest, -} from "@blink.so/api"; -import { stat, readFile } from "node:fs/promises"; -import { basename, dirname, join, relative } from "node:path"; -import { loginIfNeeded } from "./lib/auth"; -import { migrateDataToBlink } from "./lib/migrate"; -import { existsSync } from "node:fs"; -import { mkdir, writeFile, readdir } from "fs/promises"; -import { select, confirm, isCancel, spinner } from "@clack/prompts"; -import { parse } from "dotenv"; +import Client, { type AgentDeploymentUploadFile } from "@blink.so/api"; +import { confirm, isCancel, select, spinner } from "@clack/prompts"; import chalk from "chalk"; -import { findNearestEntry } from "../build/util"; -import { resolveConfig, type BuildResult } from "../build"; -import { version } from "../../package.json"; +import { parse } from "dotenv"; +import { mkdir, readdir, writeFile } from "fs/promises"; import ignore from "ignore"; +import { existsSync } from "node:fs"; +import { readFile, stat } from "node:fs/promises"; +import { basename, dirname, join, relative } from "node:path"; import { inspect } from "node:util"; +import { version } from "../../package.json"; +import { resolveConfig, type BuildResult } from "../build"; +import { findNearestEntry } from "../build/util"; +import { loginIfNeeded } from "./lib/auth"; import { getDevhookID, resetDevhookID } from "./lib/devhook"; +import { migrateDataToBlink } from "./lib/migrate"; export default async function deploy( directory?: string, diff --git a/packages/blink/src/cli/dev.ts b/packages/blink/src/cli/dev.ts index 1a180ac..40dd845 100644 --- a/packages/blink/src/cli/dev.ts +++ b/packages/blink/src/cli/dev.ts @@ -4,7 +4,6 @@ import { inspect } from "util"; import { resolveConfig } from "../build/index"; import { findNearestEntry } from "../build/util"; import { startDev } from "../tui/dev"; -import { getAuthToken } from "./lib/auth"; import { migrateDataToBlink } from "./lib/migrate"; export default async function dev(directory?: string): Promise { diff --git a/packages/blink/src/cli/index.ts b/packages/blink/src/cli/index.ts index 8abc29e..9f8bdf5 100644 --- a/packages/blink/src/cli/index.ts +++ b/packages/blink/src/cli/index.ts @@ -19,13 +19,13 @@ if (typeof globalThis["Bun"] !== "undefined") { }; } +import * as clack from "@clack/prompts"; import { program } from "commander"; import { randomUUID } from "crypto"; import { version } from "../../package.json"; import build from "./build"; import deploy from "./deploy"; import setupSlackApp from "./setup-slack-app"; -import * as clack from "@clack/prompts"; // This polyfill is because older versions of NodeJS don't have a global crypto object. if (!globalThis.crypto) { diff --git a/packages/blink/src/cli/init.test.ts b/packages/blink/src/cli/init.test.ts index cd1983d..f2ed630 100644 --- a/packages/blink/src/cli/init.test.ts +++ b/packages/blink/src/cli/init.test.ts @@ -1,15 +1,15 @@ -import { describe, it, expect, mock } from "bun:test"; -import { getFilesForTemplate, getAvailablePackageManagers } from "./init"; +import { describe, expect, it } from "bun:test"; +import { execSync } from "child_process"; +import { chmod, mkdir, readFile, writeFile } from "fs/promises"; +import { join } from "path"; +import { getFilesForTemplate } from "./init"; import { - render, BLINK_COMMAND, - makeTmpDir, KEY_CODES, + makeTmpDir, pathToCliEntrypoint, + render, } from "./lib/terminal"; -import { join } from "path"; -import { readFile, writeFile, chmod, mkdir } from "fs/promises"; -import { execSync } from "child_process"; const getFile = (files: Record, filename: string): string => { const fileContent = files[filename]; diff --git a/packages/blink/src/cli/init.ts b/packages/blink/src/cli/init.ts index 71fb157..7804e7f 100644 --- a/packages/blink/src/cli/init.ts +++ b/packages/blink/src/cli/init.ts @@ -8,10 +8,10 @@ import { select, text, } from "@clack/prompts"; -import { spawn, exec } from "child_process"; -import { readdir, readFile, writeFile } from "fs/promises"; -import { basename, join } from "path"; +import { exec, spawn } from "child_process"; +import { readdir, writeFile } from "fs/promises"; import Handlebars from "handlebars"; +import { basename, join } from "path"; import { templates, type TemplateId } from "./init-templates"; import { setupSlackApp } from "./setup-slack-app"; diff --git a/packages/blink/src/cli/lib/auth.ts b/packages/blink/src/cli/lib/auth.ts index 102161f..e403b0c 100644 --- a/packages/blink/src/cli/lib/auth.ts +++ b/packages/blink/src/cli/lib/auth.ts @@ -1,4 +1,6 @@ import Client from "@blink.so/api"; +import { spinner } from "@clack/prompts"; +import chalk from "chalk"; import { existsSync, mkdirSync, @@ -8,9 +10,6 @@ import { } from "node:fs"; import { dirname, join } from "node:path"; import XDGAppPaths from "xdg-app-paths"; -import chalk from "chalk"; -import { spinner } from "@clack/prompts"; -import open from "open"; import { openUrl } from "./util"; /** diff --git a/packages/blink/src/cli/lib/devhook.ts b/packages/blink/src/cli/lib/devhook.ts index 14ec886..dca9f7b 100644 --- a/packages/blink/src/cli/lib/devhook.ts +++ b/packages/blink/src/cli/lib/devhook.ts @@ -1,9 +1,9 @@ import { - mkdirSync, existsSync, + mkdirSync, readFileSync, - writeFileSync, unlinkSync, + writeFileSync, } from "fs"; import { dirname, join } from "path"; diff --git a/packages/blink/src/cli/lib/first-run.ts b/packages/blink/src/cli/lib/first-run.ts index 8428832..5b749c5 100644 --- a/packages/blink/src/cli/lib/first-run.ts +++ b/packages/blink/src/cli/lib/first-run.ts @@ -1,4 +1,4 @@ -import { mkdirSync, existsSync, writeFileSync } from "fs"; +import { existsSync, mkdirSync, writeFileSync } from "fs"; import { dirname, join } from "path"; /** diff --git a/packages/blink/src/cli/lib/migrate.ts b/packages/blink/src/cli/lib/migrate.ts index 8513ba4..2ee1ef3 100644 --- a/packages/blink/src/cli/lib/migrate.ts +++ b/packages/blink/src/cli/lib/migrate.ts @@ -1,7 +1,7 @@ -import { existsSync, readFileSync, writeFileSync, readdirSync } from "fs"; -import { rename, rm } from "fs/promises"; -import { join } from "path"; import chalk from "chalk"; +import { existsSync, readFileSync, writeFileSync } from "fs"; +import { rename } from "fs/promises"; +import { join } from "path"; /** * Automatically migrates data/ to .blink/ if it exists. diff --git a/packages/blink/src/cli/lib/templates.ts b/packages/blink/src/cli/lib/templates.ts index 0fd9f4d..e1823ff 100644 --- a/packages/blink/src/cli/lib/templates.ts +++ b/packages/blink/src/cli/lib/templates.ts @@ -1,5 +1,4 @@ -import { readdir, readFile, writeFile } from "fs/promises"; -import stringify from "json-stable-stringify"; +import { readdir, readFile } from "fs/promises"; import { join } from "path"; export async function generateTemplates(): Promise< diff --git a/packages/blink/src/cli/lib/terminal.test.ts b/packages/blink/src/cli/lib/terminal.test.ts index 305447c..300da8e 100644 --- a/packages/blink/src/cli/lib/terminal.test.ts +++ b/packages/blink/src/cli/lib/terminal.test.ts @@ -1,6 +1,5 @@ -import { test, expect } from "bun:test"; -import { render } from "./terminal"; -import { BLINK_COMMAND } from "./terminal"; +import { test } from "bun:test"; +import { BLINK_COMMAND, render } from "./terminal"; test("escape codes are rendered", async () => { using term = render( diff --git a/packages/blink/src/cli/lib/terminal.ts b/packages/blink/src/cli/lib/terminal.ts index f33eadf..e73780e 100644 --- a/packages/blink/src/cli/lib/terminal.ts +++ b/packages/blink/src/cli/lib/terminal.ts @@ -1,12 +1,12 @@ +import { Terminal } from "@xterm/headless"; +import { mkdtemp, rm } from "fs/promises"; import { spawn, spawnSync, type ChildProcessWithoutNullStreams, } from "node:child_process"; -import { Terminal } from "@xterm/headless"; -import { join } from "path"; -import { mkdtemp, rm } from "fs/promises"; import { tmpdir } from "os"; +import { join } from "path"; export interface RenderOptions { cols?: number; diff --git a/packages/blink/src/cli/lib/util.ts b/packages/blink/src/cli/lib/util.ts index 0e4e863..c00e5d3 100644 --- a/packages/blink/src/cli/lib/util.ts +++ b/packages/blink/src/cli/lib/util.ts @@ -1,5 +1,5 @@ -import open from "open"; import chalk from "chalk"; +import open from "open"; export async function openUrl( url: string, diff --git a/packages/blink/src/cli/run.ts b/packages/blink/src/cli/run.ts index da45cab..ce51d58 100644 --- a/packages/blink/src/cli/run.ts +++ b/packages/blink/src/cli/run.ts @@ -1,15 +1,15 @@ -import { join, resolve } from "node:path"; -import { ChatManager } from "../local/chat-manager"; -import { spawnAgent } from "../local/spawn-agent"; import { parse } from "dotenv"; +import { existsSync } from "node:fs"; import { readFile } from "node:fs/promises"; -import { getAuthToken } from "./lib/auth"; -import { migrateDataToBlink } from "./lib/migrate"; +import { join, resolve } from "node:path"; +import type { ID } from "../agent/types"; import { resolveConfig } from "../build"; import { findNearestEntry } from "../build/util"; -import { existsSync } from "node:fs"; -import type { ID } from "../agent/types"; +import { ChatManager } from "../local/chat-manager"; import { RWLock } from "../local/rw-lock"; +import { spawnAgent } from "../local/spawn-agent"; +import { getAuthToken } from "./lib/auth"; +import { migrateDataToBlink } from "./lib/migrate"; export default async function run( message: string[], diff --git a/packages/blink/src/cli/scripts/generate-templates.test.ts b/packages/blink/src/cli/scripts/generate-templates.test.ts index 34560e7..d249857 100644 --- a/packages/blink/src/cli/scripts/generate-templates.test.ts +++ b/packages/blink/src/cli/scripts/generate-templates.test.ts @@ -1,6 +1,6 @@ -import { describe, it, expect } from "bun:test"; -import { generateTemplates } from "../lib/templates"; +import { expect, it } from "bun:test"; import { templates } from "../init-templates"; +import { generateTemplates } from "../lib/templates"; it("templates are up to date", async () => { // if this test fails, run `bun run gen-templates` in `packages/blink` diff --git a/packages/blink/src/cli/scripts/generate-templates.ts b/packages/blink/src/cli/scripts/generate-templates.ts index 57240c6..5bb4193 100644 --- a/packages/blink/src/cli/scripts/generate-templates.ts +++ b/packages/blink/src/cli/scripts/generate-templates.ts @@ -1,7 +1,7 @@ -import { generateTemplates } from "../lib/templates"; -import { readdir, readFile, writeFile } from "fs/promises"; +import { writeFile } from "fs/promises"; import stringify from "json-stable-stringify"; import { join } from "path"; +import { generateTemplates } from "../lib/templates"; const main = async () => { const templates = await generateTemplates(); diff --git a/packages/blink/src/cli/setup-slack-app.ts b/packages/blink/src/cli/setup-slack-app.ts index d269108..f23abb1 100644 --- a/packages/blink/src/cli/setup-slack-app.ts +++ b/packages/blink/src/cli/setup-slack-app.ts @@ -1,3 +1,4 @@ +import Client from "@blink.so/api"; import { confirm, intro, @@ -8,15 +9,13 @@ import { spinner, text, } from "@clack/prompts"; +import chalk from "chalk"; +import crypto from "crypto"; import { access, readFile, readdir, writeFile } from "fs/promises"; +import util from "node:util"; import { basename, join } from "path"; -import { createDevhookID, getDevhookID, hasDevhook } from "./lib/devhook"; import { createSlackApp } from "../edit/tools/create-slack-app"; -import open from "open"; -import Client from "@blink.so/api"; -import crypto from "crypto"; -import chalk from "chalk"; -import util from "node:util"; +import { createDevhookID, getDevhookID, hasDevhook } from "./lib/devhook"; import { openUrl } from "./lib/util"; export async function verifySlackCredentials( diff --git a/packages/blink/src/edit/agent.ts b/packages/blink/src/edit/agent.ts index e33f086..0198850 100644 --- a/packages/blink/src/edit/agent.ts +++ b/packages/blink/src/edit/agent.ts @@ -1,31 +1,30 @@ import { createAnthropic } from "@ai-sdk/anthropic"; -import { createOpenAI } from "@ai-sdk/openai"; import { createGatewayProvider } from "@ai-sdk/gateway"; +import { createOpenAI } from "@ai-sdk/openai"; import * as compute from "@blink-sdk/compute"; import { convertToModelMessages, readUIMessageStream, streamText, tool, - type UIMessage, type LanguageModel, + type UIMessage, } from "ai"; import { spawn } from "child_process"; import { readFile, writeFile } from "fs/promises"; -import open from "open"; import { join } from "path"; import { z } from "zod"; import { Agent } from "../agent/agent"; import { Client } from "../agent/client"; import * as blink from "../agent/index.node"; import { templates } from "../cli/init-templates"; +import { openUrl } from "../cli/lib/util"; import { createGithubApp, createGithubAppSchema, } from "./tools/create-github-app"; import { createSlackApp, createSlackAppSchema } from "./tools/create-slack-app"; import { TSServer } from "./tsserver"; -import { openUrl } from "../cli/lib/util"; export interface EditAgent { agent: Agent; diff --git a/packages/blink/src/edit/tools/create-github-app.ts b/packages/blink/src/edit/tools/create-github-app.ts index b3a5360..c87a237 100644 --- a/packages/blink/src/edit/tools/create-github-app.ts +++ b/packages/blink/src/edit/tools/create-github-app.ts @@ -1,6 +1,6 @@ -import { z } from "zod"; -import http from "http"; import { createServerAdapter } from "@whatwg-node/server"; +import http from "http"; +import { z } from "zod"; export interface GitHubAppData { id: number; diff --git a/packages/blink/src/edit/tsserver.test.ts b/packages/blink/src/edit/tsserver.test.ts index 669479d..0a6a0fe 100644 --- a/packages/blink/src/edit/tsserver.test.ts +++ b/packages/blink/src/edit/tsserver.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test, afterEach } from "bun:test"; +import { afterEach, describe, expect, test } from "bun:test"; import { mkdtemp, rm, writeFile } from "fs/promises"; import { tmpdir } from "os"; import { join } from "path"; diff --git a/packages/blink/src/local/chat-manager.test.ts b/packages/blink/src/local/chat-manager.test.ts index fa79132..dc22bc8 100644 --- a/packages/blink/src/local/chat-manager.test.ts +++ b/packages/blink/src/local/chat-manager.test.ts @@ -1,13 +1,13 @@ -import { expect, test, beforeEach, afterEach, mock } from "bun:test"; +import type { UIMessage, UIMessageChunk } from "ai"; +import { afterEach, beforeEach, expect, mock, test } from "bun:test"; import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import type { UIMessage, UIMessageChunk } from "ai"; +import type { Client } from "../agent/client"; import { ChatManager, type ChatStatus } from "./chat-manager"; import { createDiskStore } from "./disk-store"; import { RWLock } from "./rw-lock"; import type { StoredChat, StoredMessage } from "./types"; -import type { Client } from "../agent/client"; // Helper to create a mock agent function createMockAgent(responseText: string = "Assistant response"): { diff --git a/packages/blink/src/local/chat-manager.ts b/packages/blink/src/local/chat-manager.ts index 190e9c0..19f438e 100644 --- a/packages/blink/src/local/chat-manager.ts +++ b/packages/blink/src/local/chat-manager.ts @@ -1,5 +1,7 @@ import { isToolOrDynamicToolUIPart, type UIMessage } from "ai"; -import type { Client } from "../agent/client"; +import { stripVTControlCharacters } from "node:util"; +import type { ID } from "../agent/types"; +import type { Agent } from "../react/use-agent"; import type { Source } from "../react/use-logger"; import { createDiskStore, @@ -9,15 +11,10 @@ import { } from "./disk-store"; import { runAgent } from "./run-agent"; import { - convertMessage, isStoredMessageMetadata, type StoredChat, type StoredMessage, } from "./types"; -import type { ID } from "../agent/types"; -import { stripVTControlCharacters } from "node:util"; -import { RWLock } from "./rw-lock"; -import type { Agent } from "../react/use-agent"; export type ChatStatus = "idle" | "streaming" | "error"; diff --git a/packages/blink/src/local/disk-store.ts b/packages/blink/src/local/disk-store.ts index 79c9fb3..15ad007 100644 --- a/packages/blink/src/local/disk-store.ts +++ b/packages/blink/src/local/disk-store.ts @@ -1,6 +1,6 @@ +import filenamify from "filenamify"; import * as fs from "node:fs"; import * as path from "node:path"; -import filenamify from "filenamify"; import * as lockfile from "./lockfile"; export interface FileStore { diff --git a/packages/blink/src/local/run-agent.test.ts b/packages/blink/src/local/run-agent.test.ts index 1cf93d4..a751b98 100644 --- a/packages/blink/src/local/run-agent.test.ts +++ b/packages/blink/src/local/run-agent.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from "bun:test"; import type { UIMessage, UIMessageChunk } from "ai"; +import { expect, test } from "bun:test"; import { Client } from "../agent/client"; import { runAgent } from "./run-agent"; diff --git a/packages/blink/src/local/server.ts b/packages/blink/src/local/server.ts index d5b8a4d..7ae2508 100644 --- a/packages/blink/src/local/server.ts +++ b/packages/blink/src/local/server.ts @@ -3,14 +3,13 @@ import type { JSONValue, UIMessage } from "ai"; import { createServer as createHTTPServer } from "http"; import * as fs from "node:fs"; import { join } from "node:path"; -import type { Client } from "../agent/client"; +import { v5 as uuidv5 } from "uuid"; import type { AgentChat, AgentStore, ID } from "../agent/index.node"; import { api } from "../control"; +import type { Agent } from "../react/use-agent"; import { ChatManager } from "./chat-manager"; import { createDiskStore } from "./disk-store"; import { convertMessage, type StoredChat } from "./types"; -import { v5 as uuidv5 } from "uuid"; -import type { Agent } from "../react/use-agent"; export interface CreateLocalServerOptions { readonly dataDirectory: string; diff --git a/packages/blink/src/react/index.browser.ts b/packages/blink/src/react/index.browser.ts index acb622c..c02f693 100644 --- a/packages/blink/src/react/index.browser.ts +++ b/packages/blink/src/react/index.browser.ts @@ -1,2 +1,2 @@ -export { default as useOptions } from "./use-options"; export { Logger, LoggerContext } from "./use-logger"; +export { default as useOptions } from "./use-options"; diff --git a/packages/blink/src/react/index.node.ts b/packages/blink/src/react/index.node.ts index 0002af2..b3844e8 100644 --- a/packages/blink/src/react/index.node.ts +++ b/packages/blink/src/react/index.node.ts @@ -1,3 +1,4 @@ +export * from "./index.browser"; export { default as useAgent } from "./use-agent"; export { default as useAuth } from "./use-auth"; export { default as useBundler } from "./use-bundler"; @@ -6,4 +7,3 @@ export { default as useDevMode } from "./use-dev-mode"; export { default as useDevhook } from "./use-devhook"; export { default as useDotenv } from "./use-dotenv"; export { default as useEditAgent } from "./use-edit-agent"; -export * from "./index.browser"; diff --git a/packages/blink/src/react/use-agent.ts b/packages/blink/src/react/use-agent.ts index 8127c22..fd7b8a5 100644 --- a/packages/blink/src/react/use-agent.ts +++ b/packages/blink/src/react/use-agent.ts @@ -1,12 +1,12 @@ import { spawn } from "child_process"; import { createServer } from "http"; import { useEffect, useMemo, useState } from "react"; -import type { BuildResult } from "../build"; import { + APIServerURLEnvironmentVariable, Client, type CapabilitiesResponse, - APIServerURLEnvironmentVariable, } from "../agent/client"; +import type { BuildResult } from "../build"; import { RWLock } from "../local/rw-lock"; export interface AgentLog { diff --git a/packages/blink/src/react/use-auth.ts b/packages/blink/src/react/use-auth.ts index 6865f96..2396d48 100644 --- a/packages/blink/src/react/use-auth.ts +++ b/packages/blink/src/react/use-auth.ts @@ -1,6 +1,6 @@ -import { useCallback, useEffect, useRef, useState } from "react"; import Client from "@blink.so/api"; -import { getAuthToken, setAuthToken, deleteAuthToken } from "../cli/lib/auth"; +import { useCallback, useEffect, useRef, useState } from "react"; +import { deleteAuthToken, getAuthToken, setAuthToken } from "../cli/lib/auth"; export interface UseAuthOptions { /** diff --git a/packages/blink/src/react/use-chat.ts b/packages/blink/src/react/use-chat.ts index 1b11022..86df6b8 100644 --- a/packages/blink/src/react/use-chat.ts +++ b/packages/blink/src/react/use-chat.ts @@ -1,9 +1,8 @@ import type { UIMessage } from "ai"; import { useCallback, useEffect, useRef, useState } from "react"; -import type { Client } from "../agent/client"; +import type { ID } from "../agent/types"; import { ChatManager, type ChatState } from "../local/chat-manager"; import type { StoredMessage } from "../local/types"; -import type { ID } from "../agent/types"; import type { Agent } from "./use-agent"; export type { ChatStatus } from "../local/chat-manager"; diff --git a/packages/blink/src/react/use-dev-mode.ts b/packages/blink/src/react/use-dev-mode.ts index bfbce7e..fdedb88 100644 --- a/packages/blink/src/react/use-dev-mode.ts +++ b/packages/blink/src/react/use-dev-mode.ts @@ -1,24 +1,24 @@ import type { UIMessage } from "ai"; -import chalk from "chalk"; import { isToolOrDynamicToolUIPart } from "ai"; -import { isToolApprovalOutput } from "../agent/tools"; -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import chalk from "chalk"; import { join } from "path"; -import type { Client, CapabilitiesResponse } from "../agent/client"; -import { getDevhookID, createDevhookID, hasDevhook } from "../cli/lib/devhook"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import type { CapabilitiesResponse } from "../agent/client"; +import type { ID, UIOptions, UIOptionsSchema } from "../agent/index.browser"; +import { isToolApprovalOutput } from "../agent/tools"; +import type { BuildLog } from "../build"; +import { createDevhookID, getDevhookID, hasDevhook } from "../cli/lib/devhook"; import { createLocalServer, type LocalServer } from "../local/server"; import { isLogMessage, isStoredMessageMetadata } from "../local/types"; -import type { BuildLog } from "../build"; -import type { ID, UIOptions, UIOptionsSchema } from "../agent/index.browser"; -import useOptions from "./use-options"; -import useAgent, { type AgentLog, type Agent } from "./use-agent"; +import useAgent, { type Agent, type AgentLog } from "./use-agent"; +import useAuth, { type UseAuth } from "./use-auth"; import useBundler, { type BundlerStatus } from "./use-bundler"; import useChat, { type UseChat } from "./use-chat"; import useDevhook from "./use-devhook"; import useDotenv from "./use-dotenv"; import useEditAgent from "./use-edit-agent"; -import useAuth, { type UseAuth } from "./use-auth"; import type { Logger } from "./use-logger"; +import useOptions from "./use-options"; export type DevMode = "run" | "edit"; @@ -174,7 +174,7 @@ export default function useDevMode(options: UseDevModeOptions): UseDevMode { const allEnv = { ...process.env, ...dotenv, - } + }; if (blinkToken) { allEnv.BLINK_TOKEN = blinkToken; } diff --git a/packages/blink/src/react/use-devhook.ts b/packages/blink/src/react/use-devhook.ts index 4ab2e31..fbcc56d 100644 --- a/packages/blink/src/react/use-devhook.ts +++ b/packages/blink/src/react/use-devhook.ts @@ -1,9 +1,8 @@ import Client from "@blink.so/api"; -import { useEffect, useRef, useState } from "react"; -import { lock, getLockInfo } from "../local/lockfile"; -import { join } from "node:path"; import chalk from "chalk"; -import { getDevhookID } from "../cli/lib/devhook"; +import { join } from "node:path"; +import { useEffect, useRef, useState } from "react"; +import { getLockInfo, lock } from "../local/lockfile"; import type { Logger } from "./use-logger"; export interface UseDevhookOptions { diff --git a/packages/blink/src/react/use-options.test.tsx b/packages/blink/src/react/use-options.test.tsx index 919d4d1..98a8376 100644 --- a/packages/blink/src/react/use-options.test.tsx +++ b/packages/blink/src/react/use-options.test.tsx @@ -1,8 +1,8 @@ import { expect, test } from "bun:test"; -import React, { useEffect } from "react"; import { render } from "ink"; -import useOptions from "./use-options"; +import React, { useEffect } from "react"; import type { CapabilitiesResponse } from "../agent/client"; +import useOptions from "./use-options"; type OptionsSchema = Record< string, diff --git a/packages/blink/src/react/use-options.tsx b/packages/blink/src/react/use-options.tsx index 5a9a170..0d0dd26 100644 --- a/packages/blink/src/react/use-options.tsx +++ b/packages/blink/src/react/use-options.tsx @@ -1,11 +1,11 @@ import type { UIMessage } from "ai"; -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; +import type { CapabilitiesResponse, Client } from "../agent/client"; import { lastUIOptions, type UIOptions, type UIOptionsSchema, } from "../agent/index.browser"; -import type { CapabilitiesResponse, Client } from "../agent/client"; /** * useOptions is a hook that provides the selectable and selected options diff --git a/packages/blink/src/tui/components/markdown.tsx b/packages/blink/src/tui/components/markdown.tsx index 21c8df0..ed011a5 100644 --- a/packages/blink/src/tui/components/markdown.tsx +++ b/packages/blink/src/tui/components/markdown.tsx @@ -1,5 +1,5 @@ import { Text } from "ink"; -import { Lexer, Parser, setOptions, marked } from "marked"; +import { Lexer, marked, Parser, setOptions } from "marked"; import TerminalRenderer from "marked-terminal"; import { memo, useMemo, useRef } from "react"; diff --git a/packages/blink/src/tui/components/text-input.tsx b/packages/blink/src/tui/components/text-input.tsx index 56df294..9509b74 100644 --- a/packages/blink/src/tui/components/text-input.tsx +++ b/packages/blink/src/tui/components/text-input.tsx @@ -1,14 +1,14 @@ -import React, { useMemo, useState } from "react"; -import fs from "fs"; -import { Box, useStdout } from "ink"; import { - InputPrompt, - useTextBuffer, - KeypressProvider as KeypressProviderBase, Config, + InputPrompt, type InputPromptProps, + KeypressProvider as KeypressProviderBase, useBracketedPaste, + useTextBuffer, } from "@jaaydenh/gemini-cli/ui"; +import fs from "fs"; +import { Box, useStdout } from "ink"; +import React, { useMemo, useState } from "react"; function createMinimalConfig(): Config { return new Config({ diff --git a/packages/blink/src/tui/dev.tsx b/packages/blink/src/tui/dev.tsx index 710ec0c..b7b6ca2 100644 --- a/packages/blink/src/tui/dev.tsx +++ b/packages/blink/src/tui/dev.tsx @@ -1,8 +1,19 @@ import type { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai"; import { getToolOrDynamicToolName, isToolOrDynamicToolUIPart } from "ai"; +import { clearTerminal as clearTerminalEscape } from "ansi-escapes"; import chalk from "chalk"; -import { Box, Spacer, Static, Text, useApp, useInput, useStdout } from "ink"; +import { + Box, + render, + Spacer, + Static, + Text, + useApp, + useInput, + useStdout, +} from "ink"; import Spinner from "ink-spinner"; +import util from "node:util"; import { relative } from "path"; import React, { useCallback, @@ -11,23 +22,18 @@ import React, { useRef, useState, } from "react"; -import { clearTerminal as clearTerminalEscape } from "ansi-escapes"; import { isToolApprovalOutput } from "../agent/tools"; -import useDevMode, { type TokenUsage } from "../react/use-dev-mode"; +import type { ID } from "../agent/types"; +import { checkAndMarkFirstRun } from "../cli/lib/first-run"; +import { isLogMessage, type StoredMessage } from "../local/types"; +import useDevMode from "../react/use-dev-mode"; +import { Logger, LoggerContext, useLogger } from "../react/use-logger"; import Markdown from "./components/markdown"; import TextInput, { KeypressProvider, type SlashCommand, } from "./components/text-input"; import useTerminalSize from "./hooks/use-terminal-size"; -import { render } from "ink"; -import { isLogMessage, type StoredMessage } from "../local/types"; -import type { ID } from "../agent/types"; -import { checkAndMarkFirstRun } from "../cli/lib/first-run"; -import type { UseChat } from "../react/use-chat"; -import util from "node:util"; -import { type Source, useLogger } from "../react/use-logger"; -import { Logger, LoggerContext } from "../react/use-logger"; const colors = { run: "#1f86ed", diff --git a/packages/blink/tsdown.config.ts b/packages/blink/tsdown.config.ts index 6b96f4c..80c6eef 100644 --- a/packages/blink/tsdown.config.ts +++ b/packages/blink/tsdown.config.ts @@ -1,7 +1,7 @@ -import { defineConfig, type CopyEntry } from "tsdown"; +import { mkdir, readFile, stat, writeFile } from "fs/promises"; import { dirname, join } from "path"; -import { stat, readFile, writeFile, mkdir } from "fs/promises"; import Sonda from "sonda/rolldown"; +import { defineConfig, type CopyEntry } from "tsdown"; const copies: CopyEntry[] = []; const lydellNodePtyCopiedPaths: Record = {}; diff --git a/packages/compute-protocol/src/client.test.ts b/packages/compute-protocol/src/client.test.ts index 726502c..cd4512b 100644 --- a/packages/compute-protocol/src/client.test.ts +++ b/packages/compute-protocol/src/client.test.ts @@ -1,3 +1,4 @@ +import * as pty from "@lydell/node-pty"; import { randomUUID } from "node:crypto"; import { writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; @@ -5,7 +6,6 @@ import { test } from "node:test"; import path from "path"; import { runAsNodeTest } from "../../../scripts/runAsNodeTest"; import { createInMemoryClientServer } from "./transport"; -import * as pty from "@lydell/node-pty"; if (typeof Bun !== "undefined") { // Unfortunately, these tests have to use Node. diff --git a/packages/compute-protocol/src/process-manager.ts b/packages/compute-protocol/src/process-manager.ts index dffc968..5f81082 100644 --- a/packages/compute-protocol/src/process-manager.ts +++ b/packages/compute-protocol/src/process-manager.ts @@ -2,8 +2,8 @@ import { Emitter } from "@blink-sdk/events"; import type * as pty from "@lydell/node-pty"; import { SerializeAddon } from "@xterm/addon-serialize"; import xterm from "@xterm/headless"; -import { type ProcessStatus } from "./schema"; import { spawn as nodeSpawn } from "child_process"; +import { type ProcessStatus } from "./schema"; export interface Disposable { dispose(): void; diff --git a/packages/compute-protocol/src/server.ts b/packages/compute-protocol/src/server.ts index c42a48a..7ee4a3f 100644 --- a/packages/compute-protocol/src/server.ts +++ b/packages/compute-protocol/src/server.ts @@ -1,6 +1,8 @@ -import Multiplexer, { Stream, FrameCodec } from "@blink-sdk/multiplexer"; +import Multiplexer, { FrameCodec, Stream } from "@blink-sdk/multiplexer"; +import { parse } from "dotenv"; import { fileTypeFromBuffer } from "file-type"; import * as fs from "fs/promises"; +import { WebSocket } from "ws"; import { ProcessManager, type Disposable, @@ -22,9 +24,7 @@ import { type ResponseSchema, type ServerMessage, } from "./schema"; -import { WebSocket } from "ws"; import { createTarFromDirectory } from "./tar"; -import { parse } from "dotenv"; // Helper to trim ANSI output to a safe tail (keep last ~64KB of text) const truncateAnsi = (text: string, limit: number): string => { diff --git a/packages/compute-protocol/src/tar.ts b/packages/compute-protocol/src/tar.ts index e9d8be0..e19c669 100644 --- a/packages/compute-protocol/src/tar.ts +++ b/packages/compute-protocol/src/tar.ts @@ -1,7 +1,7 @@ -import * as tarStream from "tar-stream"; -import * as fs from "node:fs/promises"; import { createReadStream } from "node:fs"; +import * as fs from "node:fs/promises"; import { Readable as NodeReadable } from "node:stream"; +import * as tarStream from "tar-stream"; export const createTarFromDirectory = async ( path: string, diff --git a/packages/compute/src/index.ts b/packages/compute/src/index.ts index 3edab99..dc4b761 100644 --- a/packages/compute/src/index.ts +++ b/packages/compute/src/index.ts @@ -1,15 +1,9 @@ import { Client } from "@blink-sdk/compute-protocol/client"; import { createInMemoryClientServer } from "@blink-sdk/compute-protocol/transport"; -import { - tool, - type JSONValue, - type Tool, - type UIMessage, - type UIMessageStreamWriter, -} from "ai"; -import { z } from "zod"; -import { structuredPatch } from "diff"; +import { tool, type JSONValue, type Tool } from "ai"; import type { ToolWithContext } from "blink"; +import { structuredPatch } from "diff"; +import { z } from "zod"; const limits = { readLineLimit: 2000, diff --git a/packages/database/bun.lock b/packages/database/bun.lock new file mode 100644 index 0000000..113d779 --- /dev/null +++ b/packages/database/bun.lock @@ -0,0 +1,180 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "@blink.so/database", + "devDependencies": { + "@electric-sql/pglite": "0.3.2", + "dotenv": "^17.2.3", + "drizzle-kit": "^0.31.5", + "drizzle-orm": "^0.44.5", + "pg": "^8.16.0", + "pg-gateway": "^0.3.0-beta.4", + "postgres": "^3.4.7", + }, + }, + }, + "packages": { + "@drizzle-team/brocli": ["@drizzle-team/brocli@0.10.2", "", {}, "sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w=="], + + "@electric-sql/pglite": ["@electric-sql/pglite@0.3.2", "", {}, "sha512-zfWWa+V2ViDCY/cmUfRqeWY1yLto+EpxjXnZzenB1TyxsTiXaTWeZFIZw6mac52BsuQm0RjCnisjBtdBaXOI6w=="], + + "@esbuild-kit/core-utils": ["@esbuild-kit/core-utils@3.3.2", "", { "dependencies": { "esbuild": "~0.18.20", "source-map-support": "^0.5.21" } }, "sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ=="], + + "@esbuild-kit/esm-loader": ["@esbuild-kit/esm-loader@2.6.5", "", { "dependencies": { "@esbuild-kit/core-utils": "^3.3.2", "get-tsconfig": "^4.7.0" } }, "sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA=="], + + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], + + "@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], + + "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.10", "", { "os": "android", "cpu": "arm64" }, "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg=="], + + "@esbuild/android-x64": ["@esbuild/android-x64@0.25.10", "", { "os": "android", "cpu": "x64" }, "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg=="], + + "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA=="], + + "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg=="], + + "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.10", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg=="], + + "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.10", "", { "os": "freebsd", "cpu": "x64" }, "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA=="], + + "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.10", "", { "os": "linux", "cpu": "arm" }, "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg=="], + + "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ=="], + + "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.10", "", { "os": "linux", "cpu": "ia32" }, "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ=="], + + "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg=="], + + "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA=="], + + "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA=="], + + "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA=="], + + "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew=="], + + "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA=="], + + "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A=="], + + "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.10", "", { "os": "none", "cpu": "x64" }, "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig=="], + + "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.10", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw=="], + + "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.10", "", { "os": "openbsd", "cpu": "x64" }, "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw=="], + + "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag=="], + + "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.10", "", { "os": "sunos", "cpu": "x64" }, "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ=="], + + "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw=="], + + "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw=="], + + "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], + + "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], + + "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + + "dotenv": ["dotenv@17.2.3", "", {}, "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w=="], + + "drizzle-kit": ["drizzle-kit@0.31.5", "", { "dependencies": { "@drizzle-team/brocli": "^0.10.2", "@esbuild-kit/esm-loader": "^2.5.5", "esbuild": "^0.25.4", "esbuild-register": "^3.5.0" }, "bin": { "drizzle-kit": "bin.cjs" } }, "sha512-+CHgPFzuoTQTt7cOYCV6MOw2w8vqEn/ap1yv4bpZOWL03u7rlVRQhUY0WYT3rHsgVTXwYQDZaSUJSQrMBUKuWg=="], + + "drizzle-orm": ["drizzle-orm@0.44.6", "", { "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1.13", "@prisma/client": "*", "@tidbcloud/serverless": "*", "@types/better-sqlite3": "*", "@types/pg": "*", "@types/sql.js": "*", "@upstash/redis": ">=1.34.7", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "better-sqlite3": ">=7", "bun-types": "*", "expo-sqlite": ">=14.0.0", "gel": ">=2", "knex": "*", "kysely": "*", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", "sqlite3": ">=5" }, "optionalPeers": ["@aws-sdk/client-rds-data", "@cloudflare/workers-types", "@electric-sql/pglite", "@libsql/client", "@libsql/client-wasm", "@neondatabase/serverless", "@op-engineering/op-sqlite", "@opentelemetry/api", "@planetscale/database", "@prisma/client", "@tidbcloud/serverless", "@types/better-sqlite3", "@types/pg", "@types/sql.js", "@upstash/redis", "@vercel/postgres", "@xata.io/client", "better-sqlite3", "bun-types", "expo-sqlite", "gel", "knex", "kysely", "mysql2", "pg", "postgres", "sql.js", "sqlite3"] }, "sha512-uy6uarrrEOc9K1u5/uhBFJbdF5VJ5xQ/Yzbecw3eAYOunv5FDeYkR2m8iitocdHBOHbvorviKOW5GVw0U1j4LQ=="], + + "esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + + "esbuild-register": ["esbuild-register@3.6.0", "", { "dependencies": { "debug": "^4.3.4" }, "peerDependencies": { "esbuild": ">=0.12 <1" } }, "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg=="], + + "get-tsconfig": ["get-tsconfig@4.12.0", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-LScr2aNr2FbjAjZh2C6X6BxRx1/x+aTDExct/xyq2XKbYOiG5c0aK7pMsSuyc0brz3ibr/lbQiHD9jzt4lccJw=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "pg": ["pg@8.16.3", "", { "dependencies": { "pg-connection-string": "^2.9.1", "pg-pool": "^3.10.1", "pg-protocol": "^1.10.3", "pg-types": "2.2.0", "pgpass": "1.0.5" }, "optionalDependencies": { "pg-cloudflare": "^1.2.7" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw=="], + + "pg-cloudflare": ["pg-cloudflare@1.2.7", "", {}, "sha512-YgCtzMH0ptvZJslLM1ffsY4EuGaU0cx4XSdXLRFae8bPP4dS5xL1tNB3k2o/N64cHJpwU7dxKli/nZ2lUa5fLg=="], + + "pg-connection-string": ["pg-connection-string@2.9.1", "", {}, "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w=="], + + "pg-gateway": ["pg-gateway@0.3.0-beta.4", "", {}, "sha512-CTjsM7Z+0Nx2/dyZ6r8zRsc3f9FScoD5UAOlfUx1Fdv/JOIWvRbF7gou6l6vP+uypXQVoYPgw8xZDXgMGvBa4Q=="], + + "pg-int8": ["pg-int8@1.0.1", "", {}, "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="], + + "pg-pool": ["pg-pool@3.10.1", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg=="], + + "pg-protocol": ["pg-protocol@1.10.3", "", {}, "sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ=="], + + "pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], + + "pgpass": ["pgpass@1.0.5", "", { "dependencies": { "split2": "^4.1.0" } }, "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug=="], + + "postgres": ["postgres@3.4.7", "", {}, "sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw=="], + + "postgres-array": ["postgres-array@2.0.0", "", {}, "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="], + + "postgres-bytea": ["postgres-bytea@1.0.0", "", {}, "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w=="], + + "postgres-date": ["postgres-date@1.0.7", "", {}, "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q=="], + + "postgres-interval": ["postgres-interval@1.2.0", "", { "dependencies": { "xtend": "^4.0.0" } }, "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ=="], + + "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], + + "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], + + "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], + + "split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="], + + "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], + + "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.18.20", "", { "os": "android", "cpu": "arm" }, "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.18.20", "", { "os": "android", "cpu": "arm64" }, "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.18.20", "", { "os": "android", "cpu": "x64" }, "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.18.20", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.18.20", "", { "os": "darwin", "cpu": "x64" }, "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.18.20", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.18.20", "", { "os": "freebsd", "cpu": "x64" }, "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.18.20", "", { "os": "linux", "cpu": "arm" }, "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.18.20", "", { "os": "linux", "cpu": "arm64" }, "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.18.20", "", { "os": "linux", "cpu": "ia32" }, "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.18.20", "", { "os": "linux", "cpu": "none" }, "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.18.20", "", { "os": "linux", "cpu": "none" }, "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.18.20", "", { "os": "linux", "cpu": "ppc64" }, "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.18.20", "", { "os": "linux", "cpu": "none" }, "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.18.20", "", { "os": "linux", "cpu": "s390x" }, "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.18.20", "", { "os": "linux", "cpu": "x64" }, "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.18.20", "", { "os": "none", "cpu": "x64" }, "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.18.20", "", { "os": "openbsd", "cpu": "x64" }, "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.18.20", "", { "os": "sunos", "cpu": "x64" }, "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.18.20", "", { "os": "win32", "cpu": "arm64" }, "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.18.20", "", { "os": "win32", "cpu": "ia32" }, "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g=="], + + "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], + } +} diff --git a/packages/database/drizzle.config.ts b/packages/database/drizzle.config.ts new file mode 100644 index 0000000..3d20ae0 --- /dev/null +++ b/packages/database/drizzle.config.ts @@ -0,0 +1,17 @@ +import { config } from "dotenv"; +import { defineConfig } from "drizzle-kit"; + +config({ + path: "../../.env.local", +}); + +export default defineConfig({ + schema: "./src/schema.ts", + out: "./migrations", + dialect: "postgresql", + dbCredentials: { + url: + process.env.POSTGRES_URL || + "postgresql://postgres:mysecretpassword@localhost:5432/postgres", + }, +}); diff --git a/packages/database/dump_schema.ts b/packages/database/dump_schema.ts new file mode 100644 index 0000000..cb8f896 --- /dev/null +++ b/packages/database/dump_schema.ts @@ -0,0 +1,61 @@ +import { PGlite } from "@electric-sql/pglite"; +import { uuid_ossp } from "@electric-sql/pglite/contrib/uuid_ossp"; +import { vector } from "@electric-sql/pglite/vector"; +import { drizzle } from "drizzle-orm/pglite"; +import { migrate } from "drizzle-orm/pglite/migrator"; +import { join } from "path"; + +const db = new PGlite("memory://", { + username: "postgres", + debug: 0, + extensions: { vector, uuid_ossp }, +}); + +await db.waitReady; +await db.exec("SET client_min_messages TO ERROR;"); +await db.exec("SET log_min_messages TO ERROR;"); + +// Apply all migrations +await migrate(drizzle(db), { + migrationsFolder: join(__dirname, "migrations"), +}); + +console.log("✅ Migrations applied"); + +// Now dump the schema +const result = await db.query(` + SELECT string_agg(ddl || ';', E'\n--> statement-breakpoint\n' ORDER BY sort_order) + FROM ( + -- Tables + SELECT 1 as sort_order, + 'CREATE TABLE ' || quote_ident(schemaname) || '.' || quote_ident(tablename) || ' (...)' as ddl + FROM pg_tables + WHERE schemaname = 'public' + + UNION ALL + + -- Functions + SELECT 2, pg_get_functiondef(p.oid) + FROM pg_proc p + JOIN pg_namespace n ON p.pronamespace = n.oid + WHERE n.nspname = 'public' + + UNION ALL + + -- Triggers + SELECT 3, pg_get_triggerdef(t.oid) + FROM pg_trigger t + JOIN pg_class c ON t.tgrelid = c.oid + JOIN pg_namespace n ON c.relnamespace = n.oid + WHERE n.nspname = 'public' AND NOT t.tgisinternal + + UNION ALL + + -- Views + SELECT 4, 'CREATE VIEW ' || quote_ident(schemaname) || '.' || quote_ident(viewname) || ' AS ' || definition + FROM pg_views + WHERE schemaname = 'public' + ) AS all_ddl +`); + +console.log(result.rows[0]); diff --git a/packages/database/migrate.ts b/packages/database/migrate.ts new file mode 100644 index 0000000..c1d433d --- /dev/null +++ b/packages/database/migrate.ts @@ -0,0 +1,37 @@ +import { config } from "dotenv"; +import { drizzle } from "drizzle-orm/node-postgres"; +import { migrate } from "drizzle-orm/node-postgres/migrator"; +import { join } from "path"; +import { Client } from "pg"; + +config({ + path: "../../.env.local", +}); + +const runMigrate = async () => { + if (!process.env.POSTGRES_URL) { + // This is the default that we start PostgreSQL with in dev mode. + // Run `bun db` to start it. + process.env.POSTGRES_URL = + "postgresql://postgres:mysecretpassword@localhost:5432/postgres"; + } + + const connection = new Client({ connectionString: process.env.POSTGRES_URL }); + await connection.connect(); + const db = drizzle(connection); + + console.log("⏳ Running migrations..."); + + const start = Date.now(); + await migrate(db, { migrationsFolder: join(__dirname, "migrations") }); + const end = Date.now(); + + console.log("✅ Migrations completed in", end - start, "ms"); + process.exit(0); +}; + +runMigrate().catch((err) => { + console.error("❌ Migration failed"); + console.error(err); + process.exit(1); +}); diff --git a/packages/database/migrations/0000_initial.sql b/packages/database/migrations/0000_initial.sql new file mode 100644 index 0000000..5345380 --- /dev/null +++ b/packages/database/migrations/0000_initial.sql @@ -0,0 +1,437 @@ +CREATE TABLE agent (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), visibility character varying NOT NULL DEFAULT 'organization'::character varying, description text, organization_id uuid NOT NULL, created_by uuid NOT NULL, last_deployment_number integer NOT NULL DEFAULT 0, last_run_number integer NOT NULL DEFAULT 0, active_deployment_id uuid, name character varying(40) NOT NULL, avatar_file_id uuid, chat_expire_ttl integer); +--> statement-breakpoint +CREATE TABLE agent_deployment (created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), agent_id uuid NOT NULL, output_files json, status character varying NOT NULL DEFAULT 'pending'::character varying, error_message text, number bigint NOT NULL, id uuid NOT NULL DEFAULT gen_random_uuid(), entrypoint text NOT NULL, target_id uuid NOT NULL, created_by uuid, created_from text NOT NULL, user_message text, platform text NOT NULL, platform_memory_mb integer NOT NULL, platform_region text, platform_metadata json, direct_access_url text, compatibility_version text NOT NULL DEFAULT '1'::text, source_files json); +--> statement-breakpoint +CREATE TABLE agent_deployment_log (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), agent_id uuid NOT NULL, deployment_id integer NOT NULL, level character varying NOT NULL, message text NOT NULL); +--> statement-breakpoint +CREATE TABLE agent_deployment_target (id uuid NOT NULL DEFAULT gen_random_uuid(), agent_id uuid NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), target text NOT NULL, request_id uuid NOT NULL DEFAULT gen_random_uuid()); +--> statement-breakpoint +CREATE TABLE agent_environment_variable (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), agent_id uuid NOT NULL, value text, secret boolean NOT NULL DEFAULT false, created_by uuid NOT NULL, updated_by uuid NOT NULL, key text NOT NULL, target text[] NOT NULL DEFAULT '{preview,production}'::text[], encrypted_value text, encrypted_dek text, encryption_iv text, encryption_auth_tag text); +--> statement-breakpoint +CREATE TABLE agent_log (id uuid NOT NULL DEFAULT gen_random_uuid(), agent_id uuid NOT NULL, level character varying(8) NOT NULL DEFAULT 'info'::character varying, payload jsonb NOT NULL, metadata jsonb, "timestamp" timestamp without time zone NOT NULL DEFAULT now(), payload_str text NOT NULL); +--> statement-breakpoint +CREATE TABLE agent_permission (id uuid NOT NULL DEFAULT gen_random_uuid(), agent_id uuid NOT NULL, user_id uuid, permission character varying NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), created_by uuid NOT NULL); +--> statement-breakpoint +CREATE TABLE agent_pin (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL DEFAULT now(), agent_id uuid NOT NULL, user_id uuid NOT NULL); +--> statement-breakpoint +CREATE TABLE agent_storage_kv (id uuid NOT NULL DEFAULT gen_random_uuid(), agent_id uuid NOT NULL, agent_deployment_target_id uuid NOT NULL, key text NOT NULL, value text NOT NULL); +--> statement-breakpoint +CREATE TABLE agent_trace (id uuid NOT NULL DEFAULT gen_random_uuid(), agent_id uuid NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), start_time timestamp without time zone NOT NULL, end_time timestamp without time zone NOT NULL, payload jsonb NOT NULL, payload_original text NOT NULL, payload_str text NOT NULL); +--> statement-breakpoint +CREATE TABLE api_key (id uuid NOT NULL DEFAULT gen_random_uuid(), user_id uuid NOT NULL, name character varying(255), key_hash text NOT NULL, key_lookup character varying(12) NOT NULL, key_prefix character varying(20) NOT NULL, key_suffix character varying(4) NOT NULL, scope character varying NOT NULL DEFAULT 'full'::character varying, expires_at timestamp without time zone, last_used_at timestamp without time zone, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), revoked_at timestamp without time zone, revoked_by uuid); +--> statement-breakpoint +CREATE TABLE chat (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL, created_by uuid, title text, organization_id uuid NOT NULL, visibility character varying NOT NULL DEFAULT 'private'::character varying, metadata json, archived boolean NOT NULL DEFAULT false, last_run_number integer NOT NULL DEFAULT 0, agent_id uuid NOT NULL, agent_deployment_id uuid, agent_deployment_target_id uuid, agent_key character varying(128) NOT NULL, expire_ttl integer); +--> statement-breakpoint +CREATE TABLE chat_run (chat_id uuid NOT NULL, number bigint NOT NULL, agent_id uuid NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), last_step_number integer NOT NULL DEFAULT 0, id uuid NOT NULL DEFAULT gen_random_uuid(), agent_deployment_id uuid); +--> statement-breakpoint +CREATE TABLE chat_run_step (chat_id uuid NOT NULL, number integer NOT NULL, agent_id uuid NOT NULL, started_at timestamp without time zone NOT NULL DEFAULT now(), heartbeat_at timestamp without time zone NOT NULL DEFAULT now(), completed_at timestamp without time zone, interrupted_at timestamp without time zone, first_message_id uuid, last_message_id uuid, error text, response_status integer, response_headers json, response_headers_redacted boolean NOT NULL DEFAULT false, response_body text, response_body_redacted boolean NOT NULL DEFAULT false, response_message_id uuid, continuation_reason text, id uuid NOT NULL DEFAULT gen_random_uuid(), chat_run_id uuid NOT NULL, agent_deployment_id uuid NOT NULL, tool_calls_total integer NOT NULL DEFAULT 0, tool_calls_completed integer NOT NULL DEFAULT 0, tool_calls_errored integer NOT NULL DEFAULT 0, time_to_first_token_micros bigint, usage_cost_usd double precision, usage_model text, usage_total_input_tokens integer, usage_total_output_tokens integer, usage_total_tokens integer, usage_total_cached_input_tokens integer); +--> statement-breakpoint +CREATE TABLE chat_user_state (chat_id uuid NOT NULL, user_id uuid NOT NULL, last_read_at timestamp without time zone); +--> statement-breakpoint +CREATE TABLE email_verification (email text NOT NULL, code text NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), expires_at timestamp without time zone NOT NULL); +--> statement-breakpoint +CREATE TABLE file (id uuid NOT NULL DEFAULT gen_random_uuid(), user_id uuid, name text NOT NULL, content_type text NOT NULL, byte_length integer NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), pdf_page_count integer, organization_id uuid, message_id uuid, content bytea); +--> statement-breakpoint +CREATE TABLE message (id uuid NOT NULL DEFAULT gen_random_uuid(), chat_id uuid NOT NULL, role character varying NOT NULL, parts json NOT NULL, user_id uuid, created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, metadata json, agent_id uuid, updated_at timestamp without time zone NOT NULL DEFAULT now(), agent_deployment_id uuid, chat_run_id uuid, chat_run_step_id uuid); +--> statement-breakpoint +CREATE TABLE organization (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL DEFAULT now(), created_by uuid, billing_tier character varying NOT NULL DEFAULT 'free'::character varying, billing_interval character varying NOT NULL DEFAULT 'month'::character varying, stripe_customer_id text, stripe_subscription_id text, next_billing_date timestamp without time zone, avatar_url character varying(2048), updated_at timestamp without time zone NOT NULL DEFAULT now(), name character varying(40) NOT NULL, kind character varying NOT NULL DEFAULT 'organization'::character varying, personal_owner_user_id uuid, metronome_customer_id text, metronome_contract_id text, billing_entitled_at timestamp without time zone); +--> statement-breakpoint +CREATE TABLE organization_billing_usage_event (id uuid NOT NULL DEFAULT gen_random_uuid(), created_at timestamp without time zone NOT NULL DEFAULT now(), organization_id uuid NOT NULL, transaction_id text NOT NULL, event_type text NOT NULL, cost_usd numeric(32,18) NOT NULL, user_id uuid, processed_at timestamp without time zone, error_message text); +--> statement-breakpoint +CREATE TABLE organization_invite (id uuid NOT NULL DEFAULT gen_random_uuid(), organization_id uuid NOT NULL, email text, role character varying NOT NULL DEFAULT 'member'::character varying, code text NOT NULL, reusable boolean NOT NULL DEFAULT false, expires_at timestamp without time zone DEFAULT now(), last_accepted_at timestamp without time zone, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), invited_by uuid NOT NULL); +--> statement-breakpoint +CREATE TABLE organization_membership (organization_id uuid NOT NULL, user_id uuid NOT NULL, role character varying NOT NULL DEFAULT 'member'::character varying, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now(), billing_emails_opt_out boolean NOT NULL DEFAULT false); +--> statement-breakpoint +CREATE TABLE "user" (id uuid NOT NULL, display_name text, email text, email_verified timestamp without time zone, password text, created_at timestamp without time zone NOT NULL DEFAULT now(), updated_at timestamp without time zone NOT NULL DEFAULT now()); +--> statement-breakpoint +CREATE TABLE user_account (user_id uuid NOT NULL, type text NOT NULL, provider text NOT NULL, provider_account_id text NOT NULL, refresh_token text, access_token text, expires_at integer, token_type text, scope text, id_token text, session_state text); +--> statement-breakpoint +ALTER TABLE agent ADD CONSTRAINT agent_visibility_check CHECK (((visibility)::text = ANY ((ARRAY['private'::character varying, 'public'::character varying, 'organization'::character varying])::text[]))); +--> statement-breakpoint +ALTER TABLE agent ADD CONSTRAINT name_format CHECK (((name)::text ~* '^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$'::text)); +--> statement-breakpoint +ALTER TABLE organization ADD CONSTRAINT name_format CHECK (((name)::text ~* '^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$'::text)); +--> statement-breakpoint +ALTER TABLE organization ADD CONSTRAINT name_not_reserved CHECK (((name)::text <> ALL ((ARRAY['api'::character varying, 'auth'::character varying, 'login'::character varying, 'logout'::character varying, 'signup'::character varying, 'register'::character varying, 'help'::character varying, 'docs'::character varying, 'support'::character varying, 'contact'::character varying, 'about'::character varying, 'blog'::character varying, 'chat'::character varying, 'agents'::character varying, 'agent'::character varying, 'shortcuts'::character varying, 'integrations'::character varying, 'user'::character varying, 'team'::character varying, 'new'::character varying, 'recent-chats'::character varying, 'telemetry'::character varying, 'settings'::character varying, 'account'::character varying, 'profile'::character varying, 'billing'::character varying, 'admin'::character varying, 'dashboard'::character varying, 'privacy'::character varying, 'terms'::character varying, 'tos'::character varying, 'legal'::character varying, 'security'::character varying, 'internal'::character varying, 'webhook'::character varying, 'webhooks'::character varying, 'callback'::character varying, 'verify'::character varying, 'metrics'::character varying, 'status'::character varying, 'health'::character varying])::text[]))); +--> statement-breakpoint +ALTER TABLE organization ADD CONSTRAINT personal_created_by_matches_owner CHECK ((((kind)::text <> 'personal'::text) OR (created_by = personal_owner_user_id))); +--> statement-breakpoint +ALTER TABLE organization ADD CONSTRAINT personal_owner_presence CHECK (((((kind)::text = 'personal'::text) AND (personal_owner_user_id IS NOT NULL)) OR (((kind)::text = 'organization'::text) AND (personal_owner_user_id IS NULL)))); +--> statement-breakpoint +ALTER TABLE agent_deployment_target ADD CONSTRAINT agent_deployment_target_request_id_unique UNIQUE (request_id); +--> statement-breakpoint +ALTER TABLE api_key ADD CONSTRAINT api_key_key_lookup_unique UNIQUE (key_lookup); +--> statement-breakpoint +ALTER TABLE organization_invite ADD CONSTRAINT organization_invite_code_unique UNIQUE (code); +--> statement-breakpoint +ALTER TABLE "user" ADD CONSTRAINT user_email_unique UNIQUE (email); +--> statement-breakpoint +ALTER TABLE agent ADD CONSTRAINT agent_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_deployment ADD CONSTRAINT agent_deployment_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_deployment_log ADD CONSTRAINT agent_deployment_log_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_deployment_target ADD CONSTRAINT agent_deployment_target_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_environment_variable ADD CONSTRAINT agent_environment_variable_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_log ADD CONSTRAINT agent_log_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_permission ADD CONSTRAINT agent_permission_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_pin ADD CONSTRAINT agent_pin_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_storage_kv ADD CONSTRAINT agent_storage_kv_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE agent_trace ADD CONSTRAINT agent_trace_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE api_key ADD CONSTRAINT api_key_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE chat ADD CONSTRAINT chat_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE chat_run ADD CONSTRAINT chat_run_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE chat_run_step ADD CONSTRAINT chat_run_step_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE chat_user_state ADD CONSTRAINT chat_user_state_chat_id_user_id_pk PRIMARY KEY (chat_id, user_id); +--> statement-breakpoint +ALTER TABLE file ADD CONSTRAINT message_attachment_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE message ADD CONSTRAINT message_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE organization ADD CONSTRAINT organization_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE organization_billing_usage_event ADD CONSTRAINT organization_billing_usage_event_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE organization_invite ADD CONSTRAINT organization_invite_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE organization_membership ADD CONSTRAINT organization_membership_organization_id_user_id_pk PRIMARY KEY (organization_id, user_id); +--> statement-breakpoint +ALTER TABLE "user" ADD CONSTRAINT user_pkey PRIMARY KEY (id); +--> statement-breakpoint +ALTER TABLE user_account ADD CONSTRAINT user_account_provider_provider_account_id_pk PRIMARY KEY (provider, provider_account_id); +--> statement-breakpoint +ALTER TABLE agent_deployment ADD CONSTRAINT agent_deployment_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_deployment ADD CONSTRAINT agent_deployment_target_id_agent_deployment_target_id_fk FOREIGN KEY (target_id) REFERENCES agent_deployment_target(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_deployment_log ADD CONSTRAINT agent_deployment_log_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_deployment_target ADD CONSTRAINT agent_deployment_target_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_environment_variable ADD CONSTRAINT agent_environment_variable_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_log ADD CONSTRAINT agent_log_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_permission ADD CONSTRAINT agent_permission_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_permission ADD CONSTRAINT agent_permission_created_by_user_id_fk FOREIGN KEY (created_by) REFERENCES "user"(id); +--> statement-breakpoint +ALTER TABLE agent_permission ADD CONSTRAINT agent_permission_user_id_user_id_fk FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_pin ADD CONSTRAINT agent_pin_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_pin ADD CONSTRAINT agent_pin_user_id_user_id_fk FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_storage_kv ADD CONSTRAINT agent_storage_kv_agent_deployment_target_id_agent_deployment_ta FOREIGN KEY (agent_deployment_target_id) REFERENCES agent_deployment_target(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_storage_kv ADD CONSTRAINT agent_storage_kv_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE agent_trace ADD CONSTRAINT agent_trace_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE api_key ADD CONSTRAINT api_key_revoked_by_user_id_fk FOREIGN KEY (revoked_by) REFERENCES "user"(id) ON DELETE SET NULL; +--> statement-breakpoint +ALTER TABLE api_key ADD CONSTRAINT api_key_user_id_user_id_fk FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat ADD CONSTRAINT chat_agent_deployment_id_agent_deployment_id_fk FOREIGN KEY (agent_deployment_id) REFERENCES agent_deployment(id) ON DELETE SET NULL; +--> statement-breakpoint +ALTER TABLE chat ADD CONSTRAINT chat_agent_deployment_target_id_agent_deployment_target_id_fk FOREIGN KEY (agent_deployment_target_id) REFERENCES agent_deployment_target(id) ON DELETE SET NULL; +--> statement-breakpoint +ALTER TABLE chat ADD CONSTRAINT chat_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE SET NULL; +--> statement-breakpoint +ALTER TABLE chat ADD CONSTRAINT chat_organization_id_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organization(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat_run ADD CONSTRAINT chat_run_agent_id_agent_id_fk FOREIGN KEY (agent_id) REFERENCES agent(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat_run ADD CONSTRAINT chat_run_chat_id_chat_id_fk FOREIGN KEY (chat_id) REFERENCES chat(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat_run_step ADD CONSTRAINT chat_run_step_chat_id_chat_id_fk FOREIGN KEY (chat_id) REFERENCES chat(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat_run_step ADD CONSTRAINT chat_run_step_chat_run_id_chat_run_id_fk FOREIGN KEY (chat_run_id) REFERENCES chat_run(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat_user_state ADD CONSTRAINT chat_user_state_chat_id_chat_id_fk FOREIGN KEY (chat_id) REFERENCES chat(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE chat_user_state ADD CONSTRAINT chat_user_state_user_id_user_id_fk FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE message ADD CONSTRAINT message_chat_id_chat_id_fk FOREIGN KEY (chat_id) REFERENCES chat(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE organization ADD CONSTRAINT organization_personal_owner_user_id_user_id_fk FOREIGN KEY (personal_owner_user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE organization_invite ADD CONSTRAINT organization_invite_invited_by_membership_fk FOREIGN KEY (organization_id, invited_by) REFERENCES organization_membership(organization_id, user_id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE organization_invite ADD CONSTRAINT organization_invite_organization_id_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organization(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE organization_membership ADD CONSTRAINT organization_membership_organization_id_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organization(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE organization_membership ADD CONSTRAINT organization_membership_user_id_user_id_fk FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +ALTER TABLE user_account ADD CONSTRAINT user_account_user_id_user_id_fk FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE; +--> statement-breakpoint +CREATE UNIQUE INDEX agent_name_unique ON public.agent USING btree (organization_id, lower((name)::text)); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_deployment_agent_id_number_unique ON public.agent_deployment USING btree (agent_id, number); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_deployment_target_agent_id_target_unique ON public.agent_deployment_target USING btree (agent_id, target); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_env_key_prev_unique ON public.agent_environment_variable USING btree (agent_id, key) WHERE ('preview'::text = ANY (target)); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_env_key_prod_unique ON public.agent_environment_variable USING btree (agent_id, key) WHERE ('production'::text = ANY (target)); +--> statement-breakpoint +CREATE INDEX agent_environment_variable_agent_id_idx ON public.agent_environment_variable USING btree (agent_id); +--> statement-breakpoint +CREATE INDEX agent_log_agent_time_idx ON public.agent_log USING btree (agent_id, "timestamp" DESC NULLS LAST); +--> statement-breakpoint +CREATE INDEX agent_log_payload_gin_idx ON public.agent_log USING gin (payload jsonb_path_ops); +--> statement-breakpoint +CREATE INDEX agent_log_timestamp_brin_idx ON public.agent_log USING brin ("timestamp"); +--> statement-breakpoint +CREATE INDEX agent_permission_agent_id_index ON public.agent_permission USING btree (agent_id); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_permission_agent_id_user_id_unique ON public.agent_permission USING btree (agent_id, user_id); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_pin_agent_id_user_id_unique ON public.agent_pin USING btree (agent_id, user_id); +--> statement-breakpoint +CREATE UNIQUE INDEX agent_storage_kv_agent_deployment_target_id_key_unique ON public.agent_storage_kv USING btree (agent_deployment_target_id, key); +--> statement-breakpoint +CREATE INDEX agent_trace_agent_time_idx ON public.agent_trace USING btree (agent_id, start_time DESC NULLS LAST); +--> statement-breakpoint +CREATE INDEX agent_trace_payload_gin_idx ON public.agent_trace USING gin (payload jsonb_path_ops); +--> statement-breakpoint +CREATE INDEX agent_trace_start_time_brin_idx ON public.agent_trace USING brin (start_time); +--> statement-breakpoint +CREATE INDEX api_key_lookup_idx ON public.api_key USING btree (key_lookup); +--> statement-breakpoint +CREATE INDEX api_key_user_idx ON public.api_key USING btree (user_id); +--> statement-breakpoint +CREATE INDEX chat_organization_created_at_idx ON public.chat USING btree (organization_id, created_at); +--> statement-breakpoint +CREATE UNIQUE INDEX idx_chat_agent_deployment_target_id_key_unique ON public.chat USING btree (agent_deployment_target_id, agent_key); +--> statement-breakpoint +CREATE INDEX idx_chat_expire_ttl ON public.chat USING btree (created_at) WHERE (expire_ttl IS NOT NULL); +--> statement-breakpoint +CREATE INDEX idx_chat_organization_created_by ON public.chat USING btree (organization_id, created_by, created_at); +--> statement-breakpoint +CREATE INDEX idx_chat_visibility ON public.chat USING btree (organization_id, visibility, created_at) WHERE ((visibility)::text = ANY ((ARRAY['public'::character varying, 'private'::character varying, 'organization'::character varying])::text[])); +--> statement-breakpoint +CREATE UNIQUE INDEX chat_run_chat_id_number_unique ON public.chat_run USING btree (chat_id, number); +--> statement-breakpoint +CREATE INDEX chat_run_step_agent_deployment_id_started_at_idx ON public.chat_run_step USING btree (agent_deployment_id, started_at); +--> statement-breakpoint +CREATE INDEX chat_run_step_agent_id_started_at_idx ON public.chat_run_step USING btree (agent_id, started_at); +--> statement-breakpoint +CREATE UNIQUE INDEX chat_run_step_chat_run_id_id_unique ON public.chat_run_step USING btree (chat_run_id, number); +--> statement-breakpoint +CREATE UNIQUE INDEX chat_run_step_single_streaming ON public.chat_run_step USING btree (chat_id) WHERE ((completed_at IS NULL) AND (error IS NULL) AND (interrupted_at IS NULL)); +--> statement-breakpoint +CREATE UNIQUE INDEX idx_email_verification_email_code ON public.email_verification USING btree (email, code); +--> statement-breakpoint +CREATE INDEX idx_message_chat_role_created ON public.message USING btree (chat_id, role) WHERE ((role)::text = 'user'::text); +--> statement-breakpoint +CREATE UNIQUE INDEX organization_name_unique ON public.organization USING btree (lower((name)::text)); +--> statement-breakpoint +CREATE UNIQUE INDEX personal_org_per_user ON public.organization USING btree (personal_owner_user_id) WHERE ((kind)::text = 'personal'::text); +--> statement-breakpoint +CREATE UNIQUE INDEX organization_billing_usage_event_org_txn_unique ON public.organization_billing_usage_event USING btree (organization_id, transaction_id); +--> statement-breakpoint +CREATE OR REPLACE FUNCTION public.assign_agent_deployment_number() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +BEGIN + UPDATE agent + SET last_deployment_number = last_deployment_number + 1 + WHERE id = NEW.agent_id + RETURNING last_deployment_number INTO NEW.number; + RETURN NEW; +END; +$function$ +; +--> statement-breakpoint +CREATE OR REPLACE FUNCTION public.assign_chat_run_number() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +BEGIN + UPDATE chat + SET last_run_number = last_run_number + 1 + WHERE id = NEW.chat_id + RETURNING last_run_number INTO NEW.number; + RETURN NEW; +END; +$function$ +; +--> statement-breakpoint +CREATE OR REPLACE FUNCTION public.assign_chat_run_step_number() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +BEGIN + UPDATE chat_run + SET last_step_number = last_step_number + 1 + WHERE id = NEW.chat_run_id + RETURNING last_step_number INTO NEW.number; + RETURN NEW; +END; +$function$ +; +--> statement-breakpoint +CREATE OR REPLACE FUNCTION public.ensure_agent_deployment_targets() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +begin + insert into agent_deployment_target (agent_id, target) values (new.id, 'preview') + on conflict do nothing; + insert into agent_deployment_target (agent_id, target) values (new.id, 'production') + on conflict do nothing; + return new; +end $function$ +; +--> statement-breakpoint +CREATE OR REPLACE FUNCTION public.forbid_direct_delete_personal_org() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +BEGIN + -- This only allows deletions through CASCADE. + -- This prevents *us* from accidentally allowing users to delete + -- their personal organizations via the API, and then losing their data. + IF OLD.kind = 'personal' AND pg_trigger_depth() = 0 THEN + RAISE EXCEPTION 'Cannot delete personal organizations directly'; + END IF; + RETURN OLD; +END$function$ +; +--> statement-breakpoint +CREATE OR REPLACE FUNCTION public.set_agent_key_default() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +BEGIN + IF NEW.agent_key IS NULL THEN + NEW.agent_key := NEW.id::text; + END IF; + RETURN NEW; +END; +$function$ +; +--> statement-breakpoint +CREATE TRIGGER trg_agent_deployment_targets_after_insert AFTER INSERT ON public.agent FOR EACH ROW EXECUTE FUNCTION ensure_agent_deployment_targets(); +--> statement-breakpoint +CREATE TRIGGER tg_assign_agent_deployment_number BEFORE INSERT ON public.agent_deployment FOR EACH ROW WHEN ((new.number IS NULL)) EXECUTE FUNCTION assign_agent_deployment_number(); +--> statement-breakpoint +CREATE TRIGGER set_agent_key_before_insert BEFORE INSERT ON public.chat FOR EACH ROW EXECUTE FUNCTION set_agent_key_default(); +--> statement-breakpoint +CREATE TRIGGER tg_assign_chat_run_number BEFORE INSERT ON public.chat_run FOR EACH ROW WHEN ((new.number IS NULL)) EXECUTE FUNCTION assign_chat_run_number(); +--> statement-breakpoint +CREATE TRIGGER tg_assign_chat_run_step_number BEFORE INSERT ON public.chat_run_step FOR EACH ROW WHEN ((new.number IS NULL)) EXECUTE FUNCTION assign_chat_run_step_number(); +--> statement-breakpoint +CREATE TRIGGER no_direct_delete_personal_org BEFORE DELETE ON public.organization FOR EACH ROW EXECUTE FUNCTION forbid_direct_delete_personal_org(); +--> statement-breakpoint +CREATE VIEW chat_run_step_with_status AS SELECT id, + number, + chat_id, + chat_run_id, + agent_id, + agent_deployment_id, + started_at, + heartbeat_at, + completed_at, + interrupted_at, + first_message_id, + last_message_id, + error, + response_status, + response_headers, + response_headers_redacted, + response_body, + response_body_redacted, + response_message_id, + continuation_reason, + time_to_first_token_micros, + tool_calls_total, + tool_calls_completed, + tool_calls_errored, + usage_cost_usd, + usage_model, + usage_total_input_tokens, + usage_total_output_tokens, + usage_total_tokens, + usage_total_cached_input_tokens, + CASE + WHEN (error IS NOT NULL) THEN 'error'::text + WHEN (interrupted_at IS NOT NULL) THEN 'interrupted'::text + WHEN (completed_at IS NOT NULL) THEN 'completed'::text + WHEN (continuation_reason IS NOT NULL) THEN 'streaming'::text + WHEN (heartbeat_at < (now() - '00:01:30'::interval)) THEN 'stalled'::text + ELSE 'streaming'::text + END AS status + FROM chat_run_step; +--> statement-breakpoint +CREATE VIEW chat_run_with_status AS SELECT chat_run.id, + chat_run.number, + chat_run.chat_id, + COALESCE(chat_run_step_with_status.agent_id, chat_run.agent_id) AS agent_id, + COALESCE(chat_run_step_with_status.agent_deployment_id, chat_run.agent_deployment_id) AS agent_deployment_id, + chat_run.created_at, + chat_run.last_step_number, + COALESCE(chat_run_step_with_status.completed_at, chat_run_step_with_status.interrupted_at, chat_run_step_with_status.heartbeat_at, chat_run_step_with_status.started_at, chat_run.created_at) AS updated_at, + chat_run_step_with_status.error, + chat_run_step_with_status.status + FROM (chat_run + LEFT JOIN chat_run_step_with_status ON (((chat_run.id = chat_run_step_with_status.chat_run_id) AND (chat_run_step_with_status.number = chat_run.last_step_number)))); +--> statement-breakpoint +CREATE VIEW chat_with_status AS SELECT chat.id, + chat.created_at, + chat.created_by, + chat.organization_id, + chat.visibility, + chat.title, + chat.metadata, + chat.archived, + chat.agent_id, + COALESCE(chat_run_with_status.agent_deployment_id, chat.agent_deployment_id) AS agent_deployment_id, + chat.agent_deployment_target_id, + chat.agent_key, + chat.last_run_number, + chat.expire_ttl, + COALESCE(chat_run_with_status.updated_at, chat.created_at) AS updated_at, + chat_run_with_status.error, + CASE + WHEN (chat_run_with_status.status IS NULL) THEN 'idle'::text + WHEN (chat_run_with_status.status = ANY (ARRAY['error'::text, 'stalled'::text])) THEN 'error'::text + WHEN (chat_run_with_status.status = 'interrupted'::text) THEN 'interrupted'::text + WHEN (chat_run_with_status.status = ANY (ARRAY['completed'::text, 'idle'::text])) THEN 'idle'::text + ELSE 'streaming'::text + END AS status, + CASE + WHEN (chat.expire_ttl IS NULL) THEN NULL::timestamp without time zone + ELSE (COALESCE(chat_run_with_status.updated_at, chat.created_at) + ((chat.expire_ttl || ' seconds'::text))::interval) + END AS expires_at + FROM (chat + LEFT JOIN chat_run_with_status ON (((chat.id = chat_run_with_status.chat_id) AND (chat_run_with_status.number = chat.last_run_number)))); +--> statement-breakpoint +CREATE VIEW user_with_personal_organization AS SELECT "user".id, + "user".created_at, + "user".updated_at, + "user".display_name, + "user".email, + "user".email_verified, + "user".password, + organization.id AS organization_id, + organization.name AS username, + organization.avatar_url + FROM ("user" + JOIN organization ON (("user".id = organization.personal_owner_user_id))); +--> statement-breakpoint diff --git a/packages/database/migrations/meta/0000_snapshot.json b/packages/database/migrations/meta/0000_snapshot.json new file mode 100644 index 0000000..a66561e --- /dev/null +++ b/packages/database/migrations/meta/0000_snapshot.json @@ -0,0 +1,3257 @@ +{ + "id": "645fa823-648d-48c5-987d-c9d72bb0659e", + "prevId": "401a301f-549d-44f5-9740-e833ff845793", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.agent": { + "name": "agent", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "visibility": { + "name": "visibility", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'organization'" + }, + "name": { + "name": "name", + "type": "varchar(40)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "avatar_file_id": { + "name": "avatar_file_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "active_deployment_id": { + "name": "active_deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "chat_expire_ttl": { + "name": "chat_expire_ttl", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_deployment_number": { + "name": "last_deployment_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_run_number": { + "name": "last_run_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "agent_name_unique": { + "name": "agent_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_organization_id_organization_id_fk": { + "name": "agent_organization_id_organization_id_fk", + "tableFrom": "agent", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "name_format": { + "name": "name_format", + "value": "\"agent\".\"name\" ~* '^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$'" + } + }, + "isRLSEnabled": false + }, + "public.agent_deployment": { + "name": "agent_deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_from": { + "name": "created_from", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "entrypoint": { + "name": "entrypoint", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "compatibility_version": { + "name": "compatibility_version", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'1'" + }, + "source_files": { + "name": "source_files", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "output_files": { + "name": "output_files", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "user_message": { + "name": "user_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "platform": { + "name": "platform", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "platform_memory_mb": { + "name": "platform_memory_mb", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "platform_region": { + "name": "platform_region", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "platform_metadata": { + "name": "platform_metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "direct_access_url": { + "name": "direct_access_url", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "agent_deployment_agent_id_number_unique": { + "name": "agent_deployment_agent_id_number_unique", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_deployment_agent_id_agent_id_fk": { + "name": "agent_deployment_agent_id_agent_id_fk", + "tableFrom": "agent_deployment", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "agent_deployment_target_id_agent_deployment_target_id_fk": { + "name": "agent_deployment_target_id_agent_deployment_target_id_fk", + "tableFrom": "agent_deployment", + "tableTo": "agent_deployment_target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_deployment_log": { + "name": "agent_deployment_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "level": { + "name": "level", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "agent_deployment_log_agent_id_agent_id_fk": { + "name": "agent_deployment_log_agent_id_agent_id_fk", + "tableFrom": "agent_deployment_log", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_deployment_target": { + "name": "agent_deployment_target", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "request_id": { + "name": "request_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target": { + "name": "target", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "agent_deployment_target_agent_id_target_unique": { + "name": "agent_deployment_target_agent_id_target_unique", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_deployment_target_agent_id_agent_id_fk": { + "name": "agent_deployment_target_agent_id_agent_id_fk", + "tableFrom": "agent_deployment_target", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "agent_deployment_target_request_id_unique": { + "name": "agent_deployment_target_request_id_unique", + "nullsNotDistinct": false, + "columns": ["request_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_environment_variable": { + "name": "agent_environment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_value": { + "name": "encrypted_value", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_dek": { + "name": "encrypted_dek", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encryption_iv": { + "name": "encryption_iv", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encryption_auth_tag": { + "name": "encryption_auth_tag", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret": { + "name": "secret", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "target": { + "name": "target", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{\"preview\",\"production\"}'" + } + }, + "indexes": { + "agent_environment_variable_agent_id_idx": { + "name": "agent_environment_variable_agent_id_idx", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_env_key_prod_unique": { + "name": "agent_env_key_prod_unique", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "'production' = ANY(\"agent_environment_variable\".\"target\")", + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_env_key_prev_unique": { + "name": "agent_env_key_prev_unique", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "'preview' = ANY(\"agent_environment_variable\".\"target\")", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_environment_variable_agent_id_agent_id_fk": { + "name": "agent_environment_variable_agent_id_agent_id_fk", + "tableFrom": "agent_environment_variable", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_log": { + "name": "agent_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "level": { + "name": "level", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true, + "default": "'info'" + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "payload_str": { + "name": "payload_str", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "agent_log_agent_time_idx": { + "name": "agent_log_agent_time_idx", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "timestamp", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_log_agent_id_agent_id_fk": { + "name": "agent_log_agent_id_agent_id_fk", + "tableFrom": "agent_log", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_permission": { + "name": "agent_permission", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "permission": { + "name": "permission", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "agent_permission_agent_id_user_id_unique": { + "name": "agent_permission_agent_id_user_id_unique", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_permission_agent_id_index": { + "name": "agent_permission_agent_id_index", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_permission_agent_id_agent_id_fk": { + "name": "agent_permission_agent_id_agent_id_fk", + "tableFrom": "agent_permission", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "agent_permission_user_id_user_id_fk": { + "name": "agent_permission_user_id_user_id_fk", + "tableFrom": "agent_permission", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "agent_permission_created_by_user_id_fk": { + "name": "agent_permission_created_by_user_id_fk", + "tableFrom": "agent_permission", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_pin": { + "name": "agent_pin", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "agent_pin_agent_id_user_id_unique": { + "name": "agent_pin_agent_id_user_id_unique", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_pin_agent_id_agent_id_fk": { + "name": "agent_pin_agent_id_agent_id_fk", + "tableFrom": "agent_pin", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "agent_pin_user_id_user_id_fk": { + "name": "agent_pin_user_id_user_id_fk", + "tableFrom": "agent_pin", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_storage_kv": { + "name": "agent_storage_kv", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_deployment_target_id": { + "name": "agent_deployment_target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "agent_storage_kv_agent_deployment_target_id_key_unique": { + "name": "agent_storage_kv_agent_deployment_target_id_key_unique", + "columns": [ + { + "expression": "agent_deployment_target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_storage_kv_agent_id_agent_id_fk": { + "name": "agent_storage_kv_agent_id_agent_id_fk", + "tableFrom": "agent_storage_kv", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "agent_storage_kv_agent_deployment_target_id_agent_deployment_target_id_fk": { + "name": "agent_storage_kv_agent_deployment_target_id_agent_deployment_target_id_fk", + "tableFrom": "agent_storage_kv", + "tableTo": "agent_deployment_target", + "columnsFrom": ["agent_deployment_target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_trace": { + "name": "agent_trace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "start_time": { + "name": "start_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "payload_original": { + "name": "payload_original", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload_str": { + "name": "payload_str", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "agent_trace_agent_time_idx": { + "name": "agent_trace_agent_time_idx", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "start_time", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_trace_agent_id_agent_id_fk": { + "name": "agent_trace_agent_id_agent_id_fk", + "tableFrom": "agent_trace", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_key": { + "name": "api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_lookup": { + "name": "key_lookup", + "type": "varchar(12)", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "key_suffix": { + "name": "key_suffix", + "type": "varchar(4)", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'full'" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_by": { + "name": "revoked_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "api_key_user_idx": { + "name": "api_key_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_lookup_idx": { + "name": "api_key_lookup_idx", + "columns": [ + { + "expression": "key_lookup", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_key_user_id_user_id_fk": { + "name": "api_key_user_id_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_revoked_by_user_id_fk": { + "name": "api_key_revoked_by_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["revoked_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_key_key_lookup_unique": { + "name": "api_key_key_lookup_unique", + "nullsNotDistinct": false, + "columns": ["key_lookup"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat": { + "name": "chat", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "visibility": { + "name": "visibility", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'private'" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_deployment_id": { + "name": "agent_deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "agent_deployment_target_id": { + "name": "agent_deployment_target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "agent_key": { + "name": "agent_key", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "last_run_number": { + "name": "last_run_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "expire_ttl": { + "name": "expire_ttl", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "chat_organization_created_at_idx": { + "name": "chat_organization_created_at_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_organization_created_by": { + "name": "idx_chat_organization_created_by", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_visibility": { + "name": "idx_chat_visibility", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "visibility", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"chat\".\"visibility\" IN ('public', 'private', 'organization')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_expire_ttl": { + "name": "idx_chat_expire_ttl", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"chat\".\"expire_ttl\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_agent_deployment_target_id_key_unique": { + "name": "idx_chat_agent_deployment_target_id_key_unique", + "columns": [ + { + "expression": "agent_deployment_target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "agent_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "chat_organization_id_organization_id_fk": { + "name": "chat_organization_id_organization_id_fk", + "tableFrom": "chat", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_agent_id_agent_id_fk": { + "name": "chat_agent_id_agent_id_fk", + "tableFrom": "chat", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "chat_agent_deployment_id_agent_deployment_id_fk": { + "name": "chat_agent_deployment_id_agent_deployment_id_fk", + "tableFrom": "chat", + "tableTo": "agent_deployment", + "columnsFrom": ["agent_deployment_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "chat_agent_deployment_target_id_agent_deployment_target_id_fk": { + "name": "chat_agent_deployment_target_id_agent_deployment_target_id_fk", + "tableFrom": "chat", + "tableTo": "agent_deployment_target", + "columnsFrom": ["agent_deployment_target_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat_run": { + "name": "chat_run", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_deployment_id": { + "name": "agent_deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_step_number": { + "name": "last_step_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "chat_run_chat_id_number_unique": { + "name": "chat_run_chat_id_number_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "chat_run_chat_id_chat_id_fk": { + "name": "chat_run_chat_id_chat_id_fk", + "tableFrom": "chat_run", + "tableTo": "chat", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_run_agent_id_agent_id_fk": { + "name": "chat_run_agent_id_agent_id_fk", + "tableFrom": "chat_run", + "tableTo": "agent", + "columnsFrom": ["agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat_run_step": { + "name": "chat_run_step", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "chat_run_id": { + "name": "chat_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_deployment_id": { + "name": "agent_deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "heartbeat_at": { + "name": "heartbeat_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "interrupted_at": { + "name": "interrupted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "first_message_id": { + "name": "first_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "last_message_id": { + "name": "last_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_status": { + "name": "response_status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_headers": { + "name": "response_headers", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "response_headers_redacted": { + "name": "response_headers_redacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "response_body": { + "name": "response_body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_body_redacted": { + "name": "response_body_redacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "response_message_id": { + "name": "response_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "continuation_reason": { + "name": "continuation_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "time_to_first_token_micros": { + "name": "time_to_first_token_micros", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tool_calls_total": { + "name": "tool_calls_total", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "tool_calls_completed": { + "name": "tool_calls_completed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "tool_calls_errored": { + "name": "tool_calls_errored", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "usage_cost_usd": { + "name": "usage_cost_usd", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "usage_model": { + "name": "usage_model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "usage_total_input_tokens": { + "name": "usage_total_input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_total_output_tokens": { + "name": "usage_total_output_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_total_tokens": { + "name": "usage_total_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_total_cached_input_tokens": { + "name": "usage_total_cached_input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "chat_run_step_chat_run_id_id_unique": { + "name": "chat_run_step_chat_run_id_id_unique", + "columns": [ + { + "expression": "chat_run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "chat_run_step_single_streaming": { + "name": "chat_run_step_single_streaming", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"chat_run_step\".\"completed_at\" IS NULL AND \"chat_run_step\".\"error\" IS NULL AND \"chat_run_step\".\"interrupted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "chat_run_step_agent_id_started_at_idx": { + "name": "chat_run_step_agent_id_started_at_idx", + "columns": [ + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "chat_run_step_agent_deployment_id_started_at_idx": { + "name": "chat_run_step_agent_deployment_id_started_at_idx", + "columns": [ + { + "expression": "agent_deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "chat_run_step_chat_id_chat_id_fk": { + "name": "chat_run_step_chat_id_chat_id_fk", + "tableFrom": "chat_run_step", + "tableTo": "chat", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_run_step_chat_run_id_chat_run_id_fk": { + "name": "chat_run_step_chat_run_id_chat_run_id_fk", + "tableFrom": "chat_run_step", + "tableTo": "chat_run", + "columnsFrom": ["chat_run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat_user_state": { + "name": "chat_user_state", + "schema": "", + "columns": { + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "last_read_at": { + "name": "last_read_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "chat_user_state_chat_id_chat_id_fk": { + "name": "chat_user_state_chat_id_chat_id_fk", + "tableFrom": "chat_user_state", + "tableTo": "chat", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_user_state_user_id_user_id_fk": { + "name": "chat_user_state_user_id_user_id_fk", + "tableFrom": "chat_user_state", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "chat_user_state_chat_id_user_id_pk": { + "name": "chat_user_state_chat_id_user_id_pk", + "columns": ["chat_id", "user_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.email_verification": { + "name": "email_verification", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_email_verification_email_code": { + "name": "idx_email_verification_email_code", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.file": { + "name": "file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "message_id": { + "name": "message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "byte_length": { + "name": "byte_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "pdf_page_count": { + "name": "pdf_page_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "bytea", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.message": { + "name": "message", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "chat_run_id": { + "name": "chat_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "chat_run_step_id": { + "name": "chat_run_step_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "parts": { + "name": "parts", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "agent_deployment_id": { + "name": "agent_deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_message_chat_role_created": { + "name": "idx_message_chat_role_created", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "role", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"message\".\"role\" = 'user'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "message_chat_id_chat_id_fk": { + "name": "message_chat_id_chat_id_fk", + "tableFrom": "message", + "tableTo": "chat", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(40)", + "primaryKey": false, + "notNull": true + }, + "avatar_url": { + "name": "avatar_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'organization'" + }, + "personal_owner_user_id": { + "name": "personal_owner_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "billing_tier": { + "name": "billing_tier", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'free'" + }, + "billing_interval": { + "name": "billing_interval", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'month'" + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metronome_customer_id": { + "name": "metronome_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metronome_contract_id": { + "name": "metronome_contract_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "next_billing_date": { + "name": "next_billing_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_entitled_at": { + "name": "billing_entitled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "personal_org_per_user": { + "name": "personal_org_per_user", + "columns": [ + { + "expression": "personal_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"organization\".\"kind\" = 'personal'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_personal_owner_user_id_user_id_fk": { + "name": "organization_personal_owner_user_id_user_id_fk", + "tableFrom": "organization", + "tableTo": "user", + "columnsFrom": ["personal_owner_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_name_unique": { + "name": "organization_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + }, + "policies": {}, + "checkConstraints": { + "name_format": { + "name": "name_format", + "value": "\"organization\".\"name\" ~* '^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$'" + }, + "name_not_reserved": { + "name": "name_not_reserved", + "value": "\"organization\".\"name\" NOT IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41)" + }, + "personal_owner_presence": { + "name": "personal_owner_presence", + "value": "(\"organization\".\"kind\" = 'personal' AND \"organization\".\"personal_owner_user_id\" IS NOT NULL)\n OR (\"organization\".\"kind\" = 'organization' AND \"organization\".\"personal_owner_user_id\" IS NULL)" + }, + "personal_created_by_matches_owner": { + "name": "personal_created_by_matches_owner", + "value": "\"organization\".\"kind\" != 'personal' OR \"organization\".\"created_by\" = \"organization\".\"personal_owner_user_id\"" + } + }, + "isRLSEnabled": false + }, + "public.organization_billing_usage_event": { + "name": "organization_billing_usage_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "transaction_id": { + "name": "transaction_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cost_usd": { + "name": "cost_usd", + "type": "numeric(32, 18)", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "processed_at": { + "name": "processed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "organization_billing_usage_event_org_txn_unique": { + "name": "organization_billing_usage_event_org_txn_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "transaction_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_invite": { + "name": "organization_invite", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "invited_by": { + "name": "invited_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reusable": { + "name": "reusable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "last_accepted_at": { + "name": "last_accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "organization_invite_organization_id_organization_id_fk": { + "name": "organization_invite_organization_id_organization_id_fk", + "tableFrom": "organization_invite", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_invite_invited_by_membership_fk": { + "name": "organization_invite_invited_by_membership_fk", + "tableFrom": "organization_invite", + "tableTo": "organization_membership", + "columnsFrom": ["organization_id", "invited_by"], + "columnsTo": ["organization_id", "user_id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_invite_code_unique": { + "name": "organization_invite_code_unique", + "nullsNotDistinct": false, + "columns": ["code"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_membership": { + "name": "organization_membership", + "schema": "", + "columns": { + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "billing_emails_opt_out": { + "name": "billing_emails_opt_out", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "organization_membership_organization_id_organization_id_fk": { + "name": "organization_membership_organization_id_organization_id_fk", + "tableFrom": "organization_membership", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_membership_user_id_user_id_fk": { + "name": "organization_membership_user_id_user_id_fk", + "tableFrom": "organization_membership", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "organization_membership_organization_id_user_id_pk": { + "name": "organization_membership_organization_id_user_id_pk", + "columns": ["organization_id", "user_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_account": { + "name": "user_account", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_account_id": { + "name": "provider_account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_account_user_id_user_id_fk": { + "name": "user_account_user_id_user_id_fk", + "tableFrom": "user_account", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "user_account_provider_provider_account_id_pk": { + "name": "user_account_provider_provider_account_id_pk", + "columns": ["provider", "provider_account_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.chat_run_step_with_status": { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "chat_run_id": { + "name": "chat_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_deployment_id": { + "name": "agent_deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "heartbeat_at": { + "name": "heartbeat_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "interrupted_at": { + "name": "interrupted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "first_message_id": { + "name": "first_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "last_message_id": { + "name": "last_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_status": { + "name": "response_status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_headers": { + "name": "response_headers", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "response_headers_redacted": { + "name": "response_headers_redacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "response_body": { + "name": "response_body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_body_redacted": { + "name": "response_body_redacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "response_message_id": { + "name": "response_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "continuation_reason": { + "name": "continuation_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "time_to_first_token_micros": { + "name": "time_to_first_token_micros", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tool_calls_total": { + "name": "tool_calls_total", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "tool_calls_completed": { + "name": "tool_calls_completed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "tool_calls_errored": { + "name": "tool_calls_errored", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "usage_cost_usd": { + "name": "usage_cost_usd", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "usage_model": { + "name": "usage_model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "usage_total_input_tokens": { + "name": "usage_total_input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_total_output_tokens": { + "name": "usage_total_output_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_total_tokens": { + "name": "usage_total_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_total_cached_input_tokens": { + "name": "usage_total_cached_input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"id\", \"number\", \"chat_id\", \"chat_run_id\", \"agent_id\", \"agent_deployment_id\", \"started_at\", \"heartbeat_at\", \"completed_at\", \"interrupted_at\", \"first_message_id\", \"last_message_id\", \"error\", \"response_status\", \"response_headers\", \"response_headers_redacted\", \"response_body\", \"response_body_redacted\", \"response_message_id\", \"continuation_reason\", \"time_to_first_token_micros\", \"tool_calls_total\", \"tool_calls_completed\", \"tool_calls_errored\", \"usage_cost_usd\", \"usage_model\", \"usage_total_input_tokens\", \"usage_total_output_tokens\", \"usage_total_tokens\", \"usage_total_cached_input_tokens\", CASE\n WHEN \"error\" IS NOT NULL THEN 'error'\n WHEN \"interrupted_at\" IS NOT NULL THEN 'interrupted'\n WHEN \"completed_at\" IS NOT NULL THEN 'completed'\n WHEN \"continuation_reason\" IS NOT NULL THEN 'streaming'\n WHEN \"heartbeat_at\" < NOW() - INTERVAL '90 seconds' THEN 'stalled'\n ELSE 'streaming'\nEND as \"status\" from \"chat_run_step\"", + "name": "chat_run_step_with_status", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.chat_run_with_status": { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_step_number": { + "name": "last_step_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"chat_run\".\"id\", \"chat_run\".\"number\", \"chat_run\".\"chat_id\", COALESCE(\"chat_run_step_with_status\".\"agent_id\", \"chat_run\".\"agent_id\") as \"agent_id\", COALESCE(\"chat_run_step_with_status\".\"agent_deployment_id\", \"chat_run\".\"agent_deployment_id\") as \"agent_deployment_id\", \"chat_run\".\"created_at\", \"chat_run\".\"last_step_number\", COALESCE(\"chat_run_step_with_status\".\"completed_at\", \"chat_run_step_with_status\".\"interrupted_at\", \"chat_run_step_with_status\".\"heartbeat_at\", \"chat_run_step_with_status\".\"started_at\", \"chat_run\".\"created_at\") as \"updated_at\", \"chat_run_step_with_status\".\"error\", \"status\" from \"chat_run\" left join \"chat_run_step_with_status\" on (\"chat_run\".\"id\" = \"chat_run_step_with_status\".\"chat_run_id\" and \"chat_run_step_with_status\".\"number\" = \"chat_run\".\"last_step_number\")", + "name": "chat_run_with_status", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.chat_with_status": { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "visibility": { + "name": "visibility", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'private'" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "agent_id": { + "name": "agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "agent_deployment_target_id": { + "name": "agent_deployment_target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "agent_key": { + "name": "agent_key", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "last_run_number": { + "name": "last_run_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "expire_ttl": { + "name": "expire_ttl", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"chat\".\"id\", \"chat\".\"created_at\", \"chat\".\"created_by\", \"chat\".\"organization_id\", \"chat\".\"visibility\", \"chat\".\"title\", \"chat\".\"metadata\", \"chat\".\"archived\", \"chat\".\"agent_id\", COALESCE(\"agent_deployment_id\", \"chat\".\"agent_deployment_id\") as \"agent_deployment_id\", \"chat\".\"agent_deployment_target_id\", \"chat\".\"agent_key\", \"chat\".\"last_run_number\", \"chat\".\"expire_ttl\", COALESCE(\"updated_at\", \"chat\".\"created_at\") as \"updated_at\", \"chat_run_with_status\".\"error\", CASE\n WHEN \"status\" IS NULL THEN 'idle'\n WHEN \"status\" IN ('error', 'stalled') THEN 'error'\n WHEN \"status\" = 'interrupted' THEN 'interrupted'\n WHEN \"status\" IN ('completed', 'idle') THEN 'idle'\n ELSE 'streaming'\n END as \"status\", CASE \n WHEN \"chat\".\"expire_ttl\" IS NULL THEN NULL\n ELSE COALESCE(\"updated_at\", \"chat\".\"created_at\") + (\"chat\".\"expire_ttl\" || ' seconds')::interval\n END as \"expires_at\" from \"chat\" left join \"chat_run_with_status\" on (\"chat\".\"id\" = \"chat_run_with_status\".\"chat_id\" and \"chat_run_with_status\".\"number\" = \"chat\".\"last_run_number\")", + "name": "chat_with_status", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_with_personal_organization": { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"user\".\"id\", \"user\".\"created_at\", \"user\".\"updated_at\", \"user\".\"display_name\", \"user\".\"email\", \"user\".\"email_verified\", \"user\".\"password\", \"organization\".\"id\" as \"organization_id\", \"organization\".\"name\" as \"username\", \"organization\".\"avatar_url\" as \"avatar_url\" from \"user\" inner join \"organization\" on \"user\".\"id\" = \"organization\".\"personal_owner_user_id\"", + "name": "user_with_personal_organization", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.json new file mode 100644 index 0000000..6e98bbf --- /dev/null +++ b/packages/database/migrations/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "7", + "dialect": "postgresql", + "entries": [ + { + "idx": 0, + "version": "7", + "when": 1763742838403, + "tag": "0000_initial", + "breakpoints": true + } + ] +} diff --git a/packages/database/package.json b/packages/database/package.json new file mode 100644 index 0000000..b23b58a --- /dev/null +++ b/packages/database/package.json @@ -0,0 +1,28 @@ +{ + "name": "@blink.so/database", + "private": true, + "type": "module", + "exports": { + "./schema": "./src/schema.ts", + "./postgres": "./src/postgres.ts", + "./querier": "./src/querier.ts", + "./knock-service": "./src/knock-service.ts", + "./test": "./src/test.ts", + "./shared": "./src/shared.ts", + "./convert": "./src/convert.ts" + }, + "scripts": { + "generate": "drizzle-kit generate", + "migrate": "drizzle-kit migrate", + "typecheck": "tsgo --noEmit" + }, + "devDependencies": { + "@electric-sql/pglite": "0.3.2", + "dotenv": "^17.2.3", + "drizzle-kit": "^0.31.5", + "drizzle-orm": "^0.44.5", + "pg": "^8.16.0", + "pg-gateway": "^0.3.0-beta.4", + "postgres": "^3.4.7" + } +} diff --git a/packages/database/reset.sh b/packages/database/reset.sh new file mode 100755 index 0000000..5b71d20 --- /dev/null +++ b/packages/database/reset.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +git checkout main -- ./migrations +git clean -fd ./migrations +bun generate \ No newline at end of file diff --git a/packages/database/scripts/dump_full_schema.ts b/packages/database/scripts/dump_full_schema.ts new file mode 100644 index 0000000..01adb89 --- /dev/null +++ b/packages/database/scripts/dump_full_schema.ts @@ -0,0 +1,278 @@ +// Script to dump the full database schema after applying all migrations +// Used to generate the squashed 0000_initial.sql migration +import { PGlite } from "@electric-sql/pglite"; +import { sql } from "drizzle-orm"; +import { drizzle } from "drizzle-orm/pglite"; +import { readFile } from "fs/promises"; +import { join } from "node:path"; + +interface JournalEntry { + idx: number; + version: string; + when: number; + tag: string; + breakpoints: boolean; +} + +interface Journal { + version: string; + dialect: string; + entries: JournalEntry[]; +} + +interface Constraint { + table: string; + name: string; + def: string; + type: string; +} + +async function main() { + console.error("Creating fresh PGLite database..."); + const client = new PGlite(); + const db = drizzle(client); + + console.error("Applying all migrations manually..."); + const migrationsFolder = join(import.meta.dir, "../migrations"); + + // Read migrations journal + const journalPath = join(migrationsFolder, "meta/_journal.json"); + const journalContent = await readFile(journalPath, "utf-8"); + const journal: Journal = JSON.parse(journalContent); + + // Apply migrations in order + for (const entry of journal.entries) { + const migrationPath = join(migrationsFolder, `${entry.tag}.sql`); + console.error(`Applying ${entry.tag}...`); + + let migrationSQL = await readFile(migrationPath, "utf-8"); + + // Skip extensions that PGLite doesn't support + migrationSQL = migrationSQL.replace( + /CREATE EXTENSION IF NOT EXISTS "vector";.*?--> statement-breakpoint\s*/g, + "" + ); + migrationSQL = migrationSQL.replace( + /CREATE EXTENSION IF NOT EXISTS "uuid-ossp";.*?--> statement-breakpoint\s*/g, + "" + ); + + // Split by statement-breakpoint and execute + const statements = migrationSQL + .split("--> statement-breakpoint") + .map((s) => s.trim()) + .filter((s) => s); + + for (const statement of statements) { + if (statement) { + try { + await db.execute(sql.raw(statement)); + } catch (e) { + // Continue anyway for non-critical errors (like vector extension stuff) + } + } + } + } + + console.error("Dumping schema..."); + + // Get all tables + const tables = await client.query(` + SELECT tablename + FROM pg_tables + WHERE schemaname = 'public' + AND tablename != '__drizzle_migrations' + ORDER BY tablename + `); + + // First, output all CREATE TABLE statements + const tableStatements: string[] = []; + const constraintStatements: Constraint[] = []; + const indexStatements: string[] = []; + + for (const row of tables.rows as Array<{ tablename: string }>) { + const tableName = row.tablename; + + // Get CREATE TABLE statement - use quote_ident to properly quote table name + const result = await client.query( + ` + SELECT + 'CREATE TABLE ' || quote_ident(c.relname) || ' (' || + string_agg( + quote_ident(a.attname) || ' ' || + pg_catalog.format_type(a.atttypid, a.atttypmod) || + CASE WHEN a.attnotnull THEN ' NOT NULL' ELSE '' END || + CASE WHEN d.adbin IS NOT NULL THEN ' DEFAULT ' || pg_get_expr(d.adbin, d.adrelid) ELSE '' END, + ', ' ORDER BY a.attnum + ) || + ');' as create_statement + FROM pg_class c + JOIN pg_namespace n ON n.oid = c.relnamespace + JOIN pg_attribute a ON a.attrelid = c.oid + LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = a.attnum + WHERE c.relname = $1 + AND n.nspname = 'public' + AND a.attnum > 0 + AND NOT a.attisdropped + GROUP BY c.relname + `, + [tableName] + ); + + if ( + result.rows[0] && + typeof result.rows[0] === "object" && + "create_statement" in result.rows[0] + ) { + tableStatements.push(result.rows[0].create_statement as string); + } + + // Get constraints + const constraints = await client.query( + ` + SELECT pg_get_constraintdef(oid) as definition, conname, contype + FROM pg_constraint + WHERE conrelid = $1::regclass + ORDER BY contype, conname + `, + [`public.${tableName}`] + ); + + for (const constraint of constraints.rows) { + if ( + typeof constraint === "object" && + constraint && + "conname" in constraint && + "definition" in constraint && + "contype" in constraint + ) { + constraintStatements.push({ + table: tableName, + name: constraint.conname as string, + def: constraint.definition as string, + type: constraint.contype as string, + }); + } + } + + // Get indexes (excluding those created by constraints) + const indexes = await client.query( + ` + SELECT + pg_get_indexdef(indexrelid) as definition + FROM pg_index + JOIN pg_class ON pg_index.indexrelid = pg_class.oid + WHERE indrelid = $1::regclass + AND NOT indisprimary + AND NOT EXISTS ( + SELECT 1 FROM pg_constraint + WHERE conindid = indexrelid + ) + ORDER BY pg_class.relname + `, + [`public.${tableName}`] + ); + + for (const idx of indexes.rows) { + if (typeof idx === "object" && idx && "definition" in idx) { + indexStatements.push(idx.definition as string); + } + } + } + + // Output tables first + for (const stmt of tableStatements) { + console.log(stmt); + console.log("--> statement-breakpoint"); + } + + // Then output constraints, ordering by type: c (check), u (unique), p (primary key), f (foreign key) + const sortOrder: Record = { c: 1, u: 2, p: 3, f: 4 }; + constraintStatements.sort( + (a, b) => (sortOrder[a.type] || 99) - (sortOrder[b.type] || 99) + ); + + for (const constraint of constraintStatements) { + // Quote table name if it's a reserved keyword + const quotedTable = + constraint.table === "user" ? `"${constraint.table}"` : constraint.table; + console.log( + `ALTER TABLE ${quotedTable} ADD CONSTRAINT ${constraint.name} ${constraint.def};` + ); + console.log("--> statement-breakpoint"); + } + + // Then indexes + for (const idx of indexStatements) { + console.log(idx + ";"); + console.log("--> statement-breakpoint"); + } + + // Get all functions + const functions = await client.query(` + SELECT + p.proname as name, + pg_get_functiondef(p.oid) as definition + FROM pg_proc p + JOIN pg_namespace n ON p.pronamespace = n.oid + WHERE n.nspname = 'public' + ORDER BY p.proname + `); + + for (const func of functions.rows) { + if (typeof func === "object" && func && "definition" in func) { + console.log((func.definition as string) + ";"); + console.log("--> statement-breakpoint"); + } + } + + // Get all triggers + const triggers = await client.query(` + SELECT + t.tgname as trigger_name, + c.relname as table_name, + pg_get_triggerdef(t.oid) as definition + FROM pg_trigger t + JOIN pg_class c ON t.tgrelid = c.oid + JOIN pg_namespace n ON c.relnamespace = n.oid + WHERE n.nspname = 'public' + AND NOT t.tgisinternal + ORDER BY c.relname, t.tgname + `); + + for (const trigger of triggers.rows) { + if (typeof trigger === "object" && trigger && "definition" in trigger) { + console.log((trigger.definition as string) + ";"); + console.log("--> statement-breakpoint"); + } + } + + // Get all views + const views = await client.query(` + SELECT + viewname, + definition + FROM pg_views + WHERE schemaname = 'public' + ORDER BY viewname + `); + + for (const view of views.rows) { + if ( + typeof view === "object" && + view && + "viewname" in view && + "definition" in view + ) { + console.log( + `CREATE VIEW ${view.viewname as string} AS ${view.definition as string}` + ); + console.log("--> statement-breakpoint"); + } + } + + await client.close(); + console.error("\nDone!"); +} + +main().catch(console.error); diff --git a/packages/database/src/agent-permissions.test.ts b/packages/database/src/agent-permissions.test.ts new file mode 100644 index 0000000..7b63c6d --- /dev/null +++ b/packages/database/src/agent-permissions.test.ts @@ -0,0 +1,547 @@ +import { describe, expect, test } from "bun:test"; +import connectToPostgres from "./postgres"; +import Querier from "./querier"; +import { + createPostgresURL, + createTestAgent, + createTestOrganization, + createTestUser, +} from "./test"; + +describe("Agent Permissions", () => { + test("creator gets admin permission on agent creation", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user.id }); + + const agent = await querier.tx(async (tx) => { + const agent = await tx.insertAgent({ + name: "test-agent", + description: "Test agent", + organization_id: org.id, + created_by: user.id, + visibility: "private", + }); + + // Grant admin permission to creator + await tx.upsertAgentPermission({ + agent_id: agent.id, + user_id: user.id, + permission: "admin", + created_by: user.id, + }); + + return agent; + }); + + // Verify the permission was created + const permission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: user.id, + }); + + expect(permission).toBe("admin"); + }); + + test("upsert updates existing permission", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: user.id, + }); + + // Grant read permission + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user.id, + permission: "read", + created_by: user.id, + }); + + let permission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: user.id, + }); + expect(permission).toBe("read"); + + // Update to write permission + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user.id, + permission: "write", + created_by: user.id, + }); + + permission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: user.id, + }); + expect(permission).toBe("write"); + }); + + test("org-level default permission applies to all members", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user1 = await createTestUser(querier); + const user2 = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user1.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: user1.id, + }); + + // Add user2 to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: user2.id, + role: "member", + }); + + // Set org-level default permission (null user_id) + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: undefined, + permission: "read", + created_by: user1.id, + }); + + // User2 should get the org-level permission + const permission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: user2.id, + orgRole: "member", + }); + + expect(permission).toBe("read"); + }); + + test("user-specific permission overrides org default", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user1 = await createTestUser(querier); + const user2 = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user1.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: user1.id, + }); + + // Add user2 to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: user2.id, + role: "member", + }); + + // Set org-level default to read + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: undefined, + permission: "read", + created_by: user1.id, + }); + + // Give user2 admin permission explicitly + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user2.id, + permission: "admin", + created_by: user1.id, + }); + + const permission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: user2.id, + orgRole: "member", + }); + + expect(permission).toBe("admin"); + }); + + test("org owners and admins get admin by default for organization visibility", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const admin = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "organization", + }); + + // Add admin user + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: admin.id, + role: "admin", + }); + + // Owner should get admin (since they're the org owner) + const ownerPermission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: owner.id, + orgRole: "owner", + agentVisibility: "organization", + }); + expect(ownerPermission).toBe("admin"); + + // Admin should get admin + const adminPermission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: admin.id, + orgRole: "admin", + agentVisibility: "organization", + }); + expect(adminPermission).toBe("admin"); + }); + + test("selectAgentPermissions lists all permissions", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user1 = await createTestUser(querier); + const user2 = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user1.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: user1.id, + }); + + // Add permissions + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user1.id, + permission: "admin", + created_by: user1.id, + }); + + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user2.id, + permission: "read", + created_by: user1.id, + }); + + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: undefined, + permission: "write", + created_by: user1.id, + }); + + const result = await querier.selectAgentPermissions({ + agentId: agent.id, + }); + + expect(result.items.length).toBe(3); + expect( + result.items.some( + (p) => p.user_id === user1.id && p.permission === "admin" + ) + ).toBe(true); + expect( + result.items.some( + (p) => p.user_id === user2.id && p.permission === "read" + ) + ).toBe(true); + expect( + result.items.some((p) => p.user_id === null && p.permission === "write") + ).toBe(true); + }); + + test("deleteAgentPermission removes permission", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: user.id, + }); + + // Add permission + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user.id, + permission: "admin", + created_by: user.id, + }); + + // Verify it exists + let permissions = await querier.selectAgentPermissions({ + agentId: agent.id, + }); + expect(permissions.items.length).toBe(1); + + // Delete it + await querier.deleteAgentPermission({ + agent_id: agent.id, + user_id: user.id, + }); + + // Verify it's gone + permissions = await querier.selectAgentPermissions({ + agentId: agent.id, + }); + expect(permissions.items.length).toBe(0); + }); + + test("agent deletion cascades to permissions", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: user.id, + }); + + // Add permission + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: user.id, + permission: "admin", + created_by: user.id, + }); + + // Delete agent + await querier.deleteAgent({ id: agent.id }); + + // Permissions should be cascade deleted + const permissions = await querier.selectAgentPermissions({ + agentId: agent.id, + }); + expect(permissions.items.length).toBe(0); + }); + + test("organization visibility: all org members can access", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const member = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "organization", + }); + + // Add member to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: member.id, + role: "member", + }); + + // Member should get read permission by default for organization visibility + const memberPermission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: member.id, + orgRole: "member", + agentVisibility: "organization", + }); + expect(memberPermission).toBe("read"); + }); + + test("private visibility: only org admins/owners can access by default", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const member = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "private", + }); + + // Add member to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: member.id, + role: "member", + }); + + // Owner should still have admin access + const ownerPermission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: owner.id, + orgRole: "owner", + agentVisibility: "private", + }); + expect(ownerPermission).toBe("admin"); + + // Member should NOT have access + const memberPermission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: member.id, + orgRole: "member", + agentVisibility: "private", + }); + expect(memberPermission).toBeUndefined(); + }); + + test("private visibility: explicit permission grants access", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const member = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + const agent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "private", + }); + + // Add member to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: member.id, + role: "member", + }); + + // Grant explicit read permission to member + await querier.upsertAgentPermission({ + agent_id: agent.id, + user_id: member.id, + permission: "read", + created_by: owner.id, + }); + + // Now member should have read access + const memberPermission = await querier.getAgentPermissionForUser({ + agentId: agent.id, + userId: member.id, + orgRole: "member", + agentVisibility: "private", + }); + expect(memberPermission).toBe("read"); + }); + + test("selectAgentsForUser respects organization visibility", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const member = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + + // Create organization-visible agent + const orgAgent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "organization", + name: "org-agent", + }); + + // Add member to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: member.id, + role: "member", + }); + + // Member should see the organization-visible agent + const agents = await querier.selectAgentsForUser({ + userID: member.id, + organizationID: org.id, + }); + + expect(agents.items.length).toBe(1); + expect(agents.items[0]!.id).toBe(orgAgent.id); + }); + + test("selectAgentsForUser excludes private agents from regular members", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const member = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + + // Create private agent + const privateAgent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "private", + name: "private-agent", + }); + + // Add member to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: member.id, + role: "member", + }); + + // Member should NOT see the private agent + const memberAgents = await querier.selectAgentsForUser({ + userID: member.id, + organizationID: org.id, + }); + expect(memberAgents.items.length).toBe(0); + + // Owner should see the private agent + const ownerAgents = await querier.selectAgentsForUser({ + userID: owner.id, + organizationID: org.id, + }); + expect(ownerAgents.items.length).toBe(1); + expect(ownerAgents.items[0]!.id).toBe(privateAgent.id); + }); + + test("selectAgentsForUser shows private agents to members with explicit permission", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const owner = await createTestUser(querier); + const member = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: owner.id }); + + // Create private agent + const privateAgent = await createTestAgent(querier, { + organization_id: org.id, + created_by: owner.id, + visibility: "private", + name: "private-agent", + }); + + // Add member to org + await querier.insertOrganizationMembership({ + organization_id: org.id, + user_id: member.id, + role: "member", + }); + + // Grant explicit permission to member + await querier.upsertAgentPermission({ + agent_id: privateAgent.id, + user_id: member.id, + permission: "read", + created_by: owner.id, + }); + + // Now member should see the private agent + const agents = await querier.selectAgentsForUser({ + userID: member.id, + organizationID: org.id, + }); + expect(agents.items.length).toBe(1); + expect(agents.items[0]!.id).toBe(privateAgent.id); + }); +}); diff --git a/packages/database/src/convert.ts b/packages/database/src/convert.ts new file mode 100644 index 0000000..c000546 --- /dev/null +++ b/packages/database/src/convert.ts @@ -0,0 +1,150 @@ +import type { + Agent, + AgentDeployment, + AgentDeploymentTarget, + Chat, + ChatMessage, + ChatMessageFormat, + Organization, + User, +} from "@blink.so/api"; +import type { + AgentWithPinned, + ChatWithStatusAndAgent, + Agent as DBAgent, + AgentDeployment as DBAgentDeployment, + DBMessage, + OrganizationWithMembership as DBOrganizationWithMembership, + UserWithPersonalOrganization, +} from "./schema"; +import { computeExpiresAt } from "./shared"; + +export const organization = ( + baseURL: URL, + org: DBOrganizationWithMembership +): Organization => { + return { + id: org.id, + created_at: org.created_at, + updated_at: org.updated_at, + name: org.name, + avatar_url: org.avatar_url, + membership: org.membership + ? { + organization_id: org.membership.organization_id, + user_id: org.membership.user_id, + role: org.membership.role, + created_at: org.membership.created_at, + updated_at: org.membership.updated_at, + } + : null, + members_url: new URL( + `/api/organizations/${org.id}/members`, + baseURL + ).toString(), + invites_url: new URL( + `/api/invites?organization_id=${org.id}`, + baseURL + ).toString(), + }; +}; + +export const agent = ( + agent: AgentWithPinned | DBAgent, + requestURL?: URL, + userPermission?: "read" | "write" | "admin" +): Agent => { + return { + id: agent.id, + name: agent.name, + description: agent.description, + visibility: agent.visibility, + organization_id: agent.organization_id, + created_at: agent.created_at.toISOString(), + updated_at: agent.updated_at.toISOString(), + created_by: agent.created_by, + avatar_url: agent.avatar_file_id + ? `/api/files/${agent.avatar_file_id}` + : null, + active_deployment_id: agent.active_deployment_id, + request_url: requestURL?.toString() ?? null, + pinned: "pinned" in agent ? agent.pinned : false, + chat_expire_ttl: agent.chat_expire_ttl, + user_permission: userPermission, + }; +}; + +export const user = (user: UserWithPersonalOrganization): User => { + return { + id: user.id, + created_at: user.created_at, + updated_at: user.updated_at, + email: user.email!, + email_verified: user.email_verified !== null, + display_name: user.display_name!, + username: user.username, + avatar_url: user.avatar_url, + organization_id: user.organization_id, + }; +}; + +export const agentDeployment = ( + deployment: DBAgentDeployment & { target: string } +): AgentDeployment => { + return { + agent_id: deployment.agent_id, + id: deployment.id, + number: deployment.number, + created_at: deployment.created_at.toISOString(), + updated_at: deployment.updated_at.toISOString(), + created_by: deployment.created_by ?? null, + created_from: deployment.created_from, + source_files: deployment.source_files || [], + output_files: deployment.output_files || [], + status: deployment.status, + target: deployment.target as AgentDeploymentTarget, + error_message: deployment.error_message, + user_message: deployment.user_message, + platform: deployment.platform as "lambda", + platform_memory_mb: deployment.platform_memory_mb, + platform_region: deployment.platform_region, + }; +}; + +export const message = ( + format: ChatMessageFormat, + message: DBMessage +): ChatMessage => { + return { + id: message.id, + created_at: message.created_at.toISOString(), + chat_id: message.chat_id, + metadata: message.metadata, + format: format, + parts: message.parts, + role: message.role, + }; +}; + +export const chat = (chat: ChatWithStatusAndAgent): Chat => { + return { + id: chat.id, + archived: chat.archived, + created_at: chat.created_at.toISOString(), + updated_at: chat.updated_at.toISOString(), + created_by: chat.created_by!, + organization_id: chat.organization_id, + title: chat.title, + agent: agent(chat.agent), + agent_deployment_id: chat.agent_deployment_id, + visibility: chat.visibility, + metadata: chat.metadata, + status: chat.status, + error: chat.error, + expire_ttl: chat.expire_ttl, + expires_at: chat.expire_ttl + ? (computeExpiresAt(chat.expire_ttl, chat.created_at)?.toISOString() ?? + null) + : null, + }; +}; diff --git a/packages/database/src/encryption.test.ts b/packages/database/src/encryption.test.ts new file mode 100644 index 0000000..f452e9b --- /dev/null +++ b/packages/database/src/encryption.test.ts @@ -0,0 +1,182 @@ +import { afterAll, beforeAll, describe, expect, test } from "bun:test"; +import { + decryptValue, + encryptValue, + getMasterKey, + isEncryptionEnabled, +} from "./encryption"; + +const TEST_MASTER_KEY = "test-master-key-for-encryption-should-be-secure"; + +describe("encryption", () => { + let originalKey: string | undefined; + + beforeAll(() => { + originalKey = process.env.ENCRYPTION_MASTER_KEY; + process.env.ENCRYPTION_MASTER_KEY = TEST_MASTER_KEY; + }); + + afterAll(() => { + if (originalKey === undefined) { + delete process.env.ENCRYPTION_MASTER_KEY; + } else { + process.env.ENCRYPTION_MASTER_KEY = originalKey; + } + }); + + test("isEncryptionEnabled returns true when key is set", () => { + expect(isEncryptionEnabled()).toBe(true); + }); + + test("getMasterKey returns configured key", () => { + expect(getMasterKey()).toBe(TEST_MASTER_KEY); + }); + + test("getMasterKey returns null when not configured", () => { + const key = process.env.ENCRYPTION_MASTER_KEY; + delete process.env.ENCRYPTION_MASTER_KEY; + + expect(getMasterKey()).toBeNull(); + + process.env.ENCRYPTION_MASTER_KEY = key; + }); + + test("encrypts and decrypts a simple string", async () => { + const plaintext = "hello world"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + + expect(encrypted.encryptedValue).toBeInstanceOf(Buffer); + expect(encrypted.encryptedDEK).toBeInstanceOf(Buffer); + expect(encrypted.encryption_iv).toBeInstanceOf(Buffer); + expect(encrypted.encryption_auth_tag).toBeInstanceOf(Buffer); + + const decrypted = await decryptValue(encrypted, TEST_MASTER_KEY); + expect(decrypted).toBe(plaintext); + }); + + test("encrypts and decrypts empty string", async () => { + const plaintext = ""; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + const decrypted = await decryptValue(encrypted, TEST_MASTER_KEY); + expect(decrypted).toBe(plaintext); + }); + + test("encrypts and decrypts long string", async () => { + const plaintext = "a".repeat(10000); + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + const decrypted = await decryptValue(encrypted, TEST_MASTER_KEY); + expect(decrypted).toBe(plaintext); + }); + + test("encrypts and decrypts special characters", async () => { + const plaintext = "Hello! 🎉 Special chars: @#$%^&*()[]{}|\\:;\"'<>,.?/~`"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + const decrypted = await decryptValue(encrypted, TEST_MASTER_KEY); + expect(decrypted).toBe(plaintext); + }); + + test("encrypts and decrypts multiline string", async () => { + const plaintext = `Line 1 +Line 2 +Line 3 +With tabs\tand\nnewlines`; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + const decrypted = await decryptValue(encrypted, TEST_MASTER_KEY); + expect(decrypted).toBe(plaintext); + }); + + test("produces different encrypted values for same input", async () => { + const plaintext = "test value"; + const encrypted1 = await encryptValue(plaintext, TEST_MASTER_KEY); + const encrypted2 = await encryptValue(plaintext, TEST_MASTER_KEY); + + // IVs should be different + expect(encrypted1.encryption_iv.equals(encrypted2.encryption_iv)).toBe( + false + ); + // Encrypted values should be different + expect(encrypted1.encryptedValue.equals(encrypted2.encryptedValue)).toBe( + false + ); + // But both should decrypt to the same plaintext + const decrypted1 = await decryptValue(encrypted1, TEST_MASTER_KEY); + const decrypted2 = await decryptValue(encrypted2, TEST_MASTER_KEY); + expect(decrypted1).toBe(plaintext); + expect(decrypted2).toBe(plaintext); + }); + + test("fails to decrypt with wrong key", async () => { + const plaintext = "secret value"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + + await expect(decryptValue(encrypted, "wrong-master-key")).rejects.toThrow(); + }); + + test("fails to decrypt with tampered encrypted value", async () => { + const plaintext = "secret value"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + + // Tamper with the encrypted value + const tampered = { + ...encrypted, + encryptedValue: Buffer.from( + [...encrypted.encryptedValue].map((b) => b ^ 1) + ), + }; + + await expect(decryptValue(tampered, TEST_MASTER_KEY)).rejects.toThrow(); + }); + + test("fails to decrypt with tampered DEK", async () => { + const plaintext = "secret value"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + + // Tamper with the encrypted DEK + const tampered = { + ...encrypted, + encryptedDEK: Buffer.from([...encrypted.encryptedDEK].map((b) => b ^ 1)), + }; + + await expect(decryptValue(tampered, TEST_MASTER_KEY)).rejects.toThrow(); + }); + + test("fails to decrypt with tampered auth tag", async () => { + const plaintext = "secret value"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + + // Tamper with the auth tag + const tampered = { + ...encrypted, + encryption_auth_tag: Buffer.from( + [...encrypted.encryption_auth_tag].map((b) => b ^ 1) + ), + }; + + await expect(decryptValue(tampered, TEST_MASTER_KEY)).rejects.toThrow(); + }); + + test("encrypted data has expected sizes", async () => { + const plaintext = "test"; + const encrypted = await encryptValue(plaintext, TEST_MASTER_KEY); + + // IV should be 12 bytes (96 bits) + expect(encrypted.encryption_iv.length).toBe(12); + // Auth tag should be 16 bytes (128 bits) + expect(encrypted.encryption_auth_tag.length).toBe(16); + // Encrypted DEK should be salt(16) + IV(12) + authTag(16) + encryptedDEK(32) = 76 bytes + expect(encrypted.encryptedDEK.length).toBe(76); + // Encrypted value length should be close to plaintext length + expect(encrypted.encryptedValue.length).toBeGreaterThanOrEqual( + plaintext.length + ); + }); + + test("envelope encryption - DEK is different for each encryption", async () => { + const plaintext = "test value"; + const encrypted1 = await encryptValue(plaintext, TEST_MASTER_KEY); + const encrypted2 = await encryptValue(plaintext, TEST_MASTER_KEY); + + // Encrypted DEKs should be different (different salts/IVs) + expect(encrypted1.encryptedDEK.equals(encrypted2.encryptedDEK)).toBe(false); + }); +}); diff --git a/packages/database/src/encryption.ts b/packages/database/src/encryption.ts new file mode 100644 index 0000000..1b20946 --- /dev/null +++ b/packages/database/src/encryption.ts @@ -0,0 +1,161 @@ +import { createCipheriv, createDecipheriv, randomBytes, scrypt } from "crypto"; +import { promisify } from "util"; + +const scryptAsync = promisify(scrypt); + +// Constants for AES-256-GCM +const ALGORITHM = "aes-256-gcm"; +const KEY_LENGTH = 32; // 256 bits +const IV_LENGTH = 12; // 96 bits (recommended for GCM) +const AUTH_TAG_LENGTH = 16; // 128 bits +const SALT_LENGTH = 16; // 128 bits + +export interface EncryptedData { + encryptedValue: Buffer; + encryptedDEK: Buffer; + encryption_iv: Buffer; + encryption_auth_tag: Buffer; +} + +/** + * Derives a Key Encryption Key (KEK) from the master key using scrypt. + */ +async function deriveKEK(masterKey: string, salt: Buffer): Promise { + return (await scryptAsync(masterKey, salt, KEY_LENGTH)) as Buffer; +} + +/** + * Encrypts a plaintext value using envelope encryption. + * + * Process: + * 1. Generate a random Data Encryption Key (DEK) + * 2. Use DEK to encrypt the plaintext value with AES-256-GCM + * 3. Derive KEK from master key using scrypt with a random salt + * 4. Encrypt the DEK with the KEK + * 5. Return encrypted value, encrypted DEK, IV, and auth tag + * + * @param plaintext - The value to encrypt + * @param masterKey - The master key from environment + * @returns Encrypted data components + */ +export async function encryptValue( + plaintext: string, + masterKey: string +): Promise { + // Generate random DEK + const dek = randomBytes(KEY_LENGTH); + + // Generate random IV for value encryption + const encryption_iv = randomBytes(IV_LENGTH); + + // Encrypt the plaintext value with DEK + const cipher = createCipheriv(ALGORITHM, dek, encryption_iv); + const encryptedValue = Buffer.concat([ + cipher.update(plaintext, "utf8"), + cipher.final(), + ]); + const encryption_auth_tag = cipher.getAuthTag(); + + // Generate salt for KEK derivation + const salt = randomBytes(SALT_LENGTH); + + // Derive KEK from master key + const kek = await deriveKEK(masterKey, salt); + + // Encrypt the DEK with KEK + const dekIV = randomBytes(IV_LENGTH); + const dekCipher = createCipheriv(ALGORITHM, kek, dekIV); + const encryptedDEKData = Buffer.concat([ + dekCipher.update(dek), + dekCipher.final(), + ]); + const dekAuthTag = dekCipher.getAuthTag(); + + // Combine salt, IV, auth tag, and encrypted DEK into one buffer + // Format: [salt(16)][iv(12)][authTag(16)][encryptedDEK(32)] + const encryptedDEK = Buffer.concat([ + salt, + dekIV, + dekAuthTag, + encryptedDEKData, + ]); + + return { + encryptedValue, + encryptedDEK, + encryption_iv, + encryption_auth_tag, + }; +} + +/** + * Decrypts an encrypted value using envelope encryption. + * + * Process: + * 1. Extract salt, IV, auth tag, and encrypted DEK from the encryptedDEK buffer + * 2. Derive KEK from master key using the extracted salt + * 3. Decrypt the DEK using the KEK + * 4. Use the DEK to decrypt the value + * + * @param encrypted - The encrypted data components + * @param masterKey - The master key from environment + * @returns The decrypted plaintext value + * @throws Error if decryption fails (wrong key, tampered data, etc.) + */ +export async function decryptValue( + encrypted: EncryptedData, + masterKey: string +): Promise { + // Extract components from encryptedDEK buffer + // Format: [salt(16)][iv(12)][authTag(16)][encryptedDEK(32)] + const salt = encrypted.encryptedDEK.subarray(0, SALT_LENGTH); + const dekIV = encrypted.encryptedDEK.subarray( + SALT_LENGTH, + SALT_LENGTH + IV_LENGTH + ); + const dekAuthTag = encrypted.encryptedDEK.subarray( + SALT_LENGTH + IV_LENGTH, + SALT_LENGTH + IV_LENGTH + AUTH_TAG_LENGTH + ); + const encryptedDEKData = encrypted.encryptedDEK.subarray( + SALT_LENGTH + IV_LENGTH + AUTH_TAG_LENGTH + ); + + // Derive KEK from master key + const kek = await deriveKEK(masterKey, salt); + + // Decrypt the DEK + const dekDecipher = createDecipheriv(ALGORITHM, kek, dekIV); + dekDecipher.setAuthTag(dekAuthTag); + const dek = Buffer.concat([ + dekDecipher.update(encryptedDEKData), + dekDecipher.final(), + ]); + + // Decrypt the value with the DEK + const decipher = createDecipheriv(ALGORITHM, dek, encrypted.encryption_iv); + decipher.setAuthTag(encrypted.encryption_auth_tag); + const plaintext = Buffer.concat([ + decipher.update(encrypted.encryptedValue), + decipher.final(), + ]); + + return plaintext.toString("utf8"); +} + +/** + * Gets the master encryption key from the environment. + * In production, this should be stored in Cloudflare Worker secrets. + * + * @returns The master key, or null if not configured (allowing graceful degradation) + */ +export function getMasterKey(): string | null { + return process.env.ENCRYPTION_MASTER_KEY ?? null; +} + +/** + * Checks if encryption is enabled (master key is configured). + */ +export function isEncryptionEnabled(): boolean { + return !!process.env.ENCRYPTION_MASTER_KEY; +} diff --git a/packages/database/src/knock-service.ts b/packages/database/src/knock-service.ts new file mode 100644 index 0000000..c343362 --- /dev/null +++ b/packages/database/src/knock-service.ts @@ -0,0 +1,583 @@ +/** + * Simple Knock.app API integration + * Handles user identification and notification setup + */ + +export interface KnockUser { + id: string; + email?: string | null; + name?: string | null; + properties?: Record; +} + +export interface KnockTenant { + id: string; + name?: string; + properties?: Record; +} + +export class KnockService { + private readonly apiKey: string; + private readonly baseUrl: string; + + constructor(apiKey: string, baseUrl?: string) { + this.apiKey = apiKey; + this.baseUrl = baseUrl || "https://api.knock.app"; + } + + /** + * Identify a user in Knock + * + * Note: We intentionally do NOT include team_id/team_name in user properties + * since users can belong to multiple teams. Team relationships are managed via: + * 1. Tenant scoping when triggering workflows + * 2. Database team_membership table for authoritative team relationships + * 3. Knock tenants for notification scoping (not user properties) + */ + async identifyUser(user: KnockUser): Promise { + if (!user.id) { + throw new Error("User ID is required for Knock identification"); + } + + if (!this.apiKey) { + return; + } + + const payload = { + id: user.id, + ...(user.email && { email: user.email }), + ...(user.name && { name: user.name }), + ...(user.properties && { properties: user.properties }), + }; + + try { + const response = await fetch(`${this.baseUrl}/v1/users/${user.id}`, { + method: "PUT", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + }); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Knock API error: ${response.status} ${errorText}`); + } + } catch (error) { + // Log error but don't throw to avoid breaking user creation + console.error("Failed to identify user in Knock:", error, this.apiKey); + } + } + + /** + * Merge two user records (e.g., invited user with registered user) + */ + async mergeUsers( + primaryUserId: string, + secondaryUserId: string + ): Promise { + if (!primaryUserId || !secondaryUserId) { + throw new Error( + "Both primary and secondary user IDs are required for merge" + ); + } + + if (!this.apiKey) { + return; + } + + try { + const response = await fetch( + `${this.baseUrl}/v1/users/${primaryUserId}/merge`, + { + method: "POST", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ + from_user_id: secondaryUserId, + }), + } + ); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Knock API error: ${response.status} ${errorText}`); + } + } catch (error) { + // Log error but don't throw to avoid breaking OAuth flow + console.error("Failed to merge users in Knock:", error); + } + } + + /** + * Delete a user from Knock + */ + async deleteUser(userId: string): Promise { + if (!userId) { + throw new Error("User ID is required for deletion"); + } + + if (!this.apiKey) { + return; + } + + try { + const response = await fetch(`${this.baseUrl}/v1/users/${userId}`, { + method: "DELETE", + headers: { + Authorization: `Bearer ${this.apiKey}`, + }, + }); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Knock API error: ${response.status} ${errorText}`); + } + } catch (error) { + // Log error but don't throw to avoid breaking user deletion + console.error("Failed to delete user in Knock:", error); + } + } + + /** + * Create or update a tenant in Knock + */ + async createTenant(tenant: KnockTenant): Promise { + console.log("[KNOCK DEBUG] createTenant called with:", { + tenantId: tenant.id, + tenantName: tenant.name, + hasApiKey: !!this.apiKey, + apiKeyPrefix: this.apiKey ? this.apiKey.substring(0, 10) + "..." : "none", + baseUrl: this.baseUrl, + }); + + if (!tenant.id) { + const error = "Tenant ID is required"; + console.log("[KNOCK DEBUG] createTenant failed:", error); + throw new Error(error); + } + + if (!this.apiKey) { + console.log("[KNOCK DEBUG] createTenant skipped: no API key"); + return; + } + + const payload = { + id: tenant.id, + ...(tenant.name && { name: tenant.name }), + ...(tenant.properties && { properties: tenant.properties }), + }; + + console.log( + "[KNOCK DEBUG] createTenant payload:", + JSON.stringify(payload, null, 2) + ); + + try { + const url = `${this.baseUrl}/v1/tenants/${tenant.id}`; + console.log("[KNOCK DEBUG] createTenant making PUT request to:", url); + + const response = await fetch(url, { + method: "PUT", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + }); + + console.log("[KNOCK DEBUG] createTenant response:", { + status: response.status, + statusText: response.statusText, + ok: response.ok, + contentType: response.headers.get("content-type"), + }); + + if (!response.ok) { + const errorText = await response.text(); + const errorMessage = `Knock API error: ${response.status} ${errorText}`; + console.log("[KNOCK DEBUG] createTenant API error:", errorMessage); + throw new Error(errorMessage); + } + + const responseText = await response.text(); + console.log("[KNOCK DEBUG] createTenant success response:", responseText); + } catch (error) { + console.error("[KNOCK DEBUG] createTenant caught error:", error); + // Log error but don't throw to avoid breaking tenant creation + console.error("Failed to create tenant in Knock:", error); + } + } + + /** + * Add subscriptions to an object in Knock + */ + async addObjectSubscriptions( + collection: string, + objectId: string, + recipients: string[] + ): Promise { + console.log("[KNOCK DEBUG] addObjectSubscriptions called with:", { + collection, + objectId, + recipients, + recipientCount: recipients.length, + hasApiKey: !!this.apiKey, + apiKeyPrefix: this.apiKey ? this.apiKey.substring(0, 10) + "..." : "none", + baseUrl: this.baseUrl, + }); + + if (!collection || !objectId || !recipients.length) { + const error = "Collection, object ID, and recipients are required"; + console.log("[KNOCK DEBUG] addObjectSubscriptions failed:", error); + throw new Error(error); + } + + if (!this.apiKey) { + console.log("[KNOCK DEBUG] addObjectSubscriptions skipped: no API key"); + return; + } + + const validRecipients = recipients.filter( + (id) => typeof id === "string" && id.trim().length > 0 + ); + + console.log("[KNOCK DEBUG] addObjectSubscriptions filtered recipients:", { + original: recipients, + valid: validRecipients, + filtered: recipients.length - validRecipients.length, + }); + + if (validRecipients.length === 0) { + console.warn( + "[KNOCK DEBUG] addObjectSubscriptions: No valid recipients provided for object subscription" + ); + console.warn("No valid recipients provided for object subscription"); + return; + } + + const payload = { + recipients: validRecipients, + }; + + try { + const url = `${this.baseUrl}/v1/objects/${collection}/${objectId}/subscriptions`; + console.log( + "[KNOCK DEBUG] addObjectSubscriptions making POST request to:", + url + ); + console.log( + "[KNOCK DEBUG] addObjectSubscriptions payload:", + JSON.stringify(payload, null, 2) + ); + + const response = await fetch(url, { + method: "POST", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + }); + + console.log("[KNOCK DEBUG] addObjectSubscriptions response:", { + status: response.status, + statusText: response.statusText, + ok: response.ok, + contentType: response.headers.get("content-type"), + }); + + if (!response.ok) { + const errorText = await response.text(); + const errorMessage = `Knock API error: ${response.status} ${errorText}`; + console.log( + "[KNOCK DEBUG] addObjectSubscriptions API error:", + errorMessage + ); + throw new Error(errorMessage); + } + + const responseText = await response.text(); + console.log( + "[KNOCK DEBUG] addObjectSubscriptions success response:", + responseText + ); + } catch (error) { + console.error( + "[KNOCK DEBUG] addObjectSubscriptions caught error:", + error + ); + // Log error but don't throw to avoid breaking subscription flow + console.error("Failed to add object subscriptions in Knock:", error); + } + } + + /** + * Remove subscriptions from an object in Knock + */ + async removeObjectSubscriptions( + collection: string, + objectId: string, + recipients: string[] + ): Promise { + if (!collection || !objectId || !recipients.length) { + throw new Error("Collection, object ID, and recipients are required"); + } + + if (!this.apiKey) { + return; + } + + const validRecipients = recipients.filter( + (id) => typeof id === "string" && id.trim().length > 0 + ); + if (validRecipients.length === 0) { + console.warn("No valid recipients provided for object unsubscription"); + return; + } + + const payload = { + recipients: validRecipients, + }; + + try { + const response = await fetch( + `${this.baseUrl}/v1/objects/${collection}/${objectId}/subscriptions`, + { + method: "DELETE", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + } + ); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Knock API error: ${response.status} ${errorText}`); + } + } catch (error) { + // Log error but don't throw to avoid breaking unsubscription flow + console.error("Failed to remove object subscriptions in Knock:", error); + } + } + + /** + * Set an object in Knock with properties + */ + async setObject( + collection: string, + objectId: string, + properties: Record + ): Promise { + console.log("[KNOCK DEBUG] setObject called with:", { + collection, + objectId, + properties: JSON.stringify(properties, null, 2), + hasApiKey: !!this.apiKey, + apiKeyPrefix: this.apiKey ? this.apiKey.substring(0, 10) + "..." : "none", + baseUrl: this.baseUrl, + }); + + if (!collection || !objectId) { + const error = "Collection and object ID are required"; + console.log("[KNOCK DEBUG] setObject failed:", error); + throw new Error(error); + } + + if (!this.apiKey) { + console.log("[KNOCK DEBUG] setObject skipped: no API key"); + return; + } + + try { + const url = `${this.baseUrl}/v1/objects/${collection}/${objectId}`; + console.log("[KNOCK DEBUG] setObject making PUT request to:", url); + console.log( + "[KNOCK DEBUG] setObject payload:", + JSON.stringify(properties, null, 2) + ); + + const response = await fetch(url, { + method: "PUT", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(properties), + }); + + console.log("[KNOCK DEBUG] setObject response:", { + status: response.status, + statusText: response.statusText, + ok: response.ok, + contentType: response.headers.get("content-type"), + }); + + if (!response.ok) { + const errorText = await response.text(); + const errorMessage = `Knock API error: ${response.status} ${errorText}`; + console.log("[KNOCK DEBUG] setObject API error:", errorMessage); + throw new Error(errorMessage); + } + + const responseText = await response.text(); + console.log("[KNOCK DEBUG] setObject success response:", responseText); + } catch (error) { + console.error("[KNOCK DEBUG] setObject caught error:", error); + // Log error but don't throw to avoid breaking object creation + console.error("Failed to set object in Knock:", error); + } + } + + /** + * Delete a tenant in Knock + */ + async deleteTenant(tenantId: string): Promise { + if (!tenantId) { + throw new Error("Tenant ID is required"); + } + + if (!this.apiKey) { + return; + } + + try { + const response = await fetch(`${this.baseUrl}/v1/tenants/${tenantId}`, { + method: "DELETE", + headers: { + Authorization: `Bearer ${this.apiKey}`, + }, + }); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Knock API error: ${response.status} ${errorText}`); + } + } catch (error) { + // Log error but don't throw to avoid breaking team deletion flow + console.error("Failed to delete tenant in Knock:", error); + } + } + + /** + * Delete an object in Knock + */ + async deleteObject(collection: string, objectId: string): Promise { + if (!collection || !objectId) { + throw new Error("Collection and object ID are required"); + } + + if (!this.apiKey) { + return; + } + + try { + const response = await fetch( + `${this.baseUrl}/v1/objects/${collection}/${objectId}`, + { + method: "DELETE", + headers: { + Authorization: `Bearer ${this.apiKey}`, + }, + } + ); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Knock API error: ${response.status} ${errorText}`); + } + } catch (error) { + // Log error but don't throw to avoid breaking team deletion flow + console.error("Failed to delete object in Knock:", error); + } + } + + /** + * Trigger a workflow in Knock + */ + async triggerWorkflow( + workflowKey: string, + recipients: Array, + data: Record, + actor?: string, + tenant?: string, + options?: { idempotencyKey?: string } + ): Promise { + if (!workflowKey) { + throw new Error("Workflow key is required"); + } + + if (!recipients || recipients.length === 0) { + throw new Error("At least one recipient is required"); + } + + if (!this.apiKey) { + throw new Error("Knock service not configured - missing API key"); + } + + const payload = { + recipients, + data, + ...(actor && { actor }), + ...(tenant && { tenant }), + }; + + try { + const response = await fetch( + `${this.baseUrl}/v1/workflows/${workflowKey}/trigger`, + { + method: "POST", + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + ...(options?.idempotencyKey + ? { "Idempotency-Key": options.idempotencyKey } + : {}), + }, + body: JSON.stringify(payload), + } + ); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error( + `Knock workflow trigger error: ${response.status} ${errorText}` + ); + } + } catch (error) { + // Log error but don't throw to avoid breaking core functionality + console.error( + `Failed to trigger Knock workflow '${workflowKey}':`, + error + ); + } + } +} + +// Simple singleton instance +let knockService: KnockService | null = null; + +/** + * Get the Knock service instance + * Returns null if Knock is not configured + */ +export function getKnockService(): KnockService | null { + if (knockService) { + return knockService; + } + + const apiKey = process.env.KNOCK_API_KEY; + if (!apiKey) { + return null; + } + + const baseUrl = process.env.KNOCK_BASE_URL; + knockService = new KnockService(apiKey, baseUrl); + + return knockService; +} diff --git a/packages/database/src/observability/filters.ts b/packages/database/src/observability/filters.ts new file mode 100644 index 0000000..adf9523 --- /dev/null +++ b/packages/database/src/observability/filters.ts @@ -0,0 +1,68 @@ +import type { AnyColumn, SQL } from "drizzle-orm"; +import { and, sql } from "drizzle-orm"; +import util from "util"; + +export interface FieldFilter { + type: "eq"; + key: string; + value: string; +} + +export interface FieldFilterGroup { + type: "and"; + filters: (FieldFilter | FieldFilterGroup)[]; +} + +/** + * Compile filters to PostgreSQL SQL expressions. + * This mirrors the Clickhouse implementation but uses PostgreSQL's JSONB operators. + */ +export function compileFilters( + filters: FieldFilterGroup | FieldFilter, + payloadColumn: AnyColumn | SQL +): SQL | undefined { + return compileFiltersInner(filters, payloadColumn); +} + +function compileFiltersInner( + filters: FieldFilterGroup | FieldFilter, + payloadColumn: AnyColumn | SQL +): SQL | undefined { + if ("filters" in filters) { + // Handle a group of filters + if (filters.type !== "and") { + const _exhaustiveCheck: never = filters; + throw new Error( + `Invalid filters, expected type and: ${util.inspect(filters)}` + ); + } + if (filters.filters.length === 0) { + return undefined; + } + const compiledFilters = filters.filters + .map((filter) => compileFiltersInner(filter, payloadColumn)) + .filter((f): f is SQL => f !== undefined); + + if (compiledFilters.length === 0) { + return undefined; + } + return and(...compiledFilters); + } else if ("key" in filters && "value" in filters) { + // Handle a single filter + if (filters.type !== "eq") { + const _exhaustiveCheck: never = filters; + throw new Error( + `Invalid filters, expected type eq: ${util.inspect(filters)}` + ); + } + // Use PostgreSQL's JSONB path extraction operator #>> + // This extracts the value at the given JSON path as text + // For example: payload #>> '{key}' = 'value' + // This is equivalent to Clickhouse's JSON_VALUE(payload_str, '$.key') = 'value' + const jsonPath = `{${filters.key}}`; + return sql`${payloadColumn} #>> ${jsonPath} = ${filters.value}`; + } else { + const _exhaustiveCheck: never = filters; + throw new Error(`Invalid filters: ${util.inspect(filters)}`); + } +} diff --git a/packages/database/src/observability/logs.test.ts b/packages/database/src/observability/logs.test.ts new file mode 100644 index 0000000..0313cf4 --- /dev/null +++ b/packages/database/src/observability/logs.test.ts @@ -0,0 +1,138 @@ +import { describe, expect, test } from "bun:test"; +import connectToPostgres from "../postgres"; +import Querier from "../querier"; +import { createPostgresURL, createTestAgent } from "../test"; +import { getAgentLogs, regexFromText, writeAgentLog } from "./logs"; + +describe("regexFromText", () => { + test("simple text without special characters", () => { + expect(regexFromText("hello")).toBe("hello"); + expect(regexFromText("test message")).toBe("test message"); + }); + + test("wildcard asterisks become .*", () => { + expect(regexFromText("hello*world")).toBe("hello.*world"); + expect(regexFromText("*start")).toBe(".*start"); + expect(regexFromText("end*")).toBe("end.*"); + expect(regexFromText("*")).toBe(".*"); + }); + + test("regex metacharacters are escaped", () => { + expect(regexFromText("hello.world")).toBe("hello\\.world"); + expect(regexFromText("test[abc]")).toBe("test\\[abc\\]"); + expect(regexFromText("query?param=value")).toBe("query\\?param=value"); + }); + + test("complex patterns with wildcards", () => { + expect(regexFromText("*.log")).toBe(".*\\.log"); + expect(regexFromText("error[*]")).toBe("error\\[.*\\]"); + }); +}); + +describe("Agent Logs", () => { + test("should insert and retrieve logs", async () => { + const url = await createPostgresURL(); + const db = await connectToPostgres(url); + const querier = new Querier(db); + const agent = await createTestAgent(querier); + + // Insert test log + await writeAgentLog(db, { + agent_id: agent.id, + event: { + message: "Test log message", + level: "info", + source: "test", + }, + }); + + const start = new Date(Date.now() - 1000 * 60); // 1 minute ago + const end = new Date(Date.now() + 1000 * 60); // 1 minute from now + + // Query logs + const logs = await getAgentLogs(db, { + agent_id: agent.id, + start_time: start, + end_time: end, + limit: 100, + }); + + expect(logs).toHaveLength(1); + const log = logs[0]; + if (!log) { + throw new Error("No log found"); + } + expect(log.message).toContain("Test log message"); + expect(log.level).toBe("info"); + expect(Math.abs(start.getTime() - log.timestamp.getTime())).toBeLessThan( + 90 * 1000 + ); + }); + + test("should filter logs by message_pattern", async () => { + const url = await createPostgresURL(); + const db = await connectToPostgres(url); + const querier = new Querier(db); + const agent = await createTestAgent(querier); + + // Insert multiple logs + await writeAgentLog(db, { + agent_id: agent.id, + event: { message: "error occurred in system", level: "error" }, + }); + await writeAgentLog(db, { + agent_id: agent.id, + event: { message: "info about deployment", level: "info" }, + }); + await writeAgentLog(db, { + agent_id: agent.id, + event: { message: "another error happened", level: "error" }, + }); + + // Query with message_pattern + const logs = await getAgentLogs(db, { + agent_id: agent.id, + message_pattern: "*error*", + start_time: new Date(Date.now() - 1000 * 60), + end_time: new Date(Date.now() + 1000 * 60), + limit: 100, + }); + + expect(logs).toHaveLength(2); + for (const log of logs) { + expect(log.message.toLowerCase()).toContain("error"); + } + }); + + test("should filter logs by advanced filters", async () => { + const url = await createPostgresURL(); + const db = await connectToPostgres(url); + const querier = new Querier(db); + const agent = await createTestAgent(querier); + + // Insert logs with different sources + await writeAgentLog(db, { + agent_id: agent.id, + event: { message: "log from app", source: "application" }, + }); + await writeAgentLog(db, { + agent_id: agent.id, + event: { message: "log from system", source: "system" }, + }); + + // Query with advanced filters + const logs = await getAgentLogs(db, { + agent_id: agent.id, + filters: { + type: "and", + filters: [{ type: "eq", key: "source", value: "application" }], + }, + start_time: new Date(Date.now() - 1000 * 60), + end_time: new Date(Date.now() + 1000 * 60), + limit: 100, + }); + + expect(logs).toHaveLength(1); + expect(logs[0]?.message).toContain("app"); + }); +}); diff --git a/packages/database/src/observability/logs.ts b/packages/database/src/observability/logs.ts new file mode 100644 index 0000000..9afb909 --- /dev/null +++ b/packages/database/src/observability/logs.ts @@ -0,0 +1,127 @@ +import { and, desc, eq, gte, lte, sql, type SQL } from "drizzle-orm"; +import type { NodePgDatabase } from "drizzle-orm/node-postgres"; +import { agent_log } from "../schema"; +import { compileFilters, type FieldFilterGroup } from "./filters"; + +export interface AgentLog { + message: string; + timestamp: Date; + level: "info" | "warn" | "error"; +} + +const parseLevel = (level: string): "info" | "warn" | "error" => { + const lowerCaseLevel = level.trim().toLowerCase(); + if (lowerCaseLevel.includes("info")) { + return "info"; + } + if (lowerCaseLevel.includes("warn")) { + return "warn"; + } + if (lowerCaseLevel.includes("error")) { + return "error"; + } + return "info"; +}; + +/** + * Convert user-friendly wildcard pattern to PostgreSQL regex. + * Mirrors the Clickhouse implementation. + * - `*` becomes `.*` (wildcard) + * - `\*` stays as literal `*` + * - Special regex chars are escaped + */ +export const regexFromText = ( + text: string, + { caseInsensitive = false } = {} +): string => { + // Escape special regex characters except * and \ + const escapeRegex = (str: string): string => { + return str.replace(/[.+?^${}()|[\]\\]/g, "\\$&"); + }; + + // Split by \* (literal asterisk) to preserve them + const parts = text.split("\\\\*"); + const processed = parts.map((part) => { + // Split by * (wildcard) and process each segment + return part + .split("*") + .map((segment) => escapeRegex(segment)) + .join(".*"); + }); + + return processed.join("\\\\*"); +}; + +export async function getAgentLogs( + db: NodePgDatabase, + opts: { + agent_id: string; + message_pattern?: string; + filters?: FieldFilterGroup; + start_time: Date; + end_time: Date; + limit: number; + } +): Promise { + // Build WHERE clauses + const whereClauses: SQL[] = [ + eq(agent_log.agent_id, opts.agent_id), + gte(agent_log.timestamp, opts.start_time), + lte(agent_log.timestamp, opts.end_time), + ]; + + // Add message pattern filter if provided + if (opts.message_pattern) { + const pattern = regexFromText(opts.message_pattern, { + caseInsensitive: true, + }); + // Use PostgreSQL's ~* operator for case-insensitive regex matching + whereClauses.push(sql`${agent_log.payload_str} ~* ${pattern}`); + } + + // Add advanced filters if provided + if (opts.filters) { + const filterSql = compileFilters(opts.filters, agent_log.payload); + if (filterSql) { + whereClauses.push(filterSql); + } + } + + const rows = await db + .select({ + timestamp: agent_log.timestamp, + payload_str: agent_log.payload_str, + level: agent_log.level, + }) + .from(agent_log) + .where(and(...whereClauses)) + .orderBy(desc(agent_log.timestamp)) + .limit(opts.limit); + + return rows.map((row) => ({ + timestamp: row.timestamp, + message: row.payload_str, + level: parseLevel(row.level), + })); +} + +export async function writeAgentLog( + db: NodePgDatabase, + opts: { + agent_id: string; + event: Record; + } +): Promise { + const level = + typeof opts.event.level === "string" + ? parseLevel(opts.event.level) + : "info"; + + await db.insert(agent_log).values({ + agent_id: opts.agent_id, + level: level, + payload: opts.event, + metadata: { source: "platform" }, + payload_str: JSON.stringify(opts.event), + }); +} diff --git a/packages/database/src/observability/traces.ts b/packages/database/src/observability/traces.ts new file mode 100644 index 0000000..b734ba9 --- /dev/null +++ b/packages/database/src/observability/traces.ts @@ -0,0 +1,106 @@ +import { and, desc, eq, gte, lte, type SQL } from "drizzle-orm"; +import type { NodePgDatabase } from "drizzle-orm/node-postgres"; +import { agent_trace } from "../schema"; +import { compileFilters, type FieldFilterGroup } from "./filters"; + +export interface OtelSpanData { + duration_ns: string; + trace_id: string; + id: string; + parent_span_id: string; + name: string; + kind: string; + status_code: string; + status_message: string; + trace_state: string; + flags: number; + dropped_attributes_count: number; + dropped_events_count: number; + dropped_links_count: number; + attributes: Record; + events: any[]; + links: any[]; +} + +export interface OtelPayload { + span: OtelSpanData; + resource: any; + scope: any; +} + +export interface OtelSpan { + agent_id: string; + start_time: string; + end_time: string; + payload: OtelPayload; +} + +export interface ReadTracesOpts { + agent_id: string; + filters: FieldFilterGroup; + start_time?: Date; + end_time?: Date; + limit: number; +} + +export async function writeTraces( + db: NodePgDatabase, + spans: OtelSpan[] +): Promise { + if (spans.length === 0) { + return; + } + + const values = spans.map((span) => ({ + agent_id: span.agent_id, + start_time: new Date(span.start_time), + end_time: new Date(span.end_time), + payload: span.payload as any, + payload_original: JSON.stringify(span.payload), + payload_str: JSON.stringify(span.payload), + })); + + await db.insert(agent_trace).values(values); +} + +export async function readTraces( + db: NodePgDatabase, + opts: ReadTracesOpts +): Promise<(OtelSpan & { created_at: string })[]> { + const whereClauses: SQL[] = [eq(agent_trace.agent_id, opts.agent_id)]; + + if (opts.start_time) { + whereClauses.push(gte(agent_trace.start_time, opts.start_time)); + } + + if (opts.end_time) { + whereClauses.push(lte(agent_trace.end_time, opts.end_time)); + } + + // Add advanced filters + const filterSql = compileFilters(opts.filters, agent_trace.payload); + if (filterSql) { + whereClauses.push(filterSql); + } + + const rows = await db + .select({ + agent_id: agent_trace.agent_id, + created_at: agent_trace.created_at, + start_time: agent_trace.start_time, + end_time: agent_trace.end_time, + payload_original: agent_trace.payload_original, + }) + .from(agent_trace) + .where(and(...whereClauses)) + .orderBy(desc(agent_trace.start_time)) + .limit(opts.limit); + + return rows.map((row) => ({ + agent_id: row.agent_id, + created_at: row.created_at.toISOString(), + start_time: row.start_time.toISOString(), + end_time: row.end_time.toISOString(), + payload: JSON.parse(row.payload_original), + })); +} diff --git a/packages/database/src/postgres-worker.ts b/packages/database/src/postgres-worker.ts new file mode 100644 index 0000000..5542fdb --- /dev/null +++ b/packages/database/src/postgres-worker.ts @@ -0,0 +1,602 @@ +// This is fully vibe-coded and quite honestly, +// I have zero clue how it works - but it works. +import { PGlite } from "@electric-sql/pglite"; +import { uuid_ossp } from "@electric-sql/pglite/contrib/uuid_ossp"; +import { vector } from "@electric-sql/pglite/vector"; +import { drizzle } from "drizzle-orm/pglite"; +import { migrate } from "drizzle-orm/pglite/migrator"; +import * as net from "net"; +import { join } from "path"; +import { + BackendMessageCode, + FrontendMessageCode, + getMessages, + PostgresConnection, +} from "pg-gateway"; +import { fromNodeSocket } from "pg-gateway/node"; +import type { PostgresOptions } from "./test"; + +type Session = { + id: string; + inTxn: boolean; + watchdog?: NodeJS.Timeout | null; + // per-socket emulation for unnamed objects + unnamedStmt?: string; + unnamedPortal?: string; + cS: number; // stmt counter + cP: number; // portal counter +}; + +const SID_DELIM = "\x1F"; +const OWNER_WATCHDOG_MS = 3000; + +const td = new TextDecoder(); +const te = new TextEncoder(); + +self.onmessage = async (e) => { + const opts = e.data as PostgresOptions; + const password = opts.password ?? "password"; + + const db = new PGlite(opts.storage ?? "memory://", { + username: "postgres", + debug: 0, + extensions: { vector, uuid_ossp }, + }); + await db.waitReady; + await db.exec("SET client_min_messages TO ERROR;"); + await db.exec("SET log_min_messages TO ERROR;"); + await migrate(drizzle(db), { + migrationsFolder: join(__dirname, "..", "migrations"), + }); + + type Task = { + socket: net.Socket; + data: Uint8Array; + resolve: (v: Uint8Array) => void; + reject: (e: unknown) => void; + }; + const taskQueue: Task[] = []; + let processing = false; + + let owner: net.Socket | null = null; + const sessions = new Map(); + const patchBySocket = new Map(); + + // --- bin helpers --- + const dv32 = (b: Uint8Array, o: number) => + ((b[o] << 24) | (b[o + 1] << 16) | (b[o + 2] << 8) | b[o + 3]) >>> 0; + const sv32 = (b: Uint8Array, o: number) => + (b[o] << 24) | (b[o + 1] << 16) | (b[o + 2] << 8) | b[o + 3]; + const wr32 = (n: number) => + new Uint8Array([ + (n >>> 24) & 0xff, + (n >>> 16) & 0xff, + (n >>> 8) & 0xff, + n & 0xff, + ]); + const wr16 = (n: number) => new Uint8Array([(n >>> 8) & 0xff, n & 0xff]); + const zero = () => new Uint8Array([0]); + const concat = (...parts: Uint8Array[]) => { + let total = 0; + for (const p of parts) total += p.length; + const out = new Uint8Array(total); + let o = 0; + for (const p of parts) { + out.set(p, o); + o += p.length; + } + return out; + }; + const withLength = (header: Uint8Array, body: Uint8Array) => { + const len = body.length + 4; + header[1] = (len >>> 24) & 0xff; + header[2] = (len >>> 16) & 0xff; + header[3] = (len >>> 8) & 0xff; + header[4] = len & 0xff; + return concat(header, body); + }; + const readCString = (buf: Uint8Array, off: number) => { + let i = off; + while (i < buf.length && buf[i] !== 0) i++; + const str = td.decode(buf.subarray(off, i)); + return { str, next: i + 1 }; + }; + + // --- simple SQL detection --- + const stripSqlLeadingNoise = (sql: string) => { + let s = sql.trimStart(); + for (;;) { + if (s.startsWith("/*")) { + const end = s.indexOf("*/"); + if (end === -1) break; + s = s.slice(end + 2).trimStart(); + continue; + } + if (s.startsWith("--")) { + const nl = s.indexOf("\n"); + if (nl === -1) return ""; + s = s.slice(nl + 1).trimStart(); + continue; + } + break; + } + return s; + }; + const isBeginLike = (sql: string) => { + const s = stripSqlLeadingNoise(sql).toLowerCase(); + return s.startsWith("begin") || s.startsWith("start transaction"); + }; + const isCommitOrRollback = (sql: string) => { + const s = stripSqlLeadingNoise(sql).toLowerCase(); + return ( + s.startsWith("commit") || s.startsWith("end") || s.startsWith("rollback") + ); + }; + + // --- namespacing / per-socket unnamed emulation --- + const ns = (sess: Session, name: string) => + name.length === 0 ? "" : sess.id + SID_DELIM + name; + const nextStmtName = (sess: Session) => `${sess.id}${SID_DELIM}S${++sess.cS}`; + const nextPortalName = (sess: Session) => + `${sess.id}${SID_DELIM}P${++sess.cP}`; + + const rewriteOneMessage = (sess: Session, msg: Uint8Array): Uint8Array => { + const tag = msg[0]; + const len = dv32(msg, 1); + const body = msg.subarray(5, 1 + len); + const header = new Uint8Array([tag, ...wr32(0)]); + + switch (tag) { + case FrontendMessageCode.Parse: { + let off = 0; + const name1 = readCString(body, off); + off = name1.next; + const query1 = readCString(body, off); + off = query1.next; + const nParams = (body[off] << 8) | body[off + 1]; + off += 2; + const paramBytes = body.subarray(off, off + nParams * 4); + + let outName: string; + if (name1.str.length === 0) { + outName = nextStmtName(sess); + sess.unnamedStmt = outName; + } else { + outName = ns(sess, name1.str); + } + + const outBody = concat( + te.encode(outName), + zero(), + te.encode(query1.str), + zero(), + wr16(nParams), + paramBytes + ); + return withLength(header, outBody); + } + + case FrontendMessageCode.Bind: { + let off = 0; + const portal = readCString(body, off); + off = portal.next; + const stmt = readCString(body, off); + off = stmt.next; + + const nFmt = (body[off] << 8) | body[off + 1]; + off += 2; + const fmtBytes = body.subarray(off, off + nFmt * 2); + off += nFmt * 2; + + const nParams = (body[off] << 8) | body[off + 1]; + off += 2; + const paramsStart = off; + for (let i = 0; i < nParams; i++) { + const l = sv32(body, off); + off += 4; + if (l >= 0) off += l; + } + const paramVals = body.subarray(paramsStart, off); + + const nResFmt = (body[off] << 8) | body[off + 1]; + off += 2; + const resFmtBytes = body.subarray(off, off + nResFmt * 2); + + // portal name + let outPortal: string; + if (portal.str.length === 0) { + outPortal = nextPortalName(sess); + sess.unnamedPortal = outPortal; + } else { + outPortal = ns(sess, portal.str); + } + + // statement name + let outStmt: string; + if (stmt.str.length === 0) { + // Bind to most recent unnamed stmt (per-socket); if none, leave "" (server will error as it should) + outStmt = sess.unnamedStmt ?? ""; + } else { + outStmt = ns(sess, stmt.str); + } + + const outBody = concat( + te.encode(outPortal), + zero(), + te.encode(outStmt), + zero(), + wr16(nFmt), + fmtBytes, + wr16(nParams), + paramVals, + wr16(nResFmt), + resFmtBytes + ); + return withLength(header, outBody); + } + + case FrontendMessageCode.Describe: { + let off = 0; + const kind = body[off]; + off += 1; // 'S' or 'P' + const nm = readCString(body, off); + let outName = nm.str; + if (kind === 0x53 /*'S'*/) { + outName = + nm.str.length === 0 ? (sess.unnamedStmt ?? "") : ns(sess, nm.str); + } else { + outName = + nm.str.length === 0 ? (sess.unnamedPortal ?? "") : ns(sess, nm.str); + } + const outBody = concat( + new Uint8Array([kind]), + te.encode(outName), + zero() + ); + return withLength(header, outBody); + } + + case FrontendMessageCode.Close: { + let off = 0; + const kind = body[off]; + off += 1; + const nm = readCString(body, off); + let outName = nm.str; + if (kind === 0x53 /*'S'*/) { + outName = + nm.str.length === 0 ? (sess.unnamedStmt ?? "") : ns(sess, nm.str); + // closing unnamed => forget mapping + if (nm.str.length === 0) sess.unnamedStmt = undefined; + } else { + outName = + nm.str.length === 0 ? (sess.unnamedPortal ?? "") : ns(sess, nm.str); + if (nm.str.length === 0) sess.unnamedPortal = undefined; + } + const outBody = concat( + new Uint8Array([kind]), + te.encode(outName), + zero() + ); + return withLength(header, outBody); + } + + case FrontendMessageCode.Execute: { + let off = 0; + const portal = readCString(body, off); + off = portal.next; + const maxRows = dv32(body, off); + const outPortal = + portal.str.length === 0 + ? (sess.unnamedPortal ?? "") + : ns(sess, portal.str); + const outBody = concat(te.encode(outPortal), zero(), wr32(maxRows)); + return withLength(header, outBody); + } + + case FrontendMessageCode.Sync: { + // portals are dropped at Sync + sess.unnamedPortal = undefined; + return msg; + } + + default: + return msg; + } + }; + + const rewriteFrontendForSocket = ( + sess: Session, + buf: Uint8Array + ): Uint8Array => { + let off = 0; + const parts: Uint8Array[] = []; + while (off < buf.length) { + const len = dv32(buf, off + 1); + const end = off + 1 + len; + parts.push(rewriteOneMessage(sess, buf.subarray(off, end))); + off = end; + } + return concat(...parts); + }; + + // --- owner handling --- + const startWatchdog = (s: net.Socket) => { + const sess = sessions.get(s); + if (!sess) return; + if (sess.watchdog) clearTimeout(sess.watchdog); + sess.watchdog = setTimeout(() => { + try { + s.destroy(new Error("owner stalled")); + } catch {} + }, OWNER_WATCHDOG_MS); + }; + const clearWatchdog = (s: net.Socket) => { + const sess = sessions.get(s); + if (sess?.watchdog) { + clearTimeout(sess.watchdog); + sess.watchdog = null; + } + }; + const claimOwnerIfFree = (s: net.Socket) => { + if (!owner) { + owner = s; + startWatchdog(s); + } + }; + const releaseOwnerIf = (s: net.Socket) => { + if (owner === s) { + clearWatchdog(s); + owner = null; + } + }; + + const getReadyStatus = async (raw: Uint8Array): Promise => { + let status: number | null = null; + for await (const msg of getMessages(raw)) { + if (msg[0] === BackendMessageCode.ReadyForQuery) + status = msg[msg.length - 1]; + } + return status; + }; + + const processOne = async (socket: net.Socket, buf: Uint8Array) => { + const sess = sessions.get(socket)!; + const patchedIn = rewriteFrontendForSocket(sess, buf); + const raw = await db.execProtocolRawSync(patchedIn); + + if (owner === socket) startWatchdog(socket); + + const patch = patchBySocket.get(socket); + const gen = patch ? patch.filterResponse(buf, raw) : getMessages(raw); + const parts: Uint8Array[] = []; + while (true) { + const { value, done } = await gen.next(); + if (done) { + if (value) parts.push(value); + break; + } + if (value) parts.push(value); + } + if (parts.length === 1) return parts[0]; + if (parts.length === 0) return new Uint8Array(0); + return concat(...parts); + }; + + const maybeClaimOnEnqueue = (socket: net.Socket, buf: Uint8Array) => { + const tag = buf[0]; + if (tag === FrontendMessageCode.Parse || tag === FrontendMessageCode.Bind) { + claimOwnerIfFree(socket); + return; + } + if (tag === FrontendMessageCode.Query) { + const len = dv32(buf, 1); + const body = buf.subarray(5, 1 + len); + const { str: sql } = readCString(body, 0); + if (isBeginLike(sql)) { + const sess = sessions.get(socket); + if (sess) sess.inTxn = true; + claimOwnerIfFree(socket); + } + } + }; + + const maybeReleaseAfterProcess = async ( + socket: net.Socket, + inBuf: Uint8Array, + outBuf: Uint8Array + ) => { + const sess = sessions.get(socket); + + const r4q = await getReadyStatus(outBuf); // 'I' | 'T' | 'E' + if (r4q !== null) { + const inTxnNow = r4q === 0x54 /*T*/ || r4q === 0x45; /*E*/ + if (sess) sess.inTxn = inTxnNow; + if (!inTxnNow && inBuf[0] !== FrontendMessageCode.Sync) + releaseOwnerIf(socket); + } + + if (inBuf[0] === FrontendMessageCode.Sync) { + if (!sess?.inTxn) releaseOwnerIf(socket); + return; + } + + if (inBuf[0] === FrontendMessageCode.Query) { + const len = dv32(inBuf, 1); + const body = inBuf.subarray(5, 1 + len); + const { str: sql } = readCString(body, 0); + if (isCommitOrRollback(sql)) { + if (sess) sess.inTxn = false; + releaseOwnerIf(socket); + return; + } + } + }; + + const processQueue = async (): Promise => { + if (processing) return; + processing = true; + try { + while (true) { + if (owner) { + const idx = taskQueue.findIndex((t) => t.socket === owner); + if (idx === -1) break; + const task = taskQueue.splice(idx, 1)[0]!; + try { + const resp = await processOne(task.socket, task.data); + task.resolve(resp); + await maybeReleaseAfterProcess(task.socket, task.data, resp); + } catch (err) { + task.reject(err); + releaseOwnerIf(task.socket); + } + continue; + } + + if (taskQueue.length === 0) break; + + const task = taskQueue.shift()!; + try { + const resp = await processOne(task.socket, task.data); + task.resolve(resp); + await maybeReleaseAfterProcess(task.socket, task.data, resp); + } catch (err) { + task.reject(err); + } + + if ( + task.data[0] === FrontendMessageCode.Parse || + task.data[0] === FrontendMessageCode.Bind + ) { + claimOwnerIfFree(task.socket); + } + } + } finally { + processing = false; + } + }; + + // --- server --- + const server = net.createServer(async (socket) => { + const sid = "s" + Math.random().toString(36).slice(2); + sessions.set(socket, { + id: sid, + inTxn: false, + watchdog: null, + cS: 0, + cP: 0, + }); + + const conn = await fromNodeSocket(socket, { + serverVersion: "16.3", + auth: { + method: "password", + getClearTextPassword: () => password, + validateCredentials: async (_, state) => { + if ( + state.clientParams?.database && + state.clientParams.database !== "postgres" + ) { + await db.exec(`SET search_path TO ${state.clientParams.database}`); + } + return true; + }, + }, + async onStartup() { + await db.waitReady; + }, + async onMessage(data, { isAuthenticated }) { + if (!isAuthenticated) return; + maybeClaimOnEnqueue(socket, data); + return new Promise((resolve, reject) => { + taskQueue.push({ socket, data, resolve, reject }); + void processQueue(); + }); + }, + }); + + patchBySocket.set(socket, new PGliteExtendedQueryPatch(conn)); + + const cleanupSocket = () => { + releaseOwnerIf(socket); + for (let i = taskQueue.length - 1; i >= 0; i--) { + if (taskQueue[i]!.socket === socket) { + try { + taskQueue[i]!.reject(new Error("Socket closed")); + } catch {} + taskQueue.splice(i, 1); + } + } + const sess = sessions.get(socket); + if (sess) { + sess.unnamedPortal = undefined; + sess.unnamedStmt = undefined; + } + clearWatchdog(socket); + sessions.delete(socket); + patchBySocket.delete(socket); + void processQueue(); + }; + + socket.on("close", cleanupSocket); + socket.on("end", cleanupSocket); + socket.on("error", cleanupSocket); + }); + + await new Promise((resolve) => { + server.listen(opts.port ?? 0, "127.0.0.1", () => resolve()); + }); + + const addr = server.address(); + if (!addr) throw new Error("no address"); + // @ts-ignore + const port = addr.port; + if (!port) throw new Error("no port"); + + const url = `postgres://postgres:${password}@127.0.0.1:${port}`; + self.postMessage({ url }); +}; + +// https://github.com/electric-sql/pglite/issues/223#issuecomment-2332810579 +class PGliteExtendedQueryPatch { + isExtendedQuery = false; + lastReadyForQuery: Uint8Array | null = null; + + constructor(public connection: PostgresConnection) {} + + async *filterResponse(message: Uint8Array, response: Uint8Array) { + if ( + message[0] === FrontendMessageCode.Parse || + message[0] === FrontendMessageCode.Bind + ) { + this.isExtendedQuery = true; + this.lastReadyForQuery = null; + } + + if (message[0] === FrontendMessageCode.Sync) { + this.isExtendedQuery = false; + let readyFromSync: Uint8Array | null = null; + for await (const resp of getMessages(response)) { + if (resp[0] === BackendMessageCode.ReadyForQuery) { + readyFromSync = resp; + continue; + } + yield resp; + } + const ready = + readyFromSync ?? + this.lastReadyForQuery ?? + this.connection.createReadyForQuery(); + this.lastReadyForQuery = null; + return ready; + } + + for await (const m of getMessages(response)) { + if (this.isExtendedQuery && m[0] === BackendMessageCode.ReadyForQuery) { + this.lastReadyForQuery = m; + continue; + } + yield m; + } + return null; + } +} diff --git a/packages/database/src/postgres.test.ts b/packages/database/src/postgres.test.ts new file mode 100644 index 0000000..f328d92 --- /dev/null +++ b/packages/database/src/postgres.test.ts @@ -0,0 +1,38 @@ +import { expect, test } from "bun:test"; +import connectToPostgres from "./postgres"; +import Querier from "./querier"; +import { createPostgresURL } from "./test"; + +test("createPostgres", async () => { + const start = Date.now(); + const url = await createPostgresURL(); + const end = Date.now(); + const querier = new Querier(await connectToPostgres(url)); + const user = await querier.selectUserByID(crypto.randomUUID()); + expect(user).toBeUndefined(); + + const start2 = Date.now(); + await createPostgresURL(); + const end2 = Date.now(); + + // Subsequent creation should be faster or at least not significantly slower, + // because it's using the template. Allow for some variance in CI environments. + expect(end2 - start2).toBeLessThan((end - start) * 1.5); +}); + +// This tests if our postgres worker is actually functioning properly. +// We do a *LOT* of jank to make it so we can have concurrent clients. +test("createPostgres concurrent clients", async () => { + const url = await createPostgresURL(); + + const promises = []; + for (let i = 0; i < 100; i++) { + promises.push( + new Querier(await connectToPostgres(url)).selectUserByID( + crypto.randomUUID() + ) + ); + } + + await Promise.all(promises); +}); diff --git a/packages/database/src/postgres.ts b/packages/database/src/postgres.ts new file mode 100644 index 0000000..ddcd36f --- /dev/null +++ b/packages/database/src/postgres.ts @@ -0,0 +1,45 @@ +import type { PgDatabase } from "drizzle-orm/pg-core"; +import { drizzle as drizzleNode } from "drizzle-orm/postgres-js"; +import postgres from "postgres"; + +// connectToPostgres connects to a PostgreSQL instance. +export const connectToPostgres = async ( + url: string +): Promise> => { + if (url.includes("neon.tech")) { + // Use neon-serverless with WebSocket support for transactions + // Dynamic imports to avoid bundling into Edge Runtime if not needed + const { Pool, neonConfig } = await import("@neondatabase/serverless"); + const { drizzle } = await import("drizzle-orm/neon-serverless"); + + // Use native WebSocket (Node.js v21+, Edge Runtime, browsers) + // No need for the 'ws' package anymore! + if (typeof WebSocket !== "undefined") { + neonConfig.webSocketConstructor = WebSocket; + } + + const pool = new Pool({ connectionString: url }); + return drizzle(pool); + } else { + const parsed = new URL(url); + const isLocalEphemeral = + (parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost") && + parsed.port !== "" && + parsed.port !== "5432"; + const conn = postgres(url, { + // Limit pool size to 1 for local ephemeral PGlite to avoid concurrency races. + max: isLocalEphemeral ? 1 : undefined, + // Maximum of 30 seconds idle time. + idle_timeout: 30, + // Maximum of 30 minutes of connection lifetime. + max_lifetime: 60 * 30, + + onnotice: () => { + // noop + }, + }); + return drizzleNode(conn); + } +}; + +export default connectToPostgres; diff --git a/packages/database/src/querier.test.ts b/packages/database/src/querier.test.ts new file mode 100644 index 0000000..6e80551 --- /dev/null +++ b/packages/database/src/querier.test.ts @@ -0,0 +1,448 @@ +import { beforeEach, describe, expect, test } from "bun:test"; +import connectToPostgres from "./postgres"; +import Querier from "./querier"; +import { type ChatRunStepStatus } from "./schema"; +import { + createPostgresURL, + createTestAgent, + createTestAgentDeployment, + createTestChat, + createTestOrganization, + createTestUser, +} from "./test"; + +describe("updateOrganizationInviteLastAcceptedAtByID", () => { + let querier: Querier; + + beforeEach(async () => { + const url = await createPostgresURL(); + querier = new Querier(await connectToPostgres(url)); + }); + + test("updates last_accepted_at for valid invite", async () => { + // Create a team and invite + const user = await createTestUser(querier); + const team = await createTestOrganization(querier, { created_by: user.id }); + + const invite = await querier.insertOrganizationInvite({ + organization_id: team.id, + invited_by: user.id, + email: "test@test.com", + role: "member", + reusable: true, + }); + + // Verify invite was created without last_accepted_at + expect(invite.last_accepted_at).toBeNull(); + + // Update the last_accepted_at + const beforeUpdate = Date.now(); + await querier.updateOrganizationInviteLastAcceptedAtByID(invite.id); + const afterUpdate = Date.now(); + + // Verify the update using selectOrganizationInviteWithOrganizationByToken + const inviteWithTeam = + await querier.selectOrganizationInviteWithOrganizationByToken( + invite.code + ); + expect(inviteWithTeam).not.toBeNull(); + expect(inviteWithTeam!.organization_invite.last_accepted_at).not.toBeNull(); + + const acceptedTime = + inviteWithTeam!.organization_invite.last_accepted_at!.getTime(); + expect(acceptedTime).toBeGreaterThanOrEqual(beforeUpdate); + expect(acceptedTime).toBeLessThanOrEqual(afterUpdate); + }); +}); + +test("cursor pagination", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const user = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user.id }); + const agent = await createTestAgent(querier, { + created_by: user.id, + organization_id: org.id, + }); + + for (let i = 0; i < 100; i++) { + await createTestChat(querier, { + created_by: user.id, + organization_id: org.id, + agent_id: agent.id, + }); + } + + const limit = 10; + + // Page 1 (initial) + const first = await querier.selectChats({ + organizationID: org.id, + limit, + }); + + expect(first.items.length).toBe(limit); + expect(first.next_cursor).toBeString(); + + const firstIds = first.items.map((c) => c.id); + + // Page 2 (forward) using starting_after + const second = await querier.selectChats({ + organizationID: org.id, + cursor: first.next_cursor!, + limit, + }); + + expect(second.items.length).toBe(limit); + expect(second.next_cursor).toBeString(); + + const secondIds = second.items.map((c) => c.id); + // No overlap between consecutive pages when moving forward + expect(firstIds.some((id) => secondIds.includes(id))).toBeFalse(); + + // Walk to the end using starting_after and ensure we see all items without duplicates + const seen = new Set(firstIds); + let cursor: string | undefined = first.next_cursor!; + let pagesTraversed = 1; // already have first page + // Iterate until no more pages + // Safety cap to avoid infinite loop in case of logic bugs + for (let i = 0; i < 20; i++) { + const page = await querier.selectChats({ + organizationID: org.id, + cursor, + limit, + }); + pagesTraversed++; + + for (const row of page.items) { + expect(seen.has(row.id)).toBeFalse(); + seen.add(row.id); + } + + if (!page.next_cursor) { + // Last page specifics + expect(page.next_cursor ?? null).toBeNull(); + expect(page.items.length).toBeLessThanOrEqual(limit); + break; + } + + expect(page.next_cursor).toBeString(); + cursor = page.next_cursor; + } + + // We created exactly 100 chats; ensure we've paged through all of them + expect(seen.size).toBe(100); + // With limit 10 and 100 items, we should have traversed exactly 10 pages + expect(pagesTraversed).toBe(10); + + // Single-page behavior (limit >= total): request a very large page size + const bigPage = await querier.selectChats({ + organizationID: org.id, + limit: 200, + }); + expect(bigPage.items.length).toBe(100); + expect(bigPage.next_cursor).toBeNull(); +}); + +const prepareChatStatusTest = async () => { + const db = await connectToPostgres(await createPostgresURL()); + const querier = new Querier(db); + + const user = await createTestUser(querier); + const org = await createTestOrganization(querier, { created_by: user.id }); + const agent = await createTestAgent(querier, { + created_by: user.id, + organization_id: org.id, + }); + const deployment = await createTestAgentDeployment(querier, { + agent_id: agent.id, + created_by: user.id, + }); + await querier.updateAgent({ + id: agent.id, + active_deployment_id: deployment.id, + }); + const chat = await createTestChat(querier, { + created_by: user.id, + organization_id: org.id, + agent_id: agent.id, + }); + return { querier, user, org, agent, deployment, chat }; +}; + +describe("chat status", async () => { + test("multiple runs are not created when behavior=enqueue", async () => { + const { querier, chat, agent } = await prepareChatStatusTest(); + await querier.reconcileChatRun({ + behavior: "enqueue", + chat_id: chat.id, + agent_id: agent.id, + }); + await querier.reconcileChatRun({ + behavior: "enqueue", + chat_id: chat.id, + agent_id: agent.id, + }); + + const runs = await querier.selectChatRuns({ + chatID: chat.id, + }); + expect(runs.items.length).toBe(1); + expect(runs.items[0].status).toBe("streaming"); + + const newChat = await querier.selectChatByID({ id: chat.id }); + expect(newChat?.last_run_number).toBe(1); + expect(newChat?.status).toBe("streaming"); + }); + + test("multiple runs are created when behavior=interrupt", async () => { + const { querier, chat, agent } = await prepareChatStatusTest(); + await querier.reconcileChatRun({ + behavior: "enqueue", + chat_id: chat.id, + agent_id: agent.id, + }); + await querier.reconcileChatRun({ + behavior: "interrupt", + chat_id: chat.id, + agent_id: agent.id, + }); + + const runs = await querier.selectChatRuns({ + chatID: chat.id, + }); + expect(runs.items.length).toBe(2); + expect(runs.items[0].status).toBe("streaming"); + expect(runs.items[1].status).toBe("interrupted"); + + const newChat = await querier.selectChatByID({ id: chat.id }); + expect(newChat?.last_run_number).toBe(2); + expect(newChat?.status).toBe("streaming"); + }); + + test("chat run step status is accurate", async () => { + const { querier, chat, agent } = await prepareChatStatusTest(); + await querier.reconcileChatRun({ + behavior: "interrupt", + chat_id: chat.id, + agent_id: agent.id, + }); + + const ensureStatus = async (status: ChatRunStepStatus) => { + const latestRun = await querier.selectLatestChatRun(chat.id); + expect(latestRun.run).toBeDefined(); + expect(latestRun.step).toBeDefined(); + expect(latestRun.step?.status).toBe(status); + }; + + await ensureStatus("streaming"); + const { step } = await querier.selectLatestChatRun(chat.id); + if (!step) { + throw new Error("No step found"); + } + const oldHeartbeat = new Date(0); + await querier.updateChatRunStep({ + id: step.id, + error: "test error", + completed_at: new Date(), + interrupted_at: new Date(), + // Even with the oldest heartbeat, this is still an error step. + heartbeat_at: oldHeartbeat, + }); + await ensureStatus("error"); + + await querier.updateChatRunStep({ + id: step.id, + error: null, + completed_at: new Date(), + interrupted_at: new Date(), + heartbeat_at: new Date(), + }); + await ensureStatus("interrupted"); + + await querier.updateChatRunStep({ + id: step.id, + error: null, + completed_at: new Date(), + interrupted_at: null, + heartbeat_at: new Date(), + }); + await ensureStatus("completed"); + + await querier.updateChatRunStep({ + id: step.id, + error: null, + completed_at: null, + interrupted_at: null, + heartbeat_at: oldHeartbeat, + }); + await ensureStatus("stalled"); + + await querier.updateChatRunStep({ + id: step.id, + error: null, + completed_at: null, + interrupted_at: null, + heartbeat_at: new Date(), + }); + // Ensure that we're back to streaming if all is well. + await ensureStatus("streaming"); + }); + + // When the latest step is stalled, it should recover with a new run. + test("recovers from stalled step", async () => { + const { querier, chat, agent } = await prepareChatStatusTest(); + await querier.reconcileChatRun({ + behavior: "interrupt", + chat_id: chat.id, + agent_id: agent.id, + }); + + const { step } = await querier.selectLatestChatRun(chat.id); + if (!step) { + throw new Error("No step found"); + } + await querier.updateChatRunStep({ + id: step.id, + heartbeat_at: new Date(0), + }); + let latestRun = await querier.selectLatestChatRun(chat.id); + expect(latestRun.run).toBeDefined(); + expect(latestRun.step).toBeDefined(); + expect(latestRun.step?.status).toBe("stalled"); + + await querier.reconcileChatRun({ + behavior: "enqueue", + chat_id: chat.id, + agent_id: agent.id, + }); + + latestRun = await querier.selectLatestChatRun(chat.id); + expect(latestRun.run).toBeDefined(); + expect(latestRun.step).toBeDefined(); + expect(latestRun.step?.status).toBe("streaming"); + + const runs = await querier.selectChatRuns({ + chatID: chat.id, + }); + expect(runs.items.length).toBe(2); + expect(runs.items[0].status).toBe("streaming"); + expect(runs.items[1].status).toBe("error"); + }); +}); + +test("parallel transactions", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + const promises: Promise[] = []; + for (let i = 0; i < 10; i++) { + promises.push( + // This performs a transaction internally. + querier.insertUser({ + display_name: "test", + email: `${crypto.randomUUID()}@test.com`, + email_verified: new Date(), + password: null, + }) + ); + } + const results = await Promise.all(promises); + expect(results.length).toBe(10); + + console.log(results); +}); + +test("new user flow improvements", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + // Test 1: Username should not have -personal-org suffix + const user1 = await querier.insertUser({ + email: "john.doe@example.com", + display_name: "John Doe", + email_verified: new Date(), + password: null, + }); + + expect(user1.username).toBe("johndoe"); + expect(user1.username).not.toContain("personal-org"); + + // Test 2: Avatar URL from OAuth should be set on organization + const user2 = await querier.insertUser({ + email: "jane.smith@example.com", + display_name: "Jane Smith", + email_verified: new Date(), + password: null, + avatar_url: "https://example.com/avatar.png", + }); + + expect(user2.avatar_url).toBe("https://example.com/avatar.png"); + expect(user2.username).toBe("janesmith"); + expect(user2.username).not.toContain("personal-org"); + + // Test 3: Email-based username generation (without display name) + const user3 = await querier.insertUser({ + email: "cool-username@example.com", + display_name: null, + email_verified: new Date(), + password: null, + }); + + expect(user3.username).toBe("cool-username"); + expect(user3.username).not.toContain("personal-org"); +}); + +test("reserved usernames cannot be used", async () => { + const url = await createPostgresURL(); + const querier = new Querier(await connectToPostgres(url)); + + // Test 1: Direct user creation with reserved username should fail + await expect( + querier.insertUser({ + email: "user@example.com", + display_name: "API User", + email_verified: new Date(), + password: null, + username: "api", + }) + ).rejects.toThrow('Username "api" is reserved and cannot be used.'); + + // Test 2: Direct team creation with reserved name should fail + const user = await createTestUser(querier); + await expect( + querier.insertOrganizationWithMembership({ + name: "help", + created_by: user.id, + kind: "organization", + }) + ).rejects.toThrow('Username "help" is reserved and cannot be used.'); + + // Test 3: Organization creation with reserved name should fail + await expect( + querier.insertOrganizationWithMembership({ + name: "docs", + created_by: user.id, + kind: "organization", + }) + ).rejects.toThrow('Username "docs" is reserved and cannot be used.'); + + // Test 4: Team update with reserved name should fail + const team = await createTestOrganization(querier, { created_by: user.id }); + await expect( + querier.updateOrganizationByID(team.id, { name: "auth" }) + ).rejects.toThrow('Username "auth" is reserved and cannot be used.'); + + // Test 5: Auto-generated username that collides with reserved name should skip it + const userWithReservedDisplayName = await querier.insertUser({ + email: "help@example.com", + display_name: "Help", + email_verified: new Date(), + password: null, + }); + + // Should have generated a different username (not "help") + expect(userWithReservedDisplayName.username).not.toBe("help"); + expect(userWithReservedDisplayName.username).toMatch(/^help-\d+$/); +}); diff --git a/packages/database/src/querier.ts b/packages/database/src/querier.ts new file mode 100644 index 0000000..fa4fdc1 --- /dev/null +++ b/packages/database/src/querier.ts @@ -0,0 +1,3521 @@ +import { + and, + asc, + countDistinct, + desc, + DrizzleQueryError, + eq, + getTableColumns, + getViewSelectedFields, + gte, + ilike, + inArray, + isNotNull, + isNull, + like, + lte, + not, + or, + SQL, + sql, +} from "drizzle-orm"; +import type { + PgColumn, + PgDatabase, + PgInsertValue, + PgSelect, + PgTable, +} from "drizzle-orm/pg-core"; +import postgres from "postgres"; +import { decryptValue, encryptValue, getMasterKey } from "./encryption"; +import type { FieldFilterGroup } from "./observability/filters"; +import { + getAgentLogs as getAgentLogsImpl, + type AgentLog as ObservabilityAgentLog, + writeAgentLog as writeAgentLogImpl, +} from "./observability/logs"; +import { + type OtelSpan, + readTraces, + type ReadTracesOpts, + writeTraces, +} from "./observability/traces"; +import { + type Agent, + agent, + agent_deployment, + agent_deployment_target, + agent_environment_variable, + agent_permission, + agent_pin, + agent_storage_kv, + type AgentDeployment, + type AgentEnvDeploymentTarget, + type AgentEnvironmentVariable, + type AgentPermission, + type AgentPermissionLevel, + type AgentWithPinned, + api_key, + type ApiKey, + type Chat, + chat, + chat_run, + chat_run_step, + chat_run_step_with_status, + chat_run_with_status, + chat_user_state, + chat_with_status, + type ChatRun, + type ChatRunStep, + ChatRunStepStalledDurationSQL, + type ChatRunStepStatus, + type ChatStatus, + type ChatWithStatusAndAgent, + type DBMessage, + email_verification, + type EmailVerification, + file, + type File, + message, + type Organization, + organization, + organization_billing_usage_event, + organization_invite, + organization_membership, + type OrganizationBillingUsageEvent, + type OrganizationInvite, + type OrganizationMembership, + type OrganizationWithMembership, + type User, + user, + user_account, + user_with_personal_organization, + type UserAccount, + type UserWithPersonalOrganization, +} from "./schema"; +import { reserved_usernames } from "./shared"; + +export default class Querier { + private db: PgDatabase; + private inTx: boolean = false; + + public constructor(private readonly conn: PgDatabase) { + this.db = conn; + } + + // insertUser inserts a new user into the database. + public async insertUser( + newUser: Omit & { + early_access?: boolean; + username?: string; + avatar_url?: string | null; + } + ): Promise { + let createdUser: User; + let createdOrganization: Organization; + let attempt = 0; + // Extract avatar_url from newUser since it doesn't belong in the user table + const { avatar_url, ...userValues } = newUser; + while (true) { + let username = newUser.username; + if (!username) { + username = generateUsername({ + displayName: newUser.display_name ?? undefined, + email: newUser.email ?? undefined, + suffix: attempt === 0 ? undefined : attempt.toString(), + }); + } + + // Check if username is reserved + if (reserved_usernames.has(username)) { + if (newUser.username) { + // If user explicitly requested a reserved username, reject it + throw new Error( + `Username "${username}" is reserved and cannot be used.` + ); + } + // If auto-generated, try next attempt + attempt++; + if (attempt > 100) { + throw new Error("Failed to create user due to name collision."); + } + continue; + } + + try { + [createdUser, createdOrganization] = await this.tx(async (tx) => { + const createdUser = await tx.db + .insert(user) + .values(userValues) + .returning() + .then((res) => res[0]!); + + // Insert a personal organization for the user. + const createdOrganization = await tx.db + .insert(organization) + .values({ + name: username, + avatar_url: avatar_url ?? null, + created_by: createdUser.id, + kind: "personal", + personal_owner_user_id: createdUser.id, + }) + .returning() + .then((res) => res[0]!); + + // Add the user as an owner to the personal organization. + await tx.db.insert(organization_membership).values({ + organization_id: createdOrganization.id, + user_id: createdUser.id, + role: "owner", + }); + + return [createdUser, createdOrganization]; + }); + break; + } catch (err) { + if ( + !newUser.username && + err instanceof DrizzleQueryError && + err.cause instanceof postgres.PostgresError && + err.cause.code === "23505" + ) { + attempt++; + if (attempt > 100) { + throw new Error("Failed to create user due to name collision."); + } + continue; + } + throw err; + } + } + + return { + ...createdUser, + organization_id: createdOrganization.id, + username: createdOrganization.name, + avatar_url: createdOrganization.avatar_url, + }; + } + + // selectUserByID fetches a user by their ID. + public async selectUserByID( + id: string + ): Promise { + return this.db + .select() + .from(user_with_personal_organization) + .where(eq(user_with_personal_organization.id, id)) + .then((res) => res[0]); + } + + // selectUserByEmail fetches a user by their email address. + // Email is a unique key on users. + public async selectUserByEmail(email: string): Promise { + return this.db + .select() + .from(user) + .where(eq(user.email, email)) + .then((res) => res[0]); + } + + // deleteUserByID deletes a user by their ID. Related data is deleted via CASCADE constraints. + public async deleteUserByID(id: string): Promise { + const [deletedUser] = await this.db + .delete(user) + .where(eq(user.id, id)) + .returning(); + + return deletedUser; + } + + // updateUserByID updates a user by their ID with partial data. + public async updateUserByID( + data: Partial & Pick + ): Promise { + if (!data.id) { + throw new Error("No user id."); + } + + const [result] = await this.db + .update(user) + .set(data) + .where(eq(user.id, data.id)) + .returning(); + if (!result) { + throw new Error("No user found."); + } + return result; + } + + // upsertUserAccount upserts a user account. + // This is used to link login accounts to users (e.g. "Sign in with Google"). + public async upsertUserAccount(data: UserAccount): Promise { + await this.db + .insert(user_account) + .values(data) + .onConflictDoUpdate({ + target: [user_account.provider, user_account.provider_account_id], + set: data, + }); + } + + // selectUserAccountByProviderAccountID fetches a user account by their provider and account ID. + // Returns both the account and associated user information. + public async selectUserAccountByProviderAccountID( + provider: UserAccount["provider"], + accountID: string + ): Promise<{ user_account: UserAccount; user: User } | undefined> { + const result = await this.db + .select({ + user_account, + user, + }) + .from(user_account) + .innerJoin(user, eq(user_account.user_id, user.id)) + .where( + and( + eq(user_account.provider, provider), + eq(user_account.provider_account_id, accountID) + ) + ) + .then((res) => res[0]); + return result; + } + + // deleteUserAccountByProviderAccountId removes a user account by provider and account ID. + public async deleteUserAccountByProviderAccountID( + params: Pick + ): Promise { + await this.db + .delete(user_account) + .where( + and( + eq(user_account.provider, params.provider), + eq(user_account.provider_account_id, params.provider_account_id) + ) + ); + } + + // selectUserAccountsByProviderAndUserId fetches all user accounts for a user by provider. + public async selectUserAccountsByProviderAndUserID( + provider: UserAccount["provider"], + userID: string + ): Promise { + return this.db + .select() + .from(user_account) + .where( + and( + eq(user_account.provider, provider), + eq(user_account.user_id, userID) + ) + ); + } + + // selectOrganizationByID fetches an organization by its ID. + public async selectOrganizationByID( + organizationID: string + ): Promise { + return this.db + .select() + .from(organization) + .where(eq(organization.id, organizationID)) + .then((res) => res[0]); + } + + // selectOrganizationMembershipsByUserID fetches all organization memberships for a user. + public async selectOrganizationMembershipsByUserID(userId: string): Promise< + Array<{ + organization_membership: OrganizationMembership; + organization: Organization; + }> + > { + return this.db + .select() + .from(organization_membership) + .innerJoin( + organization, + eq(organization_membership.organization_id, organization.id) + ) + .where(eq(organization_membership.user_id, userId)) + .then((v) => + v.map((v) => ({ + organization_membership: v.organization_membership, + organization: v.organization, + })) + ); + } + + // selectOrganizationMembershipByUserIDAndOrganizationID fetches a specific organization membership for a user. + public async selectOrganizationMembershipByUserIDAndOrganizationID( + userId: string, + organizationId: string + ): Promise< + | { + organization_membership: OrganizationMembership; + organization: Organization; + } + | undefined + > { + return this.db + .select() + .from(organization_membership) + .innerJoin( + organization, + eq(organization_membership.organization_id, organization.id) + ) + .where( + and( + eq(organization_membership.user_id, userId), + eq(organization_membership.organization_id, organizationId) + ) + ) + .then((res) => res[0]) + .then((res) => + res + ? { + organization_membership: res.organization_membership, + organization: res.organization, + } + : undefined + ); + } + + // updateOrganizationByID updates organization information by organization ID. + // updateOrganizationByID updates organization information by organization ID. + public async updateOrganizationByID( + organizationId: string, + updates: { + name?: string; + avatar_url?: string | null; + custom_instructions?: string | null; + stripe_customer_id?: string | null; + metronome_customer_id?: string | null; + metronome_contract_id?: string | null; + billing_entitled_at?: Date | null; + } + ): Promise { + // Check if the new name is reserved + if (updates.name && reserved_usernames.has(updates.name)) { + throw new Error( + `Username "${updates.name}" is reserved and cannot be used.` + ); + } + + return this.db + .update(organization) + .set(updates) + .where(eq(organization.id, organizationId)) + .returning() + .then((res) => res[0]); + } + + // updateOrganizationEntitlement updates the entitlement status for an organization. + public async updateOrganizationEntitlement( + organizationId: string, + isBillingEntitled: boolean + ): Promise { + return this.db + .update(organization) + .set({ billing_entitled_at: isBillingEntitled ? new Date() : null }) + .where(eq(organization.id, organizationId)) + .returning() + .then((res) => res[0]); + } + + // deleteOrganizationMembershipByUserIDAndOrganizationID removes a user from an organization. + public async deleteOrganizationMembershipByUserIDAndOrganizationID( + userId: string, + organizationId: string + ): Promise { + return this.db + .delete(organization_membership) + .where( + and( + eq(organization_membership.user_id, userId), + eq(organization_membership.organization_id, organizationId) + ) + ) + .returning() + .then((res) => res[0]); + } + + // updateOrganizationMemberRoleByUserIDAndOrganizationID updates an organization member's role. + public async updateOrganizationMemberRoleByUserIDAndOrganizationID( + organizationId: string, + userId: string, + newRole: "admin" | "member" | "billing_admin" + ): Promise { + return this.db + .update(organization_membership) + .set({ + role: newRole, + updated_at: new Date(), + }) + .where( + and( + eq(organization_membership.organization_id, organizationId), + eq(organization_membership.user_id, userId) + ) + ) + .returning() + .then((res) => res[0]); + } + + // updateOrganizationMemberBillingEmailsOptOutByUserIDAndOrganizationID updates an organization member's billing emails opt out preference. + public async updateOrganizationMemberBillingEmailsOptOutByUserIDAndOrganizationID( + organizationId: string, + userId: string, + optOut: boolean + ): Promise { + return this.db + .update(organization_membership) + .set({ + billing_emails_opt_out: optOut, + updated_at: new Date(), + }) + .where( + and( + eq(organization_membership.organization_id, organizationId), + eq(organization_membership.user_id, userId) + ) + ) + .returning() + .then((res) => res[0]); + } + + // selectOrganizationMembersWithUserInfoByOrganizationID fetches all organization members with their information. + public async selectOrganizationMembersWithUserInfoByOrganizationID( + organizationId: string + ): Promise< + Array<{ + user: { + id: string; + name: string | null; + email: string | null; + image: string | null; + }; + organization_membership: { + role: "owner" | "admin" | "member" | "billing_admin"; + created_at: Date; + }; + }> + > { + return this.db + .select({ + user: { + id: user_with_personal_organization.id, + name: user_with_personal_organization.display_name, + email: user_with_personal_organization.email, + image: user_with_personal_organization.avatar_url, + }, + organization_membership: { + role: organization_membership.role, + created_at: organization_membership.created_at, + }, + }) + .from(organization_membership) + .innerJoin( + user_with_personal_organization, + eq(organization_membership.user_id, user_with_personal_organization.id) + ) + .where(eq(organization_membership.organization_id, organizationId)) + .orderBy(organization_membership.created_at); + } + + // insertOrganizationInvite inserts a new organization invitation. + public async insertOrganizationInvite( + newInvite: Insertable + ): Promise { + // If email is provided, check for existing pending invites + if (newInvite.email) { + const existingInvite = await this.db + .select() + .from(organization_invite) + .where( + and( + eq(organization_invite.organization_id, newInvite.organization_id), + eq(organization_invite.email, newInvite.email), + // Check that invite hasn't expired (handle null expires_at) + sql`(${organization_invite.expires_at} IS NULL OR ${organization_invite.expires_at} > NOW())`, + // For single-use invites, check they haven't been used + sql`(${organization_invite.reusable} = true OR ${organization_invite.last_accepted_at} IS NULL)` + ) + ) + .then((res) => res[0]); + + if (existingInvite) { + throw new Error( + `An active invite already exists for ${newInvite.email}` + ); + } + } + + const createdInvite = await this.db + .insert(organization_invite) + .values({ + ...newInvite, + code: crypto.randomUUID(), + }) + .returning() + .then((res) => res[0]!); + + return createdInvite; + } + + // selectOrganizationInviteWithOrganizationByToken fetches an organization invite by its token with organization info. + public async selectOrganizationInviteWithOrganizationByToken( + code: string + ): Promise< + | { + organization_invite: OrganizationInvite; + organization: Organization; + } + | undefined + > { + return this.db + .select() + .from(organization_invite) + .innerJoin( + organization, + eq(organization_invite.organization_id, organization.id) + ) + .where(eq(organization_invite.code, code)) + .then((res) => + res[0] + ? { + organization_invite: res[0].organization_invite, + organization: res[0].organization, + } + : undefined + ); + } + + // selectOrganizationInvitesByOrganizationID fetches all pending invites for an organization. + public async selectOrganizationInvitesByOrganizationID( + organizationId: string + ): Promise { + return this.db + .select() + .from(organization_invite) + .where(eq(organization_invite.organization_id, organizationId)) + .orderBy(desc(organization_invite.created_at)); + } + + // selectAllReusableOrganizationInvitesByOrganizationID fetches all reusable invites for an organization. + public async selectAllReusableOrganizationInvitesByOrganizationID( + organizationId: string + ): Promise { + return this.db + .select() + .from(organization_invite) + .where( + and( + eq(organization_invite.organization_id, organizationId), + eq(organization_invite.reusable, true) + ) + ) + .orderBy(desc(organization_invite.created_at)); + } + + // deleteReusableOrganizationInvitesByOrganizationID removes all reusable invites for an organization. + public async deleteReusableOrganizationInvitesByOrganizationID( + organizationId: string + ): Promise { + await this.db + .delete(organization_invite) + .where( + and( + eq(organization_invite.organization_id, organizationId), + eq(organization_invite.reusable, true) + ) + ); + } + + // acceptOrganizationInviteByIDAndUserID processes an organization invite acceptance and adds the user to the organization. + public async acceptOrganizationInviteByIDAndUserID( + inviteId: string, + userId: string + ): Promise { + const invite = await this.db + .select() + .from(organization_invite) + .where(eq(organization_invite.id, inviteId)) + .then((res) => res[0]); + + if (!invite) { + throw new Error("Invite not found"); + } + + // Check if invite is expired (handle null expires_at) + if (invite.expires_at && new Date() > invite.expires_at) { + throw new Error("Invite has expired"); + } + + // Check if invite is single-use and already used + if (!invite.reusable && invite.last_accepted_at) { + throw new Error("Invite has already been used"); + } + + // Check if user is already a member of the organization + const existingMembership = await this.db + .select() + .from(organization_membership) + .where( + and( + eq(organization_membership.organization_id, invite.organization_id), + eq(organization_membership.user_id, userId) + ) + ) + .then((res) => res[0]); + + if (existingMembership) { + throw new Error("You are already a member of this organization"); + } + + // Add user to organization + const [membership] = await this.db + .insert(organization_membership) + .values({ + organization_id: invite.organization_id, + user_id: userId, + role: invite.role, + }) + .returning(); + + // Update invite with last_accepted_at + await this.db + .update(organization_invite) + .set({ last_accepted_at: new Date() }) + .where(eq(organization_invite.id, invite.id)); + + return membership!; + } + + // updateOrganizationInviteLastAcceptedAtByID marks an organization invite as accepted now. + public async updateOrganizationInviteLastAcceptedAtByID( + inviteId: string + ): Promise { + await this.db + .update(organization_invite) + .set({ last_accepted_at: new Date() }) + .where(eq(organization_invite.id, inviteId)); + } + + // deleteOrganizationInviteByID removes an organization invite. + public async deleteOrganizationInviteByID( + inviteId: string + ): Promise { + return this.db + .delete(organization_invite) + .where(eq(organization_invite.id, inviteId)) + .returning() + .then((res) => res[0]); + } + + // insertChat inserts a new chat into the database. + public async insertChat( + // The agent_key is generated by a trigger. + params: Insertable + ): Promise { + return this.db + .insert(chat) + .values({ + ...params, + created_at: params.created_at ?? new Date(), + } as Insertable) + .returning() + .then((r) => r[0]!); + } + + // updateChatByID updates chat properties like title, model, and tools by chat ID. + public async updateChatByID(params: { + id: string; + title?: string; + }): Promise { + // Only include fields that are not undefined + const updates: any = {}; + if (params.title !== undefined) updates.title = params.title; + + return this.db + .update(chat) + .set(updates) + .where(eq(chat.id, params.id)) + .returning(); + } + + // selectChatByID fetches a chat by its ID. + public async selectChatByID(params: { + id: string; + }): Promise { + const { updated_at, ...rest } = getViewSelectedFields(chat_with_status); + const [selectedChat] = await this.db + .select({ + ...rest, + chat_updated_at: sql`"chat_with_status"."updated_at"`.as( + "chat_updated_at" + ), + agent: getTableColumns(agent), + }) + .from(chat_with_status) + .innerJoin(agent, eq(chat_with_status.agent_id, agent.id)) + .where(eq(chat_with_status.id, params.id)); + return selectedChat + ? { + ...selectedChat, + agent: selectedChat.agent, + updated_at: parseDbTimestamp(selectedChat.chat_updated_at), + } + : undefined; + } + + // deleteChatByID deletes a chat and all associated data by chat ID. + // Related data is automatically deleted via CASCADE DELETE constraints. + public async deleteChatByID(id: string): Promise { + await this.db.delete(chat).where(eq(chat.id, id)); + } + + // updateChatVisibilityByID updates the visibility setting of a chat by chat ID. + public async updateChatVisibilityByID(params: { + chatId: string; + visibility: "private" | "public" | "organization"; + }): Promise { + await this.db + .update(chat) + .set({ visibility: params.visibility }) + .where(eq(chat.id, params.chatId)); + } + + // upsertChatUserState updates or creates chat user state for read tracking. + public async upsertChatUserState( + chatId: string, + userId: string, + updates: { + last_read_at?: Date; + } + ): Promise { + await this.db + .insert(chat_user_state) + .values({ chat_id: chatId, user_id: userId, ...updates }) + .onConflictDoUpdate({ + target: [chat_user_state.chat_id, chat_user_state.user_id], + set: updates, + }); + } + + // insertMessages inserts multiple messages into the database. + public async insertMessages({ + messages, + }: { + messages: Insertable[]; + }): Promise> { + return this.db + .insert(message) + .values( + messages.map((message) => ({ + ...message, + created_at: message.created_at ?? new Date(), + })) + ) + .returning(); + } + + // selectMessageByID fetches a single message by its ID. + public async selectMessageByID(params: { + id: string; + }): Promise { + return this.db + .select() + .from(message) + .where(eq(message.id, params.id)) + .then((res) => res[0]); + } + + public async selectFilesByIDs(ids: string[]): Promise { + return this.db.select().from(file).where(inArray(file.id, ids)); + } + + public async selectFileByID(id: string): Promise { + return this.db + .select() + .from(file) + .where(eq(file.id, id)) + .then((res) => res[0]); + } + public async insertFile( + toCreate: Omit + ): Promise { + return this.db + .insert(file) + .values(toCreate) + .returning() + .then((res) => res[0]!); + } + + public async insertEmailVerification({ + email, + code, + expiresAt, + }: { + email: string; + code: string; + expiresAt: Date; + }): Promise { + return this.db + .insert(email_verification) + .values({ + email, + code, + expires_at: expiresAt, + }) + .returning() + .then((res) => res[0]!); + } + + public async selectAndDeleteEmailVerificationByCode({ + email, + code, + }: { + email: string; + code: string; + }): Promise { + return this.db + .delete(email_verification) + .where( + and( + eq(email_verification.email, email), + eq(email_verification.code, code) + ) + ) + .returning() + .then((res) => res[0]); + } + + public async selectApiKeysByUserId(userId: string): Promise { + return this.db + .select() + .from(api_key) + .where(and(eq(api_key.user_id, userId), isNull(api_key.revoked_at))) + .orderBy(desc(api_key.created_at)); + } + + public async selectApiKeyByID(id: string): Promise { + return this.db + .select() + .from(api_key) + .where(eq(api_key.id, id)) + .limit(1) + .then((res) => res[0] || null); + } + + public async selectApiKeyByLookup(keyLookup: string): Promise { + const result = await this.db + .select() + .from(api_key) + .where(and(eq(api_key.key_lookup, keyLookup), isNull(api_key.revoked_at))) + .limit(1); + return result[0] || null; + } + + public async insertApiKey( + data: Omit< + ApiKey, + | "id" + | "created_at" + | "updated_at" + | "last_used_at" + | "revoked_at" + | "revoked_by" + > + ): Promise { + const result = await this.db.insert(api_key).values(data).returning(); + return result[0]!; + } + + public async updateApiKey( + id: string, + data: Partial> + ): Promise { + const result = await this.db + .update(api_key) + .set({ + ...data, + updated_at: new Date(), + }) + .where(eq(api_key.id, id)) + .returning(); + return result[0] || null; + } + + public async selectOrganizationByStripeCustomerID( + stripeCustomerId: string + ): Promise { + const rows = await this.db + .select() + .from(organization) + .where(eq(organization.stripe_customer_id, stripeCustomerId)); + + return rows?.[0] as Organization | undefined; + } + + public async selectOrganizationByMetronomeCustomerID( + metronomeCustomerId: string + ): Promise { + const rows = await this.db + .select() + .from(organization) + .where(eq(organization.metronome_customer_id, metronomeCustomerId)); + + return rows?.[0] as Organization | undefined; + } + + public async selectAdminBillingEmailRecipientsByOrganizationID( + organizationId: string + ): Promise> { + const results = await this.db + .select({ + id: user.id, + email: user.email, + }) + .from(organization_membership) + .innerJoin(user, eq(organization_membership.user_id, user.id)) + .where( + and( + eq(organization_membership.organization_id, organizationId), + inArray(organization_membership.role, [ + "owner", + "admin", + "billing_admin", + ]), + eq(organization_membership.billing_emails_opt_out, false), + not(isNull(user.email)) + ) + ); + + return results + .filter((row) => row.email !== null) + .map((row) => ({ id: row.id, email: row.email as string })); + } + + public async selectOrganizationsForUser({ + userID, + }: { + userID: string; + }): Promise { + const rows = await this.db + .select() + .from(organization) + .innerJoin( + organization_membership, + eq(organization.id, organization_membership.organization_id) + ) + .where(eq(organization_membership.user_id, userID)); + + return rows.map((row) => ({ + ...row.organization, + membership: row.organization_membership, + })); + } + + public async selectOrganizationForUser( + params: + | { + organizationID: string; + userID: string; + } + | { + organizationName: string; + userID: string; + } + ): Promise { + let where: SQL | undefined; + if ("organizationID" in params) { + where = and( + eq(organization_membership.user_id, params.userID), + eq(organization.id, params.organizationID) + ); + } else { + where = and( + eq(organization_membership.user_id, params.userID), + ilike(organization.name, params.organizationName) + ); + } + + const [row] = await this.db + .select() + .from(organization) + .leftJoin( + organization_membership, + eq(organization.id, organization_membership.organization_id) + ) + .where(where); + if (!row) { + return undefined; + } + return { + ...row.organization, + membership: row.organization_membership ?? undefined, + }; + } + + public async selectAgentByNameForUser(params: { + organizationName: string; + agentName: string; + userID?: string; + }): Promise { + const [row] = await this.db + .select({ + ...getTableColumns(agent), + pinned: sql`${agent_pin.id} is not null`.as("pinned"), + }) + .from(agent) + .innerJoin(organization, eq(agent.organization_id, organization.id)) + .leftJoin( + agent_pin, + and( + eq(agent_pin.agent_id, agent.id), + params.userID ? eq(agent_pin.user_id, params.userID) : undefined + ) + ) + .where( + and( + eq(agent.name, params.agentName), + ilike(organization.name, params.organizationName) + ) + ); + return row; + } + + public async selectAgentByOrganizationIDAndName(params: { + organizationID: string; + name: string; + }): Promise { + const [row] = await this.db + .select() + .from(agent) + .where( + and( + eq(agent.organization_id, params.organizationID), + eq(agent.name, params.name) + ) + ); + return row; + } + + public async selectAgentDailyChats({ agentID }: { agentID: string }) { + let rows = await this.db.execute(sql` + WITH bounds AS ( + SELECT date_trunc('day', now() - interval '29 days') AS start_ts, + date_trunc('day', now()) AS end_ts + ), + series AS ( + SELECT generate_series(start_ts, end_ts, interval '1 day') AS bucket + FROM bounds + ), + agg AS ( + SELECT date_bin('1 day', ${chat_run_step.started_at}, timestamptz '1970-01-01') AS bucket, + COUNT(DISTINCT ${chat_run_step.chat_id}) AS unique_chats + FROM ${chat_run_step} + WHERE ${chat_run_step.agent_id} = ${agentID} + AND ${chat_run_step.started_at} >= (SELECT start_ts FROM bounds) + GROUP BY 1 + ) + SELECT s.bucket AS interval, COALESCE(a.unique_chats, 0) AS unique_chats + FROM series s + LEFT JOIN agg a USING (bucket) + ORDER BY s.bucket; + `); + + // For some reason in Neon this works differently than locally... + if ("rows" in rows) { + rows = rows.rows; + } + + return rows.map((r: { interval: string; unique_chats: number }) => ({ + interval: new Date(r.interval).toISOString(), + unique_chats: Number(r.unique_chats), + })); + } + + public async selectAgentDailyChatsForOrganization({ + organizationID, + }: { + organizationID: string; + }) { + let rows = await this.db.execute(sql` + WITH bounds AS ( + SELECT date_trunc('day', now() - interval '6 days') AS start_ts, + date_trunc('day', now()) AS end_ts + ), + series AS ( + SELECT generate_series(start_ts, end_ts, interval '1 day') AS bucket + FROM bounds + ), + org_agents AS ( + SELECT ${agent.id} as agent_id + FROM ${agent} + WHERE ${agent.organization_id} = ${organizationID} + ), + agg AS ( + SELECT ${chat_run_step.agent_id}, + date_bin('1 day', ${chat_run_step.started_at}, timestamptz '1970-01-01') AS bucket, + COUNT(DISTINCT ${chat_run_step.chat_id}) AS unique_chats + FROM ${chat_run_step} + INNER JOIN org_agents ON org_agents.agent_id = ${chat_run_step.agent_id} + WHERE ${chat_run_step.started_at} >= (SELECT start_ts FROM bounds) + GROUP BY 1, 2 + ), + daily_series AS ( + SELECT org_agents.agent_id, s.bucket + FROM org_agents + CROSS JOIN series s + ) + SELECT ds.agent_id, ds.bucket AS interval, COALESCE(a.unique_chats, 0) AS unique_chats + FROM daily_series ds + LEFT JOIN agg a ON a.agent_id = ds.agent_id AND a.bucket = ds.bucket + ORDER BY ds.agent_id, ds.bucket; + `); + + // For some reason in Neon this works differently than locally... + if ("rows" in rows) { + rows = rows.rows; + } + + // Group by agent_id + const result = new Map< + string, + Array<{ interval: string; unique_chats: number }> + >(); + + for (const r of rows as Array<{ + agent_id: string; + interval: string; + unique_chats: number; + }>) { + if (!result.has(r.agent_id)) { + result.set(r.agent_id, []); + } + result.get(r.agent_id)!.push({ + interval: new Date(r.interval).toISOString(), + unique_chats: Number(r.unique_chats), + }); + } + + return result; + } + + public async selectAgentIntervalStats({ + agentID, + since, + }: { + agentID: string; + since: Date; + }) { + const intervalExpr = sql`date_bin(interval '15 minutes', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + unique_chats: countDistinct(chat_run_step.chat_id), + unique_steps: countDistinct(chat_run_step.id), // total unique steps (i.e., total rows) + error_steps: sql`count(*) filter (where ${chat_run_step.error} is not null)`, + completed_steps: sql`count(*) filter (where ${chat_run_step.completed_at} is not null)`, + tool_calls_total: sql`sum(${chat_run_step.tool_calls_total})`, + tool_calls_completed: sql`sum(${chat_run_step.tool_calls_completed})`, + tool_calls_errored: sql`sum(${chat_run_step.tool_calls_errored})`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, since) + ) + ) + .groupBy(chat_run_step.agent_id, intervalExpr) + .orderBy(intervalExpr); + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + unique_chats: r.unique_chats, + unique_steps: r.unique_steps, + error_steps: Number(r.error_steps), + completed_steps: Number(r.completed_steps), + tool_calls_total: Number(r.tool_calls_total), + tool_calls_completed: Number(r.tool_calls_completed), + tool_calls_errored: Number(r.tool_calls_errored), + })); + } + + public async selectAgentDailyChatsRange({ + agentID, + startDate, + endDate, + }: { + agentID: string; + startDate: Date; + endDate: Date; + }) { + const intervalExpr = sql`date_bin(interval '1 day', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + unique_chats: countDistinct(chat_run_step.chat_id), + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate) + ) + ) + .groupBy(intervalExpr) + .orderBy(intervalExpr); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + unique_chats: r.unique_chats, + })); + } + + public async selectAgentTokenUsageStats({ + agentID, + startDate, + endDate, + }: { + agentID: string; + startDate: Date; + endDate: Date; + }) { + const result = await this.db + .select({ + total_input_tokens: sql`sum(${chat_run_step.usage_total_input_tokens})`, + total_output_tokens: sql`sum(${chat_run_step.usage_total_output_tokens})`, + total_cached_tokens: sql`sum(${chat_run_step.usage_total_cached_input_tokens})`, + avg_ttft_ms: sql`avg(${chat_run_step.time_to_first_token_micros}) / 1000`, + models: sql< + string[] + >`array_agg(distinct ${chat_run_step.usage_model}) filter (where ${chat_run_step.usage_model} is not null)`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate) + ) + ); + + if (!result[0]) { + return { + total_input_tokens: 0, + total_output_tokens: 0, + total_cached_tokens: 0, + avg_ttft_ms: 0, + models: [], + }; + } + + return { + total_input_tokens: Number(result[0].total_input_tokens || 0), + total_output_tokens: Number(result[0].total_output_tokens || 0), + total_cached_tokens: Number(result[0].total_cached_tokens || 0), + avg_ttft_ms: Number(result[0].avg_ttft_ms || 0), + models: result[0].models || [], + }; + } + + public async selectAgentRuntimeDailySummary({ + agentID, + startDate, + endDate, + }: { + agentID: string; + startDate: Date; + endDate: Date; + }) { + const intervalExpr = sql`date_bin(interval '1 day', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + runtime_seconds: sql`sum(extract(epoch from (coalesce(${chat_run_step.completed_at}, ${chat_run_step.interrupted_at}, now()) - ${chat_run_step.started_at})))`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate) + ) + ) + .groupBy(intervalExpr) + .orderBy(intervalExpr); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + runtime_seconds: Number(r.runtime_seconds || 0), + })); + } + + public async selectAgentTokenUsageByModelDaily({ + agentID, + startDate, + endDate, + }: { + agentID: string; + startDate: Date; + endDate: Date; + }) { + const intervalExpr = sql`date_bin(interval '1 day', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + model: chat_run_step.usage_model, + input_tokens: sql`sum(${chat_run_step.usage_total_input_tokens})`, + output_tokens: sql`sum(${chat_run_step.usage_total_output_tokens})`, + cached_tokens: sql`sum(${chat_run_step.usage_total_cached_input_tokens})`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate), + isNotNull(chat_run_step.usage_model) + ) + ) + .groupBy(intervalExpr, chat_run_step.usage_model) + .orderBy(intervalExpr, chat_run_step.usage_model); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + model: r.model!, + input_tokens: Number(r.input_tokens || 0), + output_tokens: Number(r.output_tokens || 0), + cached_tokens: Number(r.cached_tokens || 0), + })); + } + + public async selectAgentTTFTByModelDaily({ + agentID, + startDate, + endDate, + }: { + agentID: string; + startDate: Date; + endDate: Date; + }) { + const intervalExpr = sql`date_bin(interval '1 day', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + model: chat_run_step.usage_model, + avg_ttft_ms: sql`avg(${chat_run_step.time_to_first_token_micros}) / 1000`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate), + isNotNull(chat_run_step.usage_model), + isNotNull(chat_run_step.time_to_first_token_micros) + ) + ) + .groupBy(intervalExpr, chat_run_step.usage_model) + .orderBy(intervalExpr, chat_run_step.usage_model); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + model: r.model!, + avg_ttft_ms: Number(r.avg_ttft_ms || 0), + })); + } + + public async selectAgentChatsWithGranularity({ + agentID, + startDate, + endDate, + granularity, + }: { + agentID: string; + startDate: Date; + endDate: Date; + granularity: "1 hour" | "1 day"; + }) { + const intervalExpr = sql`date_bin(interval '${sql.raw(granularity)}', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + unique_chats: countDistinct(chat_run_step.chat_id), + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate) + ) + ) + .groupBy(intervalExpr) + .orderBy(intervalExpr); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + unique_chats: r.unique_chats, + })); + } + + public async selectAgentRuntimeWithGranularity({ + agentID, + startDate, + endDate, + granularity, + }: { + agentID: string; + startDate: Date; + endDate: Date; + granularity: "1 hour" | "1 day"; + }) { + const intervalExpr = sql`date_bin(interval '${sql.raw(granularity)}', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + runtime_seconds: sql`sum(extract(epoch from (coalesce(${chat_run_step.completed_at}, ${chat_run_step.interrupted_at}, now()) - ${chat_run_step.started_at})))`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate) + ) + ) + .groupBy(intervalExpr) + .orderBy(intervalExpr); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + runtime_seconds: Number(r.runtime_seconds || 0), + })); + } + + public async selectAgentTokenUsageByModelWithGranularity({ + agentID, + startDate, + endDate, + granularity, + }: { + agentID: string; + startDate: Date; + endDate: Date; + granularity: "1 hour" | "1 day"; + }) { + const intervalExpr = sql`date_bin(interval '${sql.raw(granularity)}', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + model: chat_run_step.usage_model, + input_tokens: sql`sum(${chat_run_step.usage_total_input_tokens})`, + output_tokens: sql`sum(${chat_run_step.usage_total_output_tokens})`, + cached_tokens: sql`sum(${chat_run_step.usage_total_cached_input_tokens})`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate), + isNotNull(chat_run_step.usage_model) + ) + ) + .groupBy(intervalExpr, chat_run_step.usage_model) + .orderBy(intervalExpr, chat_run_step.usage_model); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + model: r.model!, + input_tokens: Number(r.input_tokens || 0), + output_tokens: Number(r.output_tokens || 0), + cached_tokens: Number(r.cached_tokens || 0), + })); + } + + public async selectAgentTTFTByModelWithGranularity({ + agentID, + startDate, + endDate, + granularity, + }: { + agentID: string; + startDate: Date; + endDate: Date; + granularity: "1 hour" | "1 day"; + }) { + const intervalExpr = sql`date_bin(interval '${sql.raw(granularity)}', ${chat_run_step.started_at}, timestamptz '1970-01-01 00:00:00+00')`; + + const rows = await this.db + .select({ + interval: intervalExpr, + model: chat_run_step.usage_model, + avg_ttft_ms: sql`avg(${chat_run_step.time_to_first_token_micros}) / 1000`, + }) + .from(chat_run_step) + .where( + and( + eq(chat_run_step.agent_id, agentID), + gte(chat_run_step.started_at, startDate), + lte(chat_run_step.started_at, endDate), + isNotNull(chat_run_step.usage_model), + isNotNull(chat_run_step.time_to_first_token_micros) + ) + ) + .groupBy(intervalExpr, chat_run_step.usage_model) + .orderBy(intervalExpr, chat_run_step.usage_model); + + return rows.map((r) => ({ + interval: new Date(r.interval).toISOString(), + model: r.model!, + avg_ttft_ms: Number(r.avg_ttft_ms || 0), + })); + } + + public async selectOrganizationMembership({ + userID, + organizationID, + }: { + userID: string; + organizationID: string; + }): Promise { + const [row] = await this.db + .select() + .from(organization_membership) + .where( + and( + eq(organization_membership.user_id, userID), + eq(organization_membership.organization_id, organizationID) + ) + ); + return row; + } + + public async insertOrganizationWithMembership( + arg: Insertable + ): Promise { + if (!arg.created_by) { + throw new Error("created_by is required"); + } + + // Check if the organization name is reserved + if ( + arg.name && + typeof arg.name === "string" && + reserved_usernames.has(arg.name) + ) { + throw new Error(`Username "${arg.name}" is reserved and cannot be used.`); + } + + return this.tx(async (tx) => { + const [org] = await tx.db.insert(organization).values(arg).returning(); + if (!org) { + throw new Error("Failed to create organization"); + } + const [membership] = await tx.db + .insert(organization_membership) + .values({ + organization_id: org.id, + user_id: arg.created_by!, + role: "owner", + billing_emails_opt_out: false, + }) + .returning(); + if (!membership) { + throw new Error("Failed to create organization membership"); + } + return { + ...org, + membership, + }; + }); + } + + public async insertOrganizationMembership( + arg: Insertable + ): Promise { + const [membership] = await this.db + .insert(organization_membership) + .values(arg) + .returning(); + return membership!; + } + + public async updateOrganizationInvite( + id: string, + updates: Partial + ): Promise { + const [invite] = await this.db + .update(organization_invite) + .set(updates) + .where(eq(organization_invite.id, id)) + .returning(); + return invite!; + } + + public async deleteOrganization(params: { id: string }): Promise { + await this.db.delete(organization).where(eq(organization.id, params.id)); + } + + public async selectAgentByID(id: string): Promise { + return this.db + .select() + .from(agent) + .where(eq(agent.id, id)) + .then((res) => res[0]); + } + + public async deleteAgent(params: { id: string }): Promise { + await this.db.delete(agent).where(eq(agent.id, params.id)); + } + + public async selectAgentsByOrganizationID( + params: Paginated<{ organizationID: string; userID: string }> + ) { + return withPagination( + this.db + .select({ + ...getTableColumns(agent), + active_deployment_created_by: sql`( + SELECT created_by + FROM ${agent_deployment} + WHERE ${agent_deployment.id} = ${agent.active_deployment_id} + )`.as("active_deployment_created_by"), + active_deployment_created_at: sql`( + SELECT created_at + FROM ${agent_deployment} + WHERE ${agent_deployment.id} = ${agent.active_deployment_id} + )`.as("active_deployment_created_at"), + }) + .from(agent) + .leftJoin( + organization_membership, + and( + eq(agent.organization_id, organization_membership.organization_id), + eq(organization_membership.user_id, params.userID) + ) + ) + .leftJoin( + agent_permission, + and( + eq(agent_permission.agent_id, agent.id), + eq(agent_permission.user_id, params.userID) + ) + ) + .where( + and( + eq(agent.organization_id, params.organizationID), + // Visibility filter: same logic as selectAgentsForUser + // - organization/public: visible to all org members + // - private: visible only to org admins/owners or users with explicit permission + sql`( + ${agent.visibility} IN ('organization', 'public') + OR ( + ${agent.visibility} = 'private' + AND ( + ${organization_membership.role} IN ('owner', 'admin') + OR ${agent_permission.id} IS NOT NULL + ) + ) + )` + ) + ) + .$dynamic(), + // Sort by active deployment time (most recent first), then by agent creation. + sql`active_deployment_created_at DESC NULLS LAST, ${agent.created_at} DESC`, + params + ); + } + + public async deleteAgentPin(params: { + agentID: string; + userID: string; + }): Promise { + await this.db + .delete(agent_pin) + .where( + and( + eq(agent_pin.agent_id, params.agentID), + eq(agent_pin.user_id, params.userID) + ) + ); + } + + public async insertAgentPin(params: Insertable) { + const [created] = await this.db + .insert(agent_pin) + .values(params) + .returning(); + return created!; + } + + public async selectAgentsForUser( + params: Paginated<{ + userID: string; + organizationID?: string; + pinned?: boolean; + }> + ) { + return withPagination( + // Select from all organizations the user is a member of. + // Respects visibility: + // - organization: visible to all org members + // - private: visible only to org admins/owners or users with explicit permission + // - public: visible to everyone (not exposed in UI yet) + this.db + .select({ + ...getTableColumns(agent), + pinned: sql`${agent_pin.id} is not null`.as("pinned"), + pinned_at: sql`${agent_pin.created_at}`.as("pinned_at"), + active_deployment_created_by: sql`( + SELECT created_by + FROM ${agent_deployment} + WHERE ${agent_deployment.id} = ${agent.active_deployment_id} + )`.as("active_deployment_created_by"), + active_deployment_created_at: sql`( + SELECT created_at + FROM ${agent_deployment} + WHERE ${agent_deployment.id} = ${agent.active_deployment_id} + )`.as("active_deployment_created_at"), + }) + .from(agent) + .innerJoin( + organization_membership, + eq(agent.organization_id, organization_membership.organization_id) + ) + .leftJoin( + agent_pin, + and( + eq(agent_pin.agent_id, agent.id), + eq(agent_pin.user_id, params.userID) + ) + ) + .leftJoin( + agent_permission, + and( + eq(agent_permission.agent_id, agent.id), + eq(agent_permission.user_id, params.userID) + ) + ) + .where( + and( + eq(organization_membership.user_id, params.userID), + params.organizationID + ? eq(agent.organization_id, params.organizationID) + : undefined, + typeof params.pinned === "boolean" + ? params.pinned + ? isNotNull(agent_pin.id) + : isNull(agent_pin.id) + : undefined, + // Visibility filter: + // - organization/public: visible to all org members + // - private: visible only to org admins/owners or users with explicit permission + sql`( + ${agent.visibility} IN ('organization', 'public') + OR ( + ${agent.visibility} = 'private' + AND ( + ${organization_membership.role} IN ('owner', 'admin') + OR ${agent_permission.id} IS NOT NULL + ) + ) + )` + ) + ) + .$dynamic(), + sql`pinned DESC, pinned_at DESC NULLS LAST, ${agent.created_at} DESC, ${agent.id} DESC`, + params + ); + } + + public async insertAgent(arg: Insertable) { + const [created] = await this.db.insert(agent).values(arg).returning(); + return created!; + } + + public async insertAgentDeployment( + arg: Insertable + ) { + const [created] = await this.db + .insert(agent_deployment) + .values(arg as Insertable) + .returning(); + return created!; + } + + public async selectAgentDeploymentByIDOrActive({ + agentID, + id, + }: { + agentID: string; + id?: string | null; + }) { + if (id != null) { + return this.db + .select() + .from(agent_deployment) + .where( + and( + eq(agent_deployment.agent_id, agentID), + eq(agent_deployment.id, id) + ) + ) + .limit(1) + .then((res) => res[0] ?? null); + } + + return this.db + .select({ deployment: agent_deployment }) + .from(agent) + .innerJoin( + agent_deployment, + and( + eq(agent.id, agent_deployment.agent_id), + eq(agent.active_deployment_id, agent_deployment.id) + ) + ) + .where(eq(agent.id, agentID)) + .limit(1) + .then((res) => res[0]?.deployment ?? null); + } + + public async selectAgentDeploymentsByAgentID( + opts: Paginated<{ agentID: string }> + ) { + return withPagination( + this.db + .select({ + ...getTableColumns(agent_deployment), + target: agent_deployment_target.target, + }) + .from(agent_deployment) + .where(eq(agent_deployment.agent_id, opts.agentID)) + .innerJoin( + agent_deployment_target, + eq(agent_deployment.target_id, agent_deployment_target.id) + ) + .$dynamic(), + sql`${agent_deployment.number} DESC`, + opts + ); + } + + public async insertAgentEnvironmentVariable( + arg: Insertable + ) { + let values = arg; + + // Always encrypt the value if master key is available + const masterKey = getMasterKey(); + if (arg.value && typeof arg.value === "string" && masterKey) { + const encrypted = await encryptValue(arg.value, masterKey); + values = { + ...arg, + value: null, + encrypted_value: encrypted.encryptedValue.toString("base64"), + encrypted_dek: encrypted.encryptedDEK.toString("base64"), + encryption_iv: encrypted.encryption_iv.toString("base64"), + encryption_auth_tag: encrypted.encryption_auth_tag.toString("base64"), + }; + } + + const [created] = await this.db + .insert(agent_environment_variable) + .values(values) + .returning(); + return this.decryptEnvVar(created!); + } + + // Helper to decrypt environment variable if needed + private async decryptEnvVar( + envVar: AgentEnvironmentVariable + ): Promise { + // If value is already in plaintext (legacy data), return as-is + if (envVar.value !== null) { + return envVar; + } + + // Decrypt encrypted fields + if ( + envVar.encrypted_value && + envVar.encrypted_dek && + envVar.encryption_iv && + envVar.encryption_auth_tag + ) { + const masterKey = getMasterKey(); + if (!masterKey) { + throw new Error( + "ENCRYPTION_MASTER_KEY not configured. Cannot decrypt environment variable." + ); + } + + try { + const decrypted = await decryptValue( + { + encryptedValue: Buffer.from(envVar.encrypted_value, "base64"), + encryptedDEK: Buffer.from(envVar.encrypted_dek, "base64"), + encryption_iv: Buffer.from(envVar.encryption_iv, "base64"), + encryption_auth_tag: Buffer.from( + envVar.encryption_auth_tag, + "base64" + ), + }, + masterKey + ); + + return { + ...envVar, + value: decrypted, + }; + } catch (error) { + console.error("Failed to decrypt environment variable:", error); + throw new Error( + "Failed to decrypt environment variable. This may indicate a wrong encryption key or corrupted data." + ); + } + } + + // If no value and no encrypted fields, something is wrong + throw new Error( + "Environment variable has no value - neither plaintext nor encrypted data found" + ); + } + + public async deleteAgentEnvironmentVariable(id: string) { + await this.db + .delete(agent_environment_variable) + .where(eq(agent_environment_variable.id, id)); + } + + public async selectAgentEnvironmentVariableByID(id: string) { + const result = await this.db + .select() + .from(agent_environment_variable) + .where(eq(agent_environment_variable.id, id)) + .then((res) => res[0]); + + if (!result) return result; + return this.decryptEnvVar(result); + } + + public async updateAgentEnvironmentVariable( + id: string, + updates: Partial + ) { + let values = updates; + + // Always encrypt value if being updated and master key is available + const masterKey = getMasterKey(); + if (updates.value && typeof updates.value === "string" && masterKey) { + const encrypted = await encryptValue(updates.value, masterKey); + values = { + ...updates, + value: null, + encrypted_value: encrypted.encryptedValue.toString("base64"), + encrypted_dek: encrypted.encryptedDEK.toString("base64"), + encryption_iv: encrypted.encryption_iv.toString("base64"), + encryption_auth_tag: encrypted.encryption_auth_tag.toString("base64"), + }; + } + + const result = await this.db + .update(agent_environment_variable) + .set(values) + .where(eq(agent_environment_variable.id, id)) + .returning() + .then((res) => res[0]!); + + return this.decryptEnvVar(result); + } + + public async updateAgentEnvironmentVariableByKey( + agentID: string, + key: string, + updates: Partial + ) { + let values = updates; + + // Always encrypt value if being updated and master key is available + const masterKey2 = getMasterKey(); + if (updates.value && typeof updates.value === "string" && masterKey2) { + const encrypted = await encryptValue(updates.value, masterKey2); + values = { + ...updates, + value: null, + encrypted_value: encrypted.encryptedValue.toString("base64"), + encrypted_dek: encrypted.encryptedDEK.toString("base64"), + encryption_iv: encrypted.encryption_iv.toString("base64"), + encryption_auth_tag: encrypted.encryption_auth_tag.toString("base64"), + }; + } + + const result = await this.db + .update(agent_environment_variable) + .set(values) + .where( + and( + eq(agent_environment_variable.agent_id, agentID), + eq(agent_environment_variable.key, key) + ) + ) + .returning() + .then((res) => res[0]!); + + return this.decryptEnvVar(result); + } + + public async selectAgentEnvironmentVariablesByAgentID({ + agentID, + target = ["preview", "production"], + }: { + agentID: string; + target?: AgentEnvDeploymentTarget[]; + }) { + const results = await this.db + .select() + .from(agent_environment_variable) + .where( + and( + eq(agent_environment_variable.agent_id, agentID), + (() => { + const anyTargets = target.map( + (t) => sql`${t} = ANY(${agent_environment_variable.target})` + ); + return anyTargets.length === 1 ? anyTargets[0]! : or(...anyTargets); + })() + ) + ); + + // Decrypt all environment variables + return Promise.all(results.map((envVar) => this.decryptEnvVar(envVar))); + } + + public async selectOrganizationMembers( + params: Paginated<{ organizationID: string; query?: string }> + ) { + const conditions = [ + eq(organization_membership.organization_id, params.organizationID), + ]; + + if (params.query) { + const searchPattern = `%${params.query}%`; + conditions.push( + or( + ilike(user_with_personal_organization.username, searchPattern), + ilike(user_with_personal_organization.display_name, searchPattern), + ilike(user_with_personal_organization.email, searchPattern) + )! + ); + } + + return withPagination( + this.db + .select({ + organization_id: organization_membership.organization_id, + user_id: organization_membership.user_id, + role: organization_membership.role, + billing_emails_opt_out: + organization_membership.billing_emails_opt_out, + created_at: organization_membership.created_at, + updated_at: organization_membership.updated_at, + user: { + id: user_with_personal_organization.id, + created_at: user_with_personal_organization.created_at, + updated_at: user_with_personal_organization.updated_at, + username: user_with_personal_organization.username, + display_name: user_with_personal_organization.display_name, + email: user_with_personal_organization.email, + avatar_url: user_with_personal_organization.avatar_url, + organization_id: sql`"user_with_personal_organization"."organization_id"`, + }, + }) + .from(organization_membership) + .innerJoin( + user_with_personal_organization, + eq( + organization_membership.user_id, + user_with_personal_organization.id + ) + ) + .where(and(...conditions)) + .$dynamic(), + sql`"organization_membership"."created_at" DESC`, + params + ); + } + + public async selectOrganizationInviteByID( + id: string + ): Promise { + return this.db + .select() + .from(organization_invite) + .where(eq(organization_invite.id, id)) + .then((res) => res[0]); + } + + public async selectOrganizationInviteByCode(code: string): Promise< + | { + invite: OrganizationInvite; + organization: Organization; + } + | undefined + > { + const [row] = await this.db + .select() + .from(organization_invite) + .innerJoin( + organization, + eq(organization_invite.organization_id, organization.id) + ) + .where(eq(organization_invite.code, code)); + + if (!row) { + return undefined; + } + + return { + invite: row.organization_invite, + organization: row.organization, + }; + } + + public async deleteOrganizationInvite(id: string): Promise { + await this.db + .delete(organization_invite) + .where(eq(organization_invite.id, id)); + } + + public async updateOrganizationMembership( + updates: Pick & + Partial + ): Promise { + const [membership] = await this.db + .update(organization_membership) + .set({ + updated_at: new Date(), + ...updates, + }) + .where( + and( + eq(organization_membership.user_id, updates.user_id), + eq(organization_membership.organization_id, updates.organization_id) + ) + ) + .returning(); + return membership!; + } + + /** + * selectChats returns a paginated list of chats sorted however a user specified. + */ + public async selectChats( + params: CursorPaginated< + | { + organizationID: string; + status?: ChatStatus; + agentID?: string; + createdBy?: string; + } + | { + agentID: string; + status?: ChatStatus; + createdBy?: string; + } + > + ) { + const equals: SQL[] = []; + if ("organizationID" in params && params.organizationID) { + equals.push(eq(chat_with_status.organization_id, params.organizationID)); + } + if ("agentID" in params && params.agentID) { + equals.push(eq(chat_with_status.agent_id, params.agentID)); + } + if ("createdBy" in params && params.createdBy) { + equals.push(eq(chat_with_status.created_by, params.createdBy)); + } + if (equals.length === 0) { + throw new Error("No organization or agent ID provided"); + } + + // We need to omit updated_at here because Drizzle doesn't support aliasing the same column name. We add it back later. + const { updated_at, ...rest } = getViewSelectedFields(chat_with_status); + + const results = await withCursorPagination( + this.db + .select({ + ...rest, + chat_updated_at: sql`"chat_with_status"."updated_at"`.as( + "chat_updated_at" + ), + agent: getTableColumns(agent), + }) + .from(chat_with_status) + .innerJoin(agent, eq(chat_with_status.agent_id, agent.id)) + .$dynamic(), + { + idColumn: chat_with_status.id, + sortExpr: sql`"chat_with_status"."updated_at"`, + direction: "desc", + baseWhere: and(...equals, isNotNull(chat_with_status.agent_id)), + getKey: (row) => ({ + ts: parseDbTimestamp(row.chat_updated_at), + id: row.id, + }), + }, + params + ); + return { + ...results, + items: results.items.map((item) => ({ + ...item, + updated_at: parseDbTimestamp(item.chat_updated_at), + })), + }; + } + + public async selectChatMessages( + params: CursorPaginated<{ + chatID: string; + }> + ) { + return withCursorPagination( + this.db.select().from(message).$dynamic(), + { + idColumn: message.id, + sortExpr: message.created_at, + direction: "desc", + baseWhere: eq(message.chat_id, params.chatID), + getKey: (row) => ({ + ts: row.created_at, + id: row.id, + }), + }, + params + ); + } + + public async selectAgentDeploymentTargetByID(id: string) { + return this.db + .select() + .from(agent_deployment_target) + .where(eq(agent_deployment_target.id, id)) + .then((res) => res[0]); + } + + public async selectAgentDeploymentTargetByName( + agentID: string, + target: string + ) { + return this.db + .select() + .from(agent_deployment_target) + .where( + and( + eq(agent_deployment_target.agent_id, agentID), + eq(agent_deployment_target.target, target) + ) + ) + .then((res) => res[0]); + } + + public async updateAgentDeploymentTarget( + id: string, + updates: { request_id?: string } + ) { + const [updated] = await this.db + .update(agent_deployment_target) + .set({ + ...updates, + updated_at: new Date(), + }) + .where(eq(agent_deployment_target.id, id)) + .returning(); + return updated!; + } + + public async selectAgentDeploymentByID( + id: string + ): Promise<(AgentDeployment & { target: string }) | null> { + return this.db + .select({ + ...getTableColumns(agent_deployment), + target: agent_deployment_target.target, + }) + .from(agent_deployment) + .innerJoin( + agent_deployment_target, + eq(agent_deployment.target_id, agent_deployment_target.id) + ) + .where(eq(agent_deployment.id, id)) + .then((res) => res[0] ?? null); + } + + public async selectAgentDeploymentByNumber( + agentID: string, + number: number + ): Promise<(AgentDeployment & { target: string }) | null> { + return this.db + .select({ + ...getTableColumns(agent_deployment), + target: agent_deployment_target.target, + }) + .from(agent_deployment) + .innerJoin( + agent_deployment_target, + eq(agent_deployment.target_id, agent_deployment_target.id) + ) + .where( + and( + eq(agent_deployment.agent_id, agentID), + eq(agent_deployment.number, number) + ) + ) + .then((res) => res[0] ?? null); + } + + public async deleteChatMessage(id: string): Promise { + await this.db.delete(message).where(eq(message.id, id)); + } + + public async deleteChatMessages(ids: string[]): Promise { + if (ids.length === 0) return; + await this.db.delete(message).where(inArray(message.id, ids)); + } + + public async updateChatMessage( + updates: Pick & Partial + ): Promise { + const [resp] = await this.db + .update(message) + .set({ + ...updates, + updated_at: new Date(), + }) + .where(eq(message.id, updates.id)) + .returning(); + return resp!; + } + + public async selectAgentDeploymentByRequestID(id: string) { + return this.db + .select() + .from(agent) + .leftJoin( + agent_deployment, + eq(agent.active_deployment_id, agent_deployment.id) + ) + .leftJoin( + agent_deployment_target, + eq(agent_deployment_target.agent_id, agent.id) + ) + .where(eq(agent_deployment_target.request_id, id)) + .then((res) => (res.length > 0 ? res[0] : undefined)); + } + + public async updateAgent(updates: Pick & Partial) { + const [updated] = await this.db + .update(agent) + .set(updates) + .where(eq(agent.id, updates.id)) + .returning(); + return updated!; + } + + public async updateAgentDeployment( + updates: Pick & Partial + ) { + await this.db + .update(agent_deployment) + .set({ + ...updates, + updated_at: new Date(), + }) + .where(and(eq(agent_deployment.id, updates.id))); + } + + public async selectMessagesByChatID(chatID: string) { + return this.db + .select() + .from(message) + .where(and(eq(message.chat_id, chatID))) + .orderBy(asc(message.created_at)); + } + + public async selectLatestChatRun(chatID: string) { + return this.db + .select({ + run: getTableColumns(chat_run), + step: getViewSelectedFields(chat_run_step_with_status), + }) + .from(chat_run) + .innerJoin(chat, eq(chat.id, chat_run.chat_id)) + .leftJoin( + chat_run_step_with_status, + and( + eq(chat_run_step_with_status.chat_run_id, chat_run.id), + eq(chat_run_step_with_status.number, chat_run.last_step_number) + ) + ) + .where( + and(eq(chat.id, chatID), eq(chat.last_run_number, chat_run.number)) + ) + .limit(1) + .then((res) => res[0]); + } + + public async updateChatRun(updates: Pick & Partial) { + return this.db + .update(chat_run) + .set(updates) + .where(and(eq(chat_run.id, updates.id))) + .returning() + .then((res) => res[0]!); + } + + public async insertChatRunStep( + arg: Insertable, + ignoreOnConstraint?: boolean + ) { + if (ignoreOnConstraint) { + return this.db + .insert(chat_run_step) + .values(arg as Insertable) + .onConflictDoNothing({ + target: [chat_run_step.chat_id], + where: sql`${chat_run_step.completed_at} IS NULL AND ${chat_run_step.error} IS NULL AND ${chat_run_step.interrupted_at} IS NULL`, + }) + .returning() + .then((res) => res[0]!); + } else { + return this.db + .insert(chat_run_step) + .values(arg as Insertable) + .returning() + .then((res) => res[0]!); + } + } + + public async selectChatRunStepByID(id: string) { + return this.db + .select() + .from(chat_run_step_with_status) + .where(eq(chat_run_step_with_status.id, id)) + .then((res) => res[0]); + } + + public async selectChatSteps( + params: CursorPaginated<{ + chat_id: string; + run_id?: string; + }> + ) { + let where: SQL | undefined = eq( + chat_run_step_with_status.chat_id, + params.chat_id + ); + if (params.run_id) { + where = and( + where, + eq(chat_run_step_with_status.chat_run_id, params.run_id) + ); + } + + return withCursorPagination( + this.db.select().from(chat_run_step_with_status).$dynamic(), + { + idColumn: chat_run_step_with_status.id, + sortExpr: chat_run_step_with_status.started_at, + direction: "desc", + baseWhere: where, + getKey: (row) => ({ + ts: row.started_at, + id: row.id, + }), + }, + params + ); + } + + public async updateChatRunStep( + updates: Pick & Partial + ) { + return this.db + .update(chat_run_step) + .set(updates) + .where(and(eq(chat_run_step.id, updates.id))) + .returning() + .then((res) => res[0]!); + } + + public async selectChatRuns( + params: CursorPaginated<{ + chatID: string; + }> + ) { + return withCursorPagination( + this.db.select().from(chat_run_with_status).$dynamic(), + { + idColumn: chat_run_with_status.id, + sortExpr: chat_run_with_status.created_at, + direction: "desc", + baseWhere: eq(chat_run_with_status.chat_id, params.chatID), + getKey: (row) => ({ + ts: row.created_at, + id: row.id, + }), + }, + params + ); + } + + public async selectChatRun(id: string) { + return this.db + .select() + .from(chat_run_with_status) + .where(eq(chat_run_with_status.id, id)) + .then((res) => res[0]); + } + + public async selectAgentRun({ + agent_id, + run_id, + }: { + agent_id: string; + run_id: string; + }) { + return this.db + .select() + .from(chat_run_with_status) + .where( + and( + eq(chat_run_with_status.id, run_id), + eq(chat_run_with_status.agent_id, agent_id) + ) + ) + .then((res) => res[0]); + } + + public async selectAgentRuns( + params: CursorPaginated<{ + agent_id: string; + agent_deployment_id?: string; + chat_ids?: string[]; + }> + ) { + let where: SQL | undefined = eq( + chat_run_with_status.agent_id, + params.agent_id + ); + if (params.agent_deployment_id) { + where = and( + where, + eq(chat_run_with_status.agent_deployment_id, params.agent_deployment_id) + ); + } + if (params.chat_ids) { + where = and( + where, + inArray(chat_run_with_status.chat_id, params.chat_ids) + ); + } + + return withCursorPagination( + this.db.select().from(chat_run_with_status).$dynamic(), + { + idColumn: chat_run_with_status.id, + sortExpr: chat_run_with_status.created_at, + direction: "desc", + baseWhere: where, + getKey: (row) => ({ + ts: row.created_at, + id: row.id, + }), + }, + params + ); + } + + public async selectAgentStep({ + agent_id, + step_id, + }: { + agent_id: string; + step_id: string; + }) { + return this.db + .select() + .from(chat_run_step_with_status) + .where( + and( + eq(chat_run_step_with_status.id, step_id), + eq(chat_run_step_with_status.agent_id, agent_id) + ) + ) + .then((res) => res[0]); + } + + public async selectAgentSteps( + params: CursorPaginated<{ + agent_id: string; + agent_deployment_id?: string; + chat_id?: string; + chat_ids?: string[]; + run_id?: string; + status?: ChatRunStepStatus; + }> + ) { + let where: SQL | undefined = eq( + chat_run_step_with_status.agent_id, + params.agent_id + ); + if (params.agent_deployment_id) { + where = and( + where, + eq( + chat_run_step_with_status.agent_deployment_id, + params.agent_deployment_id + ) + ); + } + + if (params.chat_id) { + where = and(where, eq(chat_run_step_with_status.chat_id, params.chat_id)); + } + + if (params.chat_ids) { + where = and( + where, + inArray(chat_run_step_with_status.chat_id, params.chat_ids) + ); + } + + if (params.run_id) { + where = and( + where, + eq(chat_run_step_with_status.chat_run_id, params.run_id) + ); + } + + if (params.status) { + where = and(where, eq(chat_run_step_with_status.status, params.status)); + } + + return withCursorPagination( + this.db.select().from(chat_run_step_with_status).$dynamic(), + { + idColumn: chat_run_step_with_status.id, + sortExpr: chat_run_step_with_status.started_at, + direction: "desc", + baseWhere: where, + getKey: (row) => ({ + ts: row.started_at, + id: row.id, + }), + }, + params + ); + } + + public async selectAgentStorageKV({ + deployment_target_id, + key, + }: { + deployment_target_id: string; + key: string; + }) { + return this.db + .select() + .from(agent_storage_kv) + .where( + and( + eq(agent_storage_kv.agent_deployment_target_id, deployment_target_id), + eq(agent_storage_kv.key, key) + ) + ) + .then((res) => res[0]); + } + + public async selectAgentStorageKVByPrefix( + args: CursorPaginated<{ + deployment_target_id: string; + prefix: string; + }> + ) { + const limitPlus = (args.limit ?? 10) + 1; + const { deployment_target_id, prefix, cursor } = args; + + let cursorWhere: SQL | undefined; + if (cursor) { + const c = decodeCursor(cursor); + cursorWhere = sql`(${agent_storage_kv.key} > ${c.id} OR (${agent_storage_kv.key} = ${c.id} AND ${agent_storage_kv.id} > ${c.ts.toISOString()}))`; + } + + const finalWhere = and( + eq(agent_storage_kv.agent_deployment_target_id, deployment_target_id), + like(agent_storage_kv.key, sql`${prefix}%`), + cursorWhere + ); + + const rows = await this.db + .select() + .from(agent_storage_kv) + .where(finalWhere) + .orderBy(asc(agent_storage_kv.key), asc(agent_storage_kv.id)) + .limit(limitPlus); + + const has_more = rows.length > (args.limit ?? 10); + const items = has_more ? rows.slice(0, args.limit ?? 10) : rows; + const last = items[items.length - 1]; + + return { + items, + next_cursor: + has_more && last ? encodeCursor(new Date(last.id), last.key) : null, + }; + } + + public async upsertAgentStorageKV(args: Insertable) { + return this.db + .insert(agent_storage_kv) + .values(args) + .onConflictDoUpdate({ + target: [ + agent_storage_kv.agent_deployment_target_id, + agent_storage_kv.key, + ], + set: { + value: args.value as string, + }, + }); + } + + public async deleteAgentStorageKV(args: { + key: string; + deployment_target_id: string; + }) { + return this.db + .delete(agent_storage_kv) + .where( + and( + eq( + agent_storage_kv.agent_deployment_target_id, + args.deployment_target_id + ), + eq(agent_storage_kv.key, args.key) + ) + ); + } + + public async upsertChatForAgentDeploymentTarget( + args: Insertable + ): Promise<{ id: string; created_at: Date; created: boolean }> { + const result = await this.db + .insert(chat) + .values(args) + .onConflictDoNothing({ + target: [chat.agent_deployment_target_id, chat.agent_key], + }) + .returning({ id: chat.id, created_at: chat.created_at }); + + if (result.length > 0) { + // Chat was created + return { + id: result[0]!.id, + created_at: result[0]!.created_at, + created: true, + }; + } + + // Chat already exists, fetch it + const existing = await this.db + .select({ id: chat.id, created_at: chat.created_at }) + .from(chat) + .where( + and( + eq(chat.agent_deployment_target_id, args.agent_deployment_target_id!), + eq(chat.agent_key, args.agent_key!) + ) + ) + .limit(1); + + if (!existing[0]) { + throw new Error("Failed to upsert chat"); + } + + return { + id: existing[0].id, + created_at: existing[0].created_at, + created: false, + }; + } + + public async selectChatByAgentKey({ + agentID, + key, + }: { + agentID: string; + key: string; + }) { + return this.db + .select() + .from(chat) + .where(and(eq(chat.agent_id, agentID), eq(chat.agent_key, key))) + .then((res) => res[0]); + } + + /** + * If there's already a running step for this chat, + * this does nothing. + * + * If there's no running step, it creates one. + * + * If there's a running step and behavior=interrupt, it interrupts it. + * + * If there's a running step and behavior=enqueue, it does nothing. + */ + public async reconcileChatRun(req: { + behavior: "interrupt" | "enqueue"; + chat_id: string; + agent_id: string; + agent_deployment_id?: string; + }): Promise { + await this.tx(async (tx) => { + // behavior=interrupt -> immediately mark current open step interrupted + if (req.behavior === "interrupt") { + await tx.db.execute(sql` + UPDATE chat_run_step + SET interrupted_at = NOW() + WHERE chat_id = ${req.chat_id} + AND completed_at IS NULL + AND interrupted_at IS NULL + AND error IS NULL + `); + } + + // This is defensive. If there are stalled steps (e.g. the worker just exploded), + // we don't want to block a chat. + await tx.db.execute(sql` + UPDATE chat_run_step + SET + error = COALESCE(error, 'The chat stalled for an unknown reason. Please contact support.') + WHERE chat_id = ${req.chat_id} + AND completed_at IS NULL + AND interrupted_at IS NULL + AND error IS NULL + AND heartbeat_at < NOW() - ${ChatRunStepStalledDurationSQL} + `); + }); + + try { + await this.tx(async (tx) => { + // Prefer explicit deployment, else chat's, else agent's active + let deploymentId = req.agent_deployment_id; + if (!deploymentId) { + // Select the active deployment for the agent. + const deployment = await tx.selectAgentDeploymentByIDOrActive({ + agentID: req.agent_id, + }); + if (!deployment) { + throw new Error("No active deployment for agent"); + } + deploymentId = deployment.id; + } + + // Insert run and its first step atomically. + // If step insert violates uniq_open_step_per_chat, + // the whole tx aborts, leaving no stray run. + const run = await tx.db + .insert(chat_run) + .values({ + chat_id: req.chat_id, + agent_id: req.agent_id, + agent_deployment_id: deploymentId, + } as Insertable) + .returning() + .then((res) => res[0]); + if (!run) { + throw new Error("Failed to insert chat run"); + } + + // If there was already an open step, this insert hits 23505 + // on chat_run_step_single_streaming and the tx is rolled back. + await tx.insertChatRunStep({ + chat_id: req.chat_id, + chat_run_id: run.id, + agent_id: req.agent_id, + agent_deployment_id: deploymentId, + }); + }); + } catch (err) { + if (isUniqueChatRunStepConstraintError(err)) { + // There's already a running step for this chat. + // This is expected and totally fine - we don't need to do anything. + return; + } + + throw err; + } + } + + // Agent Permissions + + /** + * Get the effective permission level for a user on an agent. + * Resolution order: + * 1. User-specific permission (if exists) + * 2. Organization-level default (user_id = NULL) + * 3. Fallback based on org role (owner/admin -> write, others -> read) + */ + public async getAgentPermissionForUser(params: { + agentId: string; + userId: string; + orgRole?: "owner" | "admin" | "member" | "billing_admin"; + agentVisibility?: "private" | "public" | "organization"; + }): Promise { + // Get agent visibility if not provided + let visibility = params.agentVisibility; + if (!visibility) { + const agent = await this.selectAgentByID(params.agentId); + if (!agent) { + throw new Error(`Agent ${params.agentId} not found`); + } + visibility = agent.visibility; + } + + // For organization visibility: all org members can access + if (visibility === "organization") { + // Check for user-specific permission first (for elevated access) + const userPermission = await this.db + .select() + .from(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agentId), + eq(agent_permission.user_id, params.userId) + ) + ) + .then((res) => res[0]); + + if (userPermission) { + return userPermission.permission; + } + + // Check for org-level default permission + const orgPermission = await this.db + .select() + .from(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agentId), + isNull(agent_permission.user_id) + ) + ) + .then((res) => res[0]); + + if (orgPermission) { + return orgPermission.permission; + } + + // Org owners and admins always have admin by default + if (params.orgRole === "owner" || params.orgRole === "admin") { + return "admin"; + } + + // All other org members get read by default for organization visibility + return "read"; + } + + // For private visibility: only org admins/owners or explicitly granted users can access + if (visibility === "private") { + // Org owners and admins bypass permission checks + if (params.orgRole === "owner" || params.orgRole === "admin") { + return "admin"; + } + + // Check for user-specific permission + const userPermission = await this.db + .select() + .from(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agentId), + eq(agent_permission.user_id, params.userId) + ) + ) + .then((res) => res[0]); + + if (userPermission) { + return userPermission.permission; + } + + // Check for org-level default permission + const orgPermission = await this.db + .select() + .from(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agentId), + isNull(agent_permission.user_id) + ) + ) + .then((res) => res[0]); + + if (orgPermission) { + return orgPermission.permission; + } + + // No access for private agents without explicit permission + return undefined; + } + + // For public visibility: all org members can access + // (This is similar to organization visibility for now) + // Check for user-specific permission first (for elevated access) + const userPermission = await this.db + .select() + .from(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agentId), + eq(agent_permission.user_id, params.userId) + ) + ) + .then((res) => res[0]); + + if (userPermission) { + return userPermission.permission; + } + + // Check for org-level default permission + const orgPermission = await this.db + .select() + .from(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agentId), + isNull(agent_permission.user_id) + ) + ) + .then((res) => res[0]); + + if (orgPermission) { + return orgPermission.permission; + } + + // Fallback to org role + // Org owners and admins always have admin by default + if (params.orgRole === "owner" || params.orgRole === "admin") { + return "admin"; + } + + // Members and billing admins get read by default + return "read"; + } + + /** + * Get all permissions for an agent (both user-specific and org default) + */ + public async selectAgentPermissions(params: Paginated<{ agentId: string }>) { + return withPagination( + this.db + .select({ + ...getTableColumns(agent_permission), + user: { + id: user_with_personal_organization.id, + created_at: user_with_personal_organization.created_at, + updated_at: user_with_personal_organization.updated_at, + username: user_with_personal_organization.username, + display_name: user_with_personal_organization.display_name, + email: user_with_personal_organization.email, + avatar_url: user_with_personal_organization.avatar_url, + }, + }) + .from(agent_permission) + .leftJoin( + user_with_personal_organization, + eq(agent_permission.user_id, user_with_personal_organization.id) + ) + .where(eq(agent_permission.agent_id, params.agentId)) + .$dynamic(), + sql`${agent_permission.created_at} DESC`, + params + ); + } + + /** + * Grant or update a permission for a user or org + */ + public async upsertAgentPermission(params: { + agent_id: string; + user_id?: string; + permission: AgentPermissionLevel; + created_by: string; + }): Promise { + const [permission] = await this.db + .insert(agent_permission) + .values({ + agent_id: params.agent_id, + user_id: params.user_id ?? null, + permission: params.permission, + created_by: params.created_by, + updated_at: new Date(), + }) + .onConflictDoUpdate({ + target: [agent_permission.agent_id, agent_permission.user_id], + set: { + permission: params.permission, + updated_at: new Date(), + }, + }) + .returning(); + return permission!; + } + + /** + * Delete a specific permission + */ + public async deleteAgentPermission(params: { + agent_id: string; + user_id?: string; + }): Promise { + await this.db + .delete(agent_permission) + .where( + and( + eq(agent_permission.agent_id, params.agent_id), + params.user_id + ? eq(agent_permission.user_id, params.user_id) + : isNull(agent_permission.user_id) + ) + ); + } + + /** + * Delete expired chats based on their expire_ttl and created_at. + * Returns the number of chats deleted. + */ + public async deleteExpiredChats(params?: { + limit?: number; + now?: Date; + }): Promise { + const now = params?.now ?? new Date(); + const limit = params?.limit ?? 100; + + // Use a CTE to find expired chats, then delete them in one query + // This is much more efficient than fetching + filtering + deleting + const result = await this.db.execute(sql` + WITH expired_chats AS ( + SELECT id + FROM ${chat_with_status} + WHERE ${chat_with_status.expire_ttl} IS NOT NULL + AND ${chat_with_status.expires_at} <= ${now} + LIMIT ${limit} + ) + DELETE FROM ${chat} + WHERE id IN (SELECT id FROM expired_chats) + RETURNING id + `); + + return result.rowCount ?? 0; + } + + public tx(fn: (tx: Querier) => Promise) { + if (this.inTx) { + throw new Error( + "Do not nest transactions! Prefer passing the database so it's easier to debug." + ); + } + return this.db.transaction(async (tx) => { + const txQuerier = new Querier(tx); + txQuerier.inTx = true; + return await fn(txQuerier); + }); + } + + public async insertUsageEvent( + event: Insertable + ) { + return await this.db + .insert(organization_billing_usage_event) + .values(event) + .returning(); + } + + public async updateUsageEvent( + updates: Pick & + Partial + ) { + return await this.db + .update(organization_billing_usage_event) + .set(updates) + .where(eq(organization_billing_usage_event.id, updates.id)) + .returning() + .then((rows) => rows[0]!); + } + + // Observability: Logs + async getAgentLogs(opts: { + agent_id: string; + message_pattern?: string; + filters?: FieldFilterGroup; + start_time: Date; + end_time: Date; + limit: number; + }): Promise { + return getAgentLogsImpl(this.db, opts); + } + + async writeAgentLog(opts: { + agent_id: string; + event: Record; + }): Promise { + return writeAgentLogImpl(this.db, opts); + } + + // Observability: Traces + async writeAgentTraces(spans: OtelSpan[]): Promise { + return writeTraces(this.db, spans); + } + + async readAgentTraces( + opts: ReadTracesOpts + ): Promise<(OtelSpan & { created_at: string })[]> { + return readTraces(this.db, opts); + } +} + +export type Paginated = T & { + page?: number; + per_page?: number; +}; + +const withPagination = async ( + qb: T, + orderByColumn: PgColumn | SQL | SQL.Aliased, + { page = 1, per_page = 10 }: Paginated +): Promise<{ + items: Awaited[number][]; + has_more: boolean; +}> => { + const limit = per_page + 1; + const query = qb + .orderBy(orderByColumn) + .limit(limit) + .offset((page - 1) * per_page); + + const items = await query; + const hasMore = items.length > per_page; + + return { + items: items.slice(0, per_page), + has_more: hasMore, + }; +}; + +export type CursorPaginated = T & { + limit?: number; + cursor?: string; +}; + +async function withCursorPagination< + T extends PgSelect, + Row = Awaited[number], +>( + qb: T, + opts: { + sortExpr: PgColumn | SQL | SQL.Aliased; // e.g. chat.created_at + idColumn: PgColumn; // e.g. chat.id + direction: "asc" | "desc"; // overall order + baseWhere?: SQL; // filters to AND with cursor + getKey: (row: Row) => { ts: Date; id: string }; + }, + { limit = 10, cursor }: CursorPaginated +): Promise<{ + items: Row[]; + next_cursor: string | null; +}> { + const limitPlus = limit + 1; + const { sortExpr, idColumn, direction, baseWhere, getKey } = opts; + + let cursorWhere: SQL | undefined; + if (cursor) { + const c = decodeCursor(cursor); // { ts: Date, id: string } + const ts = c.ts.toISOString(); + cursorWhere = + direction === "desc" + ? sql`(${sortExpr} < ${ts} OR (${sortExpr} = ${ts} AND ${idColumn} < ${c.id}))` + : sql`(${sortExpr} > ${ts} OR (${sortExpr} = ${ts} AND ${idColumn} > ${c.id}))`; + } + + const finalWhere = baseWhere + ? cursorWhere + ? and(baseWhere, cursorWhere) + : baseWhere + : cursorWhere; + + let q: any = qb; + if (finalWhere) q = q.where(finalWhere); + + const rows: Row[] = await q + .orderBy( + direction === "desc" ? desc(sortExpr) : asc(sortExpr), + direction === "desc" ? desc(idColumn) : asc(idColumn) + ) + .limit(limitPlus); + + const has_more = rows.length > limit; + const items = has_more ? rows.slice(0, limit) : rows; + const last = items[items.length - 1]; + const out: { + items: Row[]; + next_cursor: string | null; + } = { next_cursor: null, items }; + if (has_more && last) { + const k = getKey(last); + out.next_cursor = encodeCursor(k.ts, k.id); + } + return out; +} + +export type Insertable< + T extends PgTable, + K extends keyof PgInsertValue = never, +> = { + [P in keyof PgInsertValue as P extends K ? never : P]: PgInsertValue[P]; +} & { + [P in keyof PgInsertValue as P extends K ? P : never]?: + | PgInsertValue[P] + | undefined; +}; + +// Base64url helpers (Node) +const b64u = { + enc: (b: Uint8Array) => + Buffer.from(b) + .toString("base64") + .replace(/\+/g, "-") + .replace(/\//g, "_") + .replace(/=+$/g, ""), + dec: (s: string): Uint8Array => + new Uint8Array( + Buffer.from(s.replace(/-/g, "+").replace(/_/g, "/"), "base64") + ), +}; + +function uuidToBytes(uuid: string): Uint8Array { + const hex = uuid.replace(/-/g, ""); + const out = new Uint8Array(16); + for (let i = 0; i < 16; i++) { + out[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16); + } + return out; +} + +function bytesToUuid(bytes: Uint8Array): string { + const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join( + "" + ); + return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`; +} + +// 6-byte ms timestamp + 16-byte UUID = 22 bytes -> ~30 chars base64url +function encodeCursor(ts: Date, id: string): string { + const ms = ts.getTime(); // number, safe (<= 2^53-1) + const buf = new Uint8Array(22); + let x = ms; + for (let i = 5; i >= 0; i--) { + buf[i] = x % 256; + x = Math.floor(x / 256); + } + buf.set(uuidToBytes(id), 6); // no .copy; Uint8Array#set works + return b64u.enc(buf); +} + +function decodeCursor(s: string): { ts: Date; id: string } { + const buf = b64u.dec(s); + let ms = 0; + for (let i = 0; i < 6; i++) ms = ms * 256 + buf[i]!; + const id = bytesToUuid(buf.subarray(6, 22)); + return { ts: new Date(ms), id }; +} + +function parseDbTimestamp(value: Date | string): Date { + if (value instanceof Date) return value; + if (/[zZ]|[+\-]\d{2}:?\d{2}$/.test(value)) return new Date(value); + return new Date(value + "Z"); +} + +export function isUniqueChatRunStepConstraintError(err: unknown): boolean { + if ( + err instanceof DrizzleQueryError && + err.cause instanceof postgres.PostgresError && + err.cause.code === "23505" && + (err.cause.constraint_name === "chat_run_step_chat_id_idx" || + err.cause.constraint_name === "chat_run_step_single_streaming") + ) { + return true; + } + return false; +} + +function generateUsername(options: { + displayName?: string; + email?: string; + suffix?: string; // For uniqueness, e.g., '1', '2' +}): string { + let input = (options.displayName || options.email || "").trim(); + if (!input) { + input = "user"; + } + + // For email, use local part only + if (options.email && !options.displayName) { + input = input.split("@")[0]!; + } + + // Clean: lowercase, keep only a-z0-9-, collapse multiple -, remove leading/trailing - + let slug = input + .toLowerCase() + .replace(/[^a-z0-9-]/g, "") + .replace(/-+/g, "-") + .replace(/^-+/, "") + .replace(/-+$/, ""); + + // Fallback if empty + if (!slug) { + slug = "user"; + } + + // Ensure starts with a-z0-9 (prepend 'u' if needed) + if (!/^[a-z0-9]/.test(slug)) { + slug = "u" + slug; + } + + // Append suffix if provided (e.g., for uniqueness) + if (options.suffix) { + slug += `-${options.suffix}`; + } + + // Truncate to max 39 chars, then strip any trailing - + const orgName = slug.slice(0, 39).replace(/-+$/, ""); + + // Final fallback if empty after processing + return orgName || "user"; +} diff --git a/packages/database/src/schema.ts b/packages/database/src/schema.ts new file mode 100644 index 0000000..d57edef --- /dev/null +++ b/packages/database/src/schema.ts @@ -0,0 +1,1041 @@ +import type { UIMessage } from "ai"; +import type { InferSelectModel, InferSelectViewModel } from "drizzle-orm"; +import { and, eq, getTableColumns, sql } from "drizzle-orm"; +import { + bigint, + boolean, + check, + customType, + doublePrecision, + foreignKey, + index, + integer, + json, + jsonb, + numeric, + pgTable, + pgView, + primaryKey, + text, + timestamp, + uniqueIndex, + uuid, + varchar, +} from "drizzle-orm/pg-core"; +import { reserved_usernames } from "./shared"; + +// Custom bytea type for storing binary data +const bytea = customType<{ data: Buffer; notNull: false; default: false }>({ + dataType() { + return "bytea"; + }, +}); + +export const ChatRunStepStalledDurationSQL = sql`INTERVAL '90 seconds'`; +export type VisibilityType = "public" | "private" | "organization"; + +const organizationKind = varchar("kind", { + enum: ["organization", "personal"], +}) + .notNull() + .default("organization"); + +export const organization = pgTable( + "organization", + { + id: uuid("id").primaryKey().defaultRandom(), + name: varchar("name", { length: 40 }).notNull().unique(), + avatar_url: varchar("avatar_url", { length: 2048 }), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + created_by: uuid("created_by"), + + // This is used to determine whether an organization is a user's + // personal organization or an organization they belong to. + // + // Resources are all grouped by organization to simplify the + // database schema. + kind: organizationKind, + // Only set when kind is "personal" + personal_owner_user_id: uuid("personal_owner_user_id").references( + () => user.id, + // If the user is deleted, cascade to their personal org + { onDelete: "cascade" } + ), + + billing_tier: varchar("billing_tier", { enum: ["free", "pro", "team"] }) + .notNull() + .default("free"), + billing_interval: varchar("billing_interval", { + enum: ["month", "year"], + }) + .notNull() + .default("month"), + stripe_customer_id: text("stripe_customer_id"), + metronome_customer_id: text("metronome_customer_id"), + metronome_contract_id: text("metronome_contract_id"), + stripe_subscription_id: text("stripe_subscription_id"), + next_billing_date: timestamp("next_billing_date"), + billing_entitled_at: timestamp("billing_entitled_at"), + }, + (table) => [ + check( + "name_format", + sql`${table.name} ~* '^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$'` + ), + + check( + "name_not_reserved", + sql`${table.name} NOT IN (${sql.join( + Array.from(reserved_usernames).map((name) => sql`${name}`), + sql`, ` + )})` + ), + + // Exactly one personal org per user + uniqueIndex("personal_org_per_user") + .on(table.personal_owner_user_id) + .where(sql`${table.kind} = 'personal'`), + + check( + "personal_owner_presence", + sql`(${table.kind} = 'personal' AND ${table.personal_owner_user_id} IS NOT NULL) + OR (${table.kind} = 'organization' AND ${table.personal_owner_user_id} IS NULL)` + ), + + check( + "personal_created_by_matches_owner", + sql`${table.kind} != 'personal' OR ${table.created_by} = ${table.personal_owner_user_id}` + ), + ] +); + +export const user = pgTable("user", { + id: uuid("id") + .primaryKey() + .$defaultFn(() => crypto.randomUUID()), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + display_name: text("display_name"), + email: text("email").unique(), + email_verified: timestamp("email_verified", { mode: "date" }), + password: text("password"), +}); + +export type User = InferSelectModel; + +export const user_with_personal_organization = pgView( + "user_with_personal_organization" +).as((qb) => + qb + .select({ + ...getTableColumns(user), + organization_id: sql`${organization.id}`.as("organization_id"), + username: sql`${organization.name}`.as("username"), + avatar_url: sql`${organization.avatar_url}`.as( + "avatar_url" + ), + }) + .from(user) + .innerJoin(organization, eq(user.id, organization.personal_owner_user_id)) +); + +export type UserWithPersonalOrganization = InferSelectViewModel< + typeof user_with_personal_organization +>; + +export const user_account = pgTable( + "user_account", + { + user_id: uuid("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade" }), + type: text("type").notNull(), + provider: text("provider").$type<"github" | "google" | "slack">().notNull(), + provider_account_id: text("provider_account_id").notNull(), + refresh_token: text("refresh_token"), + access_token: text("access_token"), + expires_at: integer("expires_at"), + token_type: text("token_type"), + scope: text("scope"), + id_token: text("id_token"), + session_state: text("session_state"), + }, + (account) => ({ + pk: primaryKey({ + columns: [account.provider, account.provider_account_id], + }), + }) +); + +export type UserAccount = InferSelectModel; + +export const email_verification = pgTable( + "email_verification", + { + email: text("email").notNull(), + code: text("code").notNull(), + created_at: timestamp("created_at").notNull().defaultNow(), + expires_at: timestamp("expires_at").notNull(), + }, + (table) => ({ + emailCodeIdx: uniqueIndex("idx_email_verification_email_code").on( + table.email, + table.code + ), + }) +); + +export type EmailVerification = InferSelectModel; + +const organizationMembershipRole = varchar("role", { + enum: ["owner", "admin", "member", "billing_admin"], +}) + .notNull() + .default("member"); + +export const organization_invite = pgTable( + "organization_invite", + { + id: uuid("id").primaryKey().defaultRandom(), + organization_id: uuid("organization_id") + .notNull() + .references(() => organization.id, { onDelete: "cascade" }), + email: text("email"), + role: organizationMembershipRole, + invited_by: uuid("invited_by").notNull(), + code: text("code").notNull().unique(), + reusable: boolean("reusable").notNull().default(false), + last_accepted_at: timestamp("last_accepted_at"), + + expires_at: timestamp("expires_at") + .defaultNow() + .$default(() => { + const date = new Date(); + // Invites expire in 2 days. + date.setDate(date.getDate() + 2); + return date; + }), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + }, + (table) => { + return { + invitedByMembershipFk: foreignKey({ + columns: [table.organization_id, table.invited_by], + foreignColumns: [ + organization_membership.organization_id, + organization_membership.user_id, + ], + name: "organization_invite_invited_by_membership_fk", + }).onDelete("cascade"), + }; + } +); + +export const organization_membership = pgTable( + "organization_membership", + { + organization_id: uuid("organization_id") + .notNull() + .references(() => organization.id, { onDelete: "cascade" }), + user_id: uuid("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade" }), + role: organizationMembershipRole, + + billing_emails_opt_out: boolean("billing_emails_opt_out") + .notNull() + .default(false), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + }, + (table) => { + return { + pk: primaryKey({ columns: [table.organization_id, table.user_id] }), + }; + } +); + +export type Organization = InferSelectModel; + +export type OrganizationInvite = InferSelectModel; + +export type OrganizationMembership = InferSelectModel< + typeof organization_membership +>; + +export type OrganizationWithMembership = Organization & { + membership?: OrganizationMembership; +}; + +export type ChatSource = + | { + type: "slack"; + thread_id: string; + team_id: string; + channel: string; + channel_is_shared: boolean; + } + | { + type: "web"; + onboarding?: boolean; + }; + +export const chat = pgTable( + "chat", + { + id: uuid("id").primaryKey().notNull().defaultRandom(), + created_at: timestamp("created_at").notNull(), + // created_by can be null for chats created from Slack. + created_by: uuid("created_by"), + organization_id: uuid("organization_id") + .notNull() + .references(() => organization.id, { onDelete: "cascade" }), + visibility: varchar("visibility", { + enum: ["public", "private", "organization"], + }) + .notNull() + .default("private"), + title: text("title"), + metadata: json("metadata").$type>(), + archived: boolean("archived").notNull().default(false), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { + onDelete: "set null", + }), + agent_deployment_id: uuid("agent_deployment_id").references( + () => agent_deployment.id, + { onDelete: "set null" } + ), + agent_deployment_target_id: uuid("agent_deployment_target_id").references( + () => agent_deployment_target.id, + { onDelete: "set null" } + ), + agent_key: varchar("agent_key", { length: 128 }).notNull(), + + // last_run_number is the sequence number of the last run. + last_run_number: integer("last_run_number").notNull().default(0), + + // Time-to-live in seconds for this chat (copied from agent at creation). + // null means this chat never expires (kept forever). + expire_ttl: integer("expire_ttl"), + }, + (table) => ({ + // Index for queries filtering by organization_id and created_at + organizationCreatedAtIdx: index("chat_organization_created_at_idx").on( + table.organization_id, + table.created_at + ), + // Composite index for chat queries by team and created_by + organizationCreatedByIdx: index("idx_chat_organization_created_by").on( + table.organization_id, + table.created_by, + table.created_at + ), + // Index for chat visibility filtering + visibilityIdx: index("idx_chat_visibility") + .on(table.organization_id, table.visibility, table.created_at) + .where(sql`${table.visibility} IN ('public', 'private', 'organization')`), + + // Index for finding chats with expiration set (for deletion job) + expireTtlIdx: index("idx_chat_expire_ttl") + .on(table.created_at) + .where(sql`${table.expire_ttl} IS NOT NULL`), + + // Index for unique chats per deployment target. + agentDeploymentTargetIdKeyUnique: uniqueIndex( + "idx_chat_agent_deployment_target_id_key_unique" + ).on(table.agent_deployment_target_id, table.agent_key), + }) +); + +export type Chat = InferSelectModel; + +export const chat_user_state = pgTable( + "chat_user_state", + { + chat_id: uuid("chat_id") + .notNull() + .references(() => chat.id, { onDelete: "cascade" }), + user_id: uuid("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade" }), + last_read_at: timestamp("last_read_at"), + }, + (table) => ({ + pk: primaryKey({ columns: [table.chat_id, table.user_id] }), + }) +); + +export type ChatUserState = InferSelectModel; + +export const file = pgTable("file", { + id: uuid("id").primaryKey().notNull().defaultRandom(), + user_id: uuid("user_id"), + organization_id: uuid("organization_id"), + message_id: uuid("message_id"), + name: text("name").notNull(), + content_type: text("content_type").notNull(), + byte_length: integer("byte_length").notNull(), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + + // pdf_page_count is only set for PDF attachments. + // It's because some models have a hard limit on the number + // of pages that can be processed. + pdf_page_count: integer("pdf_page_count"), + + // content stores the file contents directly in the database as binary data. + // This is optional and allows implementations to store files in PostgreSQL + // instead of external storage like R2. Uses bytea for efficient binary storage. + content: bytea("content"), +}); + +export type File = InferSelectModel; + +export type PartialFile = { + id: string; + content_type: string; + byte_length: number; + file_name: string; +}; + +export const message = pgTable( + "message", + { + id: uuid("id").primaryKey().notNull().defaultRandom(), + created_at: timestamp("created_at").notNull(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + chat_id: uuid("chat_id") + .notNull() + .references(() => chat.id, { onDelete: "cascade" }), + // These are only provided for messages that are produced as part of a run. + chat_run_id: uuid("chat_run_id"), + chat_run_step_id: uuid("chat_run_step_id"), + + role: varchar("role").$type().notNull(), + parts: json("parts").$type().notNull(), + metadata: json("metadata").$type>(), + // TODO: This will be non-nullable once we add the default Blink agent. + agent_id: uuid("agent_id"), + // TODO: This will be non-nullable once we add the default Blink agent. + agent_deployment_id: uuid("agent_deployment_id"), + user_id: uuid("user_id"), + }, + (table) => ({ + // Composite index for message stats queries + chatRoleCreatedIdx: index("idx_message_chat_role_created") + .on(table.chat_id, table.role) + .where(sql`${table.role} = 'user'`), + }) +); + +export type DBMessage = InferSelectModel; + +export const organization_billing_usage_event = pgTable( + "organization_billing_usage_event", + { + id: uuid("id").primaryKey().defaultRandom(), + created_at: timestamp("created_at").notNull().defaultNow(), + organization_id: uuid("organization_id").notNull(), + transaction_id: text("transaction_id").notNull(), + event_type: text("event_type").notNull(), + cost_usd: numeric("cost_usd", { precision: 32, scale: 18 }) + .$type() + .notNull(), + user_id: uuid("user_id"), + processed_at: timestamp("processed_at"), + error_message: text("error_message"), + }, + (table) => [ + uniqueIndex("organization_billing_usage_event_org_txn_unique").on( + table.organization_id, + table.transaction_id + ), + ] +); + +export type OrganizationBillingUsageEvent = InferSelectModel< + typeof organization_billing_usage_event +>; + +export const agent = pgTable( + "agent", + { + id: uuid("id").primaryKey().defaultRandom(), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + organization_id: uuid("organization_id") + .notNull() + .references(() => organization.id, { onDelete: "cascade" }), + created_by: uuid("created_by").notNull(), + visibility: varchar("visibility", { + enum: ["private", "public", "organization"], + }) + .default("organization") + .notNull(), + name: varchar("name", { length: 40 }).notNull(), + description: text("description"), + avatar_file_id: uuid("avatar_file_id"), + active_deployment_id: uuid("active_deployment_id"), + // Time-to-live in seconds for chats created by this agent. + // null means chats never expire (kept forever). + chat_expire_ttl: integer("chat_expire_ttl"), + + last_deployment_number: integer("last_deployment_number") + .notNull() + .default(0), + last_run_number: integer("last_run_number").notNull().default(0), + }, + (table) => [ + check( + "name_format", + sql`${table.name} ~* '^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$'` + ), + + uniqueIndex("agent_name_unique").on(table.organization_id, table.name), + ] +); + +export type Agent = InferSelectModel; + +export type AgentWithPinned = Agent & { + pinned: boolean; +}; + +export type AgentWithPermission = Agent & { + user_permission?: AgentPermissionLevel; +}; + +export const agent_pin = pgTable( + "agent_pin", + { + id: uuid("id").primaryKey().defaultRandom(), + created_at: timestamp("created_at").notNull().defaultNow(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + user_id: uuid("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade" }), + }, + (table) => ({ + agentPinUnique: uniqueIndex("agent_pin_agent_id_user_id_unique").on( + table.agent_id, + table.user_id + ), + }) +); + +export type AgentPin = InferSelectModel; + +export type AgentPermissionLevel = "read" | "write" | "admin"; + +const agentPermissionLevel = varchar("permission", { + enum: ["read", "write", "admin"], +}).$type(); + +export const agent_permission = pgTable( + "agent_permission", + { + id: uuid("id").primaryKey().defaultRandom(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + user_id: uuid("user_id").references(() => user.id, { onDelete: "cascade" }), + permission: agentPermissionLevel.notNull(), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + created_by: uuid("created_by") + .notNull() + .references(() => user.id), + }, + (table) => ({ + agentUserUnique: uniqueIndex("agent_permission_agent_id_user_id_unique").on( + table.agent_id, + table.user_id + ), + agentIdIndex: index("agent_permission_agent_id_index").on(table.agent_id), + }) +); + +export type AgentPermission = InferSelectModel; + +export type AgentEnvDeploymentTarget = "production" | "preview"; + +const agentEnvDeploymentTarget = text().$type(); + +export const agent_deployment_target = pgTable( + "agent_deployment_target", + { + id: uuid("id").primaryKey().defaultRandom(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + request_id: uuid("request_id").notNull().defaultRandom().unique(), + target: text("target").notNull(), + }, + (table) => ({ + agentIdTargetUnique: uniqueIndex( + "agent_deployment_target_agent_id_target_unique" + ).on(table.agent_id, table.target), + }) +); + +export type AgentDeploymentCompatibilityVersion = "1" | "2" | "3"; + +export const agent_deployment = pgTable( + "agent_deployment", + { + id: uuid("id").primaryKey().defaultRandom(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + target_id: uuid("target_id") + .notNull() + .references(() => agent_deployment_target.id, { + onDelete: "cascade", + }), + number: integer("number").notNull(), + created_at: timestamp("created_at").notNull().defaultNow(), + created_by: uuid("created_by"), + created_from: text("created_from").$type<"cli">().notNull(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + entrypoint: text("entrypoint").notNull(), + status: varchar("status", { + enum: ["success", "failed", "deploying", "pending"], + }) + .default("pending") + .notNull(), + error_message: text("error_message"), + compatibility_version: text("compatibility_version") + .$type() + .notNull() + .default("1"), + source_files: json("source_files").$type< + Array<{ + path: string; + id: string; + }> + >(), + output_files: json("output_files").$type< + Array<{ + path: string; + id: string; + }> + >(), + // The user message specified to create the deployment. + user_message: text("user_message"), + platform: text("platform").$type<"lambda">().notNull(), + platform_memory_mb: integer("platform_memory_mb").notNull(), + platform_region: text("platform_region"), + platform_metadata: json("platform_metadata").$type<{ + type: "lambda"; + arn: string; + }>(), + direct_access_url: text("direct_access_url"), + }, + (table) => ({ + agentDeploymentUnique: uniqueIndex( + "agent_deployment_agent_id_number_unique" + ).on(table.agent_id, table.number), + }) +); + +export type AgentDeployment = InferSelectModel; + +export const agent_storage_kv = pgTable( + "agent_storage_kv", + { + id: uuid("id").primaryKey().defaultRandom(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + agent_deployment_target_id: uuid("agent_deployment_target_id") + .notNull() + .references(() => agent_deployment_target.id, { + onDelete: "cascade", + }), + key: text("key").notNull(), + value: text("value").notNull(), + }, + (table) => ({ + agentIdTargetKeyUnique: uniqueIndex( + "agent_storage_kv_agent_deployment_target_id_key_unique" + ).on(table.agent_deployment_target_id, table.key), + }) +); + +export type AgentStorageKV = InferSelectModel; + +// chat_run is a collection of steps that are occurring for a chat. +export const chat_run = pgTable( + "chat_run", + { + id: uuid("id").primaryKey().defaultRandom(), + number: integer("number").notNull(), + chat_id: uuid("chat_id") + .notNull() + .references(() => chat.id, { onDelete: "cascade" }), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + // If null, the latest is always used. + agent_deployment_id: uuid("agent_deployment_id"), + created_at: timestamp("created_at").notNull().defaultNow(), + last_step_number: integer("last_step_number").notNull().default(0), + }, + (table) => ({ + chatRunUnique: uniqueIndex("chat_run_chat_id_number_unique").on( + table.chat_id, + table.number + ), + }) +); + +export type ChatRun = InferSelectModel; + +export const chat_run_step = pgTable( + "chat_run_step", + { + id: uuid("id").primaryKey().defaultRandom(), + // Number is the step number in the run. This is nice + // for the user to see the ordering of steps. + number: integer("number").notNull(), + + chat_id: uuid("chat_id") + .notNull() + .references(() => chat.id, { onDelete: "cascade" }), + chat_run_id: uuid("chat_run_id") + .notNull() + .references(() => chat_run.id, { onDelete: "cascade" }), + // We don't want chats to delete if the agent is deleted. + // So we don't use a foreign key here. + agent_id: uuid("agent_id").notNull(), + agent_deployment_id: uuid("agent_deployment_id").notNull(), + + started_at: timestamp("started_at").notNull().defaultNow(), + heartbeat_at: timestamp("heartbeat_at").notNull().defaultNow(), + completed_at: timestamp("completed_at"), + // interrupted_at is the timestamp when the step was interrupted. + interrupted_at: timestamp("interrupted_at"), + + // The first and last messages that were sent to this step. + // These can be null if the step was started with no messages. + first_message_id: uuid("first_message_id"), + last_message_id: uuid("last_message_id"), + + error: text("error"), + response_status: integer("response_status"), + response_headers: json("response_headers").$type>(), + response_headers_redacted: boolean("response_headers_redacted") + .notNull() + .default(false), + response_body: text("response_body"), + response_body_redacted: boolean("response_body_redacted") + .notNull() + .default(false), + // response_message_id is the message that was created as a result + // of this agent run. + response_message_id: uuid("response_message_id"), + continuation_reason: text("continuation_reason").$type< + "tool_call" | "queued_message" + >(), + time_to_first_token_micros: bigint("time_to_first_token_micros", { + mode: "number", + }), + tool_calls_total: integer("tool_calls_total").notNull().default(0), + tool_calls_completed: integer("tool_calls_completed").notNull().default(0), + tool_calls_errored: integer("tool_calls_errored").notNull().default(0), + + // This isn't used yet, but I assume it will be in the future. + usage_cost_usd: doublePrecision("usage_cost_usd"), + usage_model: text("usage_model"), + usage_total_input_tokens: integer("usage_total_input_tokens"), + usage_total_output_tokens: integer("usage_total_output_tokens"), + usage_total_tokens: integer("usage_total_tokens"), + usage_total_cached_input_tokens: integer("usage_total_cached_input_tokens"), + }, + (table) => ({ + chatRunStepUnique: uniqueIndex("chat_run_step_chat_run_id_id_unique").on( + table.chat_run_id, + table.number + ), + + chatRunStepSingleStreaming: uniqueIndex("chat_run_step_single_streaming") + .on(table.chat_id) + .where( + sql`${table.completed_at} IS NULL AND ${table.error} IS NULL AND ${table.interrupted_at} IS NULL` + ), + + chatRunStepAgentIndex: index("chat_run_step_agent_id_started_at_idx").on( + table.agent_id, + table.started_at + ), + chatRunStepDeploymentIndex: index( + "chat_run_step_agent_deployment_id_started_at_idx" + ).on(table.agent_deployment_id, table.started_at), + }) +); + +export type ChatRunStep = InferSelectModel; + +export type ChatRunStepStatus = + | "streaming" + | "stalled" + | "completed" + | "interrupted" + | "error"; + +export const chat_run_step_with_status = pgView("chat_run_step_with_status").as( + (qb) => + qb + .select({ + ...getTableColumns(chat_run_step), + // The ordering here is very important. + // `completed_at` is always set - even on the case of error or interruption. + status: sql`CASE + WHEN ${chat_run_step.error} IS NOT NULL THEN 'error' + WHEN ${chat_run_step.interrupted_at} IS NOT NULL THEN 'interrupted' + WHEN ${chat_run_step.completed_at} IS NOT NULL THEN 'completed' + WHEN ${chat_run_step.continuation_reason} IS NOT NULL THEN 'streaming' + WHEN ${chat_run_step.heartbeat_at} < NOW() - INTERVAL '90 seconds' THEN 'stalled' + ELSE 'streaming' +END`.as("status"), + }) + .from(chat_run_step) +); + +export type ChatRunStepWithStatus = InferSelectViewModel< + typeof chat_run_step_with_status +>; + +export const chat_run_with_status = pgView("chat_run_with_status").as((qb) => + qb + .select({ + ...getTableColumns(chat_run), + agent_id: + sql`COALESCE(${chat_run_step_with_status.agent_id}, ${chat_run.agent_id})`.as( + "agent_id" + ), + agent_deployment_id: sql< + string | null + >`COALESCE(${chat_run_step_with_status.agent_deployment_id}, ${chat_run.agent_deployment_id})`.as( + "agent_deployment_id" + ), + updated_at: + sql`COALESCE(${chat_run_step_with_status.completed_at}, ${chat_run_step_with_status.interrupted_at}, ${chat_run_step_with_status.heartbeat_at}, ${chat_run_step_with_status.started_at}, ${chat_run.created_at})`.as( + "updated_at" + ), + error: chat_run_step_with_status.error, + status: chat_run_step_with_status.status, + }) + .from(chat_run) + .leftJoin( + chat_run_step_with_status, + and( + eq(chat_run.id, chat_run_step_with_status.chat_run_id), + eq(chat_run_step_with_status.number, chat_run.last_step_number) + ) + ) +); + +export type ChatRunWithStatus = InferSelectViewModel< + typeof chat_run_with_status +>; + +// The chat status is a simplified version of the chat run status. +// The reason is because the chat run status is more detailed, and +// the user can always drill-down the run to see the more detailed status. +export type ChatStatus = "streaming" | "idle" | "error" | "interrupted"; + +export const chat_with_status = pgView("chat_with_status").as((qb) => + qb + .select({ + ...getTableColumns(chat), + agent_deployment_id: sql< + string | null + >`COALESCE(${chat_run_with_status.agent_deployment_id}, ${chat.agent_deployment_id})`.as( + "agent_deployment_id" + ), + updated_at: + sql`COALESCE(${chat_run_with_status.updated_at}, ${chat.created_at})`.as( + "updated_at" + ), + error: chat_run_with_status.error, + status: sql`CASE + WHEN ${chat_run_with_status.status} IS NULL THEN 'idle' + WHEN ${chat_run_with_status.status} IN ('error', 'stalled') THEN 'error' + WHEN ${chat_run_with_status.status} = 'interrupted' THEN 'interrupted' + WHEN ${chat_run_with_status.status} IN ('completed', 'idle') THEN 'idle' + ELSE 'streaming' + END`.as("status"), + expires_at: sql`CASE + WHEN ${chat.expire_ttl} IS NULL THEN NULL + ELSE COALESCE(${chat_run_with_status.updated_at}, ${chat.created_at}) + (${chat.expire_ttl} || ' seconds')::interval + END`.as("expires_at"), + }) + .from(chat) + .leftJoin( + chat_run_with_status, + and( + eq(chat.id, chat_run_with_status.chat_id), + eq(chat_run_with_status.number, chat.last_run_number) + ) + ) +); + +export type ChatWithStatus = InferSelectViewModel; + +export type ChatWithStatusAndAgent = ChatWithStatus & { + agent: Agent; +}; + +export const agent_environment_variable = pgTable( + "agent_environment_variable", + { + id: uuid("id").primaryKey().defaultRandom(), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + created_by: uuid("created_by").notNull(), + updated_by: uuid("updated_by").notNull(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + key: text("key").notNull(), + // Legacy plaintext value - will be null for encrypted values + value: text("value"), + // Encrypted value fields (null for legacy plaintext values) + encrypted_value: text("encrypted_value"), + encrypted_dek: text("encrypted_dek"), + encryption_iv: text("encryption_iv"), + encryption_auth_tag: text("encryption_auth_tag"), + secret: boolean("secret").notNull().default(false), + target: agentEnvDeploymentTarget + .array() + .notNull() + .default(["preview", "production"]), + }, + (table) => ({ + agentIdIdx: index("agent_environment_variable_agent_id_idx").on( + table.agent_id + ), + + // This prevents multiple env vars from being created for the same + // key against the same agent in different environments. + agentKeyProdUnique: uniqueIndex("agent_env_key_prod_unique") + .on(table.agent_id, table.key) + .where(sql`'production' = ANY(${table.target})`), + + agentKeyPrevUnique: uniqueIndex("agent_env_key_prev_unique") + .on(table.agent_id, table.key) + .where(sql`'preview' = ANY(${table.target})`), + }) +); + +export type AgentEnvironmentVariable = InferSelectModel< + typeof agent_environment_variable +>; + +export const agent_deployment_log = pgTable("agent_deployment_log", { + id: uuid("id").primaryKey().defaultRandom(), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + deployment_id: integer("deployment_id").notNull(), + level: varchar("level", { + enum: ["log", "info", "warning", "error"], + }).notNull(), + message: text("message").notNull(), +}); + +export type AgentDeploymentLog = InferSelectModel; + +export const api_key = pgTable( + "api_key", + { + id: uuid("id").primaryKey().defaultRandom(), + user_id: uuid("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade" }), + name: varchar("name", { length: 255 }), + key_hash: text("key_hash").notNull(), + // Lookup section of the key ("bk__") + key_lookup: varchar("key_lookup", { length: 12 }).notNull().unique(), + // Prefix for easy identification (e.g. "bk") + key_prefix: varchar("key_prefix", { length: 20 }).notNull(), + // Last 4 characters of the key for identification + key_suffix: varchar("key_suffix", { length: 4 }).notNull(), + scope: varchar("scope", { enum: ["full"] }) + .notNull() + .default("full"), + expires_at: timestamp("expires_at"), + last_used_at: timestamp("last_used_at"), + created_at: timestamp("created_at").notNull().defaultNow(), + updated_at: timestamp("updated_at").notNull().defaultNow(), + revoked_at: timestamp("revoked_at"), + revoked_by: uuid("revoked_by").references(() => user.id, { + onDelete: "set null", + }), + }, + (table) => ({ + userIdx: index("api_key_user_idx").on(table.user_id), + keyLookupIdx: index("api_key_lookup_idx").on(table.key_lookup), + }) +); + +export const agent_log = pgTable( + "agent_log", + { + id: uuid("id").primaryKey().defaultRandom(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + level: varchar("level", { length: 8, enum: ["info", "warn", "error"] }) + .notNull() + .default("info"), + payload: jsonb("payload").$type>().notNull(), + metadata: jsonb("metadata").$type>(), + timestamp: timestamp("timestamp").notNull().defaultNow(), + payload_str: text("payload_str").notNull(), + }, + (table) => ({ + agentTimeIdx: index("agent_log_agent_time_idx").on( + table.agent_id, + table.timestamp.desc() + ), + }) +); + +export type AgentLog = InferSelectModel; + +export const agent_trace = pgTable( + "agent_trace", + { + id: uuid("id").primaryKey().defaultRandom(), + agent_id: uuid("agent_id") + .notNull() + .references(() => agent.id, { onDelete: "cascade" }), + created_at: timestamp("created_at").notNull().defaultNow(), + start_time: timestamp("start_time").notNull(), + end_time: timestamp("end_time").notNull(), + payload: jsonb("payload").$type>().notNull(), + payload_original: text("payload_original").notNull(), + payload_str: text("payload_str").notNull(), + }, + (table) => ({ + agentTimeIdx: index("agent_trace_agent_time_idx").on( + table.agent_id, + table.start_time.desc() + ), + }) +); + +export type AgentTrace = InferSelectModel; +export type ApiKey = InferSelectModel; diff --git a/packages/database/src/shared.ts b/packages/database/src/shared.ts new file mode 100644 index 0000000..14f478a --- /dev/null +++ b/packages/database/src/shared.ts @@ -0,0 +1,71 @@ +// Shared constants that are used on the client and server. + +export const username_format = /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$/; + +// Reserved usernames that cannot be used for organizations or personal accounts. +// These protect important routes and prevent phishing attempts. +export const reserved_usernames = new Set([ + // System routes + "api", + "auth", + "login", + "logout", + "signup", + "register", + "help", + "docs", + "support", + "contact", + "about", + "blog", + + // App routes + "chat", + "agents", + "agent", + "shortcuts", + "integrations", + "user", + "team", + "new", + "recent-chats", + "telemetry", + + // Settings/account + "settings", + "account", + "profile", + "billing", + "admin", + "dashboard", + + // Legal + "privacy", + "terms", + "tos", + "legal", + "security", + + // Technical + "internal", + "webhook", + "webhooks", + "callback", + "verify", + "metrics", + "status", + "health", +]); + +// Compute expiration date from created_at + expire_ttl (in seconds) +// Returns null if expire_ttl is null (chat never expires) +export function computeExpiresAt( + expireTtl: number | null, + createdAt: Date +): Date | null { + if (expireTtl === null) { + return null; + } + + return new Date(createdAt.getTime() + expireTtl * 1000); +} diff --git a/packages/database/src/test.ts b/packages/database/src/test.ts new file mode 100644 index 0000000..98830eb --- /dev/null +++ b/packages/database/src/test.ts @@ -0,0 +1,338 @@ +import { hash } from "bcrypt-ts"; +import type { PgDatabase } from "drizzle-orm/pg-core"; +import { join } from "path"; +import connectToPostgres from "./postgres"; +import Querier from "./querier"; +import type { + Agent, + AgentDeployment, + Chat, + DBMessage, + Organization, + User, +} from "./schema"; + +let runningPostgres: + | Promise<{ + client: PgDatabase; + url: string; + }> + | undefined; +let constraintData: any; +let functionsData: any; +let triggersData: any; +let viewsData: any; + +// createPostgres creates a new fully-migrated PostgreSQL instance. +// It will create a template from an existing instance if it exists. +// +// This helps improve test-times dramatically. +export const createPostgresURL = async (): Promise => { + if (!runningPostgres) { + runningPostgres = spawnPostgres({ + storage: "memory://", + }); + } + const { client, url } = await runningPostgres; + const schemaName = `db${crypto.randomUUID().replace(/-/g, "")}`; + // PGLite does not support multiple databases, so we create a schema instead. + await client.execute(`CREATE SCHEMA ${schemaName}; +DO $$ +DECLARE + t text; +BEGIN + FOR t IN + SELECT tablename + FROM pg_tables + WHERE schemaname = 'public' + LOOP + EXECUTE format( + 'CREATE TABLE ${schemaName}.%I (LIKE public.%I INCLUDING DEFAULTS INCLUDING IDENTITY INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS);', + t, t); + END LOOP; +END$$; + `); + + // Recreate foreign key constraints with proper schema references + if (!constraintData) { + constraintData = await client.execute(` + SELECT + c.relname AS table_name, + con.conname AS constraint_name, + pg_get_constraintdef(con.oid) AS constraint_definition + FROM pg_constraint con + JOIN pg_class c ON c.oid = con.conrelid + JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE con.contype = 'f' + AND n.nspname = 'public' + `); + } + + for (const constraint of constraintData) { + // Replace unqualified table references with schema-qualified ones + const modifiedDef = constraint.constraint_definition + .replace(/REFERENCES "(\w+)"/g, `REFERENCES "${schemaName}"."$1"`) + .replace(/REFERENCES (\w+)\(/g, `REFERENCES "${schemaName}"."$1"(`) + .replace(/REFERENCES public\./g, `REFERENCES "${schemaName}".`); + + // Add the constraint to the new schema table + await client.execute(` + ALTER TABLE "${schemaName}"."${constraint.table_name}" + ADD CONSTRAINT "${constraint.constraint_name}" ${modifiedDef} + `); + } + + // Copy functions from public schema + if (!functionsData) { + functionsData = await client.execute(` + SELECT + p.proname AS function_name, + pg_get_functiondef(p.oid) AS function_definition + FROM pg_proc p + JOIN pg_namespace n ON n.oid = p.pronamespace + WHERE n.nspname = 'public' + AND p.prokind = 'f' + `); + } + + for (const func of functionsData) { + // Replace schema references in function definition + const modifiedFuncDef = func.function_definition + .replace( + /CREATE OR REPLACE FUNCTION public\./g, + `CREATE OR REPLACE FUNCTION "${schemaName}".` + ) + .replace(/FROM public\./g, `FROM "${schemaName}".`) + .replace(/FROM (\w+)/g, `FROM "${schemaName}"."$1"`) + .replace(/INSERT INTO (\w+)/g, `INSERT INTO "${schemaName}"."$1"`) + .replace(/UPDATE (\w+)/g, `UPDATE "${schemaName}"."$1"`) + .replace(/DELETE FROM (\w+)/g, `DELETE FROM "${schemaName}"."$1"`); + + await client.execute(modifiedFuncDef); + } + + // Copy triggers from public schema + if (!triggersData) { + triggersData = await client.execute(` + SELECT + t.tgname AS trigger_name, + c.relname AS table_name, + pg_get_triggerdef(t.oid) AS trigger_definition + FROM pg_trigger t + JOIN pg_class c ON c.oid = t.tgrelid + JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE n.nspname = 'public' + AND NOT t.tgisinternal + `); + } + + for (const trigger of triggersData) { + // Replace schema references in trigger definition + const modifiedTriggerDef = trigger.trigger_definition + .replace(/ON public\./g, `ON "${schemaName}".`) + .replace(/ON (\w+)/g, `ON "${schemaName}"."$1"`) + .replace( + /EXECUTE (?:PROCEDURE|FUNCTION) public\./g, + `EXECUTE FUNCTION "${schemaName}".` + ) + .replace( + /EXECUTE (?:PROCEDURE|FUNCTION) (\w+)/g, + `EXECUTE FUNCTION "${schemaName}"."$1"` + ); + + await client.execute(modifiedTriggerDef); + } + + // Copy views from public schema (handles inter-view dependencies) + if (!viewsData) { + viewsData = await client.execute(` + SELECT + c.relname AS view_name, + pg_get_viewdef(c.oid, true) AS view_definition + FROM pg_class c + JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = 'v' -- plain views + AND n.nspname = 'public' + AND c.relname NOT LIKE 'pg_%' + `); + } + + const queue = [...viewsData]; + const seen = new Set(); + + while (queue.length) { + const v = queue.shift(); + + try { + // Use SET LOCAL so unqualified names bind to the target schema at CREATE time. + await client.execute("BEGIN"); + await client.execute(`SET LOCAL search_path TO "${schemaName}", pg_temp`); + + // Nudge any explicit public qualifiers to the new schema. + const def = v.view_definition + .replace(/"public"\./g, `"${schemaName}".`) + .replace(/\bpublic\./g, `"${schemaName}".`); + + await client.execute( + `CREATE VIEW "${schemaName}"."${v.view_name}" AS ${def}` + ); + + await client.execute("COMMIT"); + seen.delete(v.view_name); + } catch (err) { + await client.execute("ROLLBACK"); + + // If dependencies aren't ready yet, retry later; otherwise surface the error. + const msg = String((err as Error)?.message ?? ""); + if (/relation .* does not exist|42P01/.test(msg)) { + if (seen.has(v.view_name)) { + throw new Error( + `Could not resolve dependencies for view "${v.view_name}": ${msg}` + ); + } + seen.add(v.view_name); + queue.push(v); + } else { + throw err; + } + } + } + + // Return a connection to the new schema. + return url + "/" + schemaName; +}; + +export interface PostgresOptions { + storage?: string; + password?: string; + port?: number; +} + +export const spawnPostgres = async (options?: PostgresOptions) => { + return new Promise<{ + client: PgDatabase; + url: string; + }>((resolve, reject) => { + const worker = new Worker( + new URL(join(__dirname, "./postgres-worker.ts"), import.meta.url), + { + type: "module", + } + ); + worker.postMessage(options ?? {}); + worker.onmessage = (e) => { + connectToPostgres(e.data.url) + .then((db) => { + resolve({ + client: db, + url: e.data.url, + }); + }) + .catch(reject); + }; + worker.onerror = (e) => { + reject(e); + }; + }); +}; + +export const createTestUser = async (db: Querier, user?: Partial) => { + if (user?.password) { + user.password = await hash(user.password, 12); + } + return db.insertUser({ + email: `${crypto.randomUUID()}@test.com`, + display_name: "Test User", + email_verified: null, + password: user?.password ?? "", + ...user, + }); +}; + +export const createTestOrganization = async ( + db: Querier, + organization?: Partial +) => { + const createdBy = organization?.created_by ?? crypto.randomUUID(); + return db.insertOrganizationWithMembership({ + name: "test-organization", + created_by: createdBy, + ...organization, + }); +}; + +export const createTestChat = async ( + db: Querier, + chat: Partial & Pick +) => { + return db.insertChat({ + id: crypto.randomUUID(), + created_by: chat?.created_by ?? crypto.randomUUID() ?? null, + organization_id: crypto.randomUUID(), + created_at: new Date(), + title: "Test Chat", + visibility: "public", + agent_key: "test", + ...chat, + }); +}; + +export const createTestAgent = async (db: Querier, agent?: Partial) => { + return db.insertAgent({ + id: crypto.randomUUID(), + created_by: agent?.created_by ?? crypto.randomUUID(), + organization_id: agent?.organization_id ?? crypto.randomUUID(), + name: "test-agent", + avatar_file_id: null, + ...agent, + }); +}; + +export const createTestAgentDeployment = async ( + db: Querier, + agentDeployment: Partial & + Pick +) => { + if (!agentDeployment.target_id) { + // Select the default production target. + const target = await db.selectAgentDeploymentTargetByName( + agentDeployment.agent_id, + "production" + ); + if (!target) { + throw new Error("No default production target for agent"); + } + agentDeployment.target_id = target.id; + } + + return db.insertAgentDeployment({ + id: crypto.randomUUID(), + entrypoint: "test", + target_id: "never", + status: "success", + created_at: new Date(), + updated_at: new Date(), + created_from: "cli", + platform: "lambda", + platform_memory_mb: 256, + ...agentDeployment, + }); +}; + +export const createTestMessage = async ( + db: Querier, + message?: Partial +) => { + return db.insertMessages({ + messages: [ + { + id: crypto.randomUUID(), + chat_id: crypto.randomUUID(), + role: "user", + parts: [], + user_id: crypto.randomUUID(), + ...message, + }, + ], + }); +}; diff --git a/packages/database/src/usage-queries.test.ts b/packages/database/src/usage-queries.test.ts new file mode 100644 index 0000000..bc32df1 --- /dev/null +++ b/packages/database/src/usage-queries.test.ts @@ -0,0 +1,654 @@ +import { beforeEach, describe, expect, test } from "bun:test"; +import type { PgInsertValue, PgTable } from "drizzle-orm/pg-core"; +import connectToPostgres from "./postgres"; +import Querier from "./querier"; +import { + createPostgresURL, + createTestAgent, + createTestAgentDeployment, + createTestChat, + createTestOrganization, + createTestUser, +} from "./test"; + +type Insertable = never> = { + [P in keyof PgInsertValue as P extends K ? never : P]: PgInsertValue[P]; +} & { + [P in keyof PgInsertValue as P extends K ? P : never]?: + | PgInsertValue[P] + | undefined; +}; + +describe("Agent Usage Queries", () => { + let querier: Querier; + let userId: string; + let orgId: string; + let agentId: string; + let deploymentId: string; + let chatId: string; + + beforeEach(async () => { + const url = await createPostgresURL(); + querier = new Querier(await connectToPostgres(url)); + + const user = await createTestUser(querier); + userId = user.id; + + const org = await createTestOrganization(querier, { created_by: userId }); + orgId = org.id; + + const agent = await createTestAgent(querier, { + created_by: userId, + organization_id: orgId, + }); + agentId = agent.id; + + const deployment = await createTestAgentDeployment(querier, { + agent_id: agentId, + created_by: userId, + }); + deploymentId = deployment.id; + + const chat = await createTestChat(querier, { + agent_id: agentId, + created_by: userId, + organization_id: orgId, + }); + chatId = chat.id; + }); + + async function createChatRunStep(options: { + startedAt: Date; + completedAt?: Date; + inputTokens?: number; + outputTokens?: number; + cachedTokens?: number; + model?: string; + ttftMicros?: number; + }) { + // Use reconcileChatRun to create the chat run and first step + await querier.reconcileChatRun({ + behavior: "interrupt", + chat_id: chatId, + agent_id: agentId, + agent_deployment_id: deploymentId, + }); + + // Get the latest run to get the run ID + const run = await querier.selectLatestChatRun(chatId); + if (!run) { + throw new Error("Failed to create chat run"); + } + + // Get the created step + const steps = await querier.selectChatSteps({ + chat_id: chatId, + limit: 1, + }); + if (!steps.items || steps.items.length === 0) { + throw new Error("Failed to get chat run step"); + } + const latestStep = steps.items[0]; + + // Update the step with our custom values + await querier.updateChatRunStep({ + id: latestStep.id, + started_at: options.startedAt, + completed_at: options.completedAt, + usage_total_input_tokens: options.inputTokens, + usage_total_output_tokens: options.outputTokens, + usage_total_cached_input_tokens: options.cachedTokens, + usage_model: options.model, + time_to_first_token_micros: options.ttftMicros, + }); + + return latestStep; + } + + test("selectAgentTokenUsageStats returns correct totals", async () => { + const now = new Date(); + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + cachedTokens: 20, + model: "gpt-4", + ttftMicros: 100000, + }); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 200, + outputTokens: 100, + cachedTokens: 30, + model: "gpt-4", + ttftMicros: 150000, + }); + + const stats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate: new Date(oneDayAgo.getTime() - 1000), + endDate: new Date(now.getTime() + 1000), + }); + + expect(stats.total_input_tokens).toBe(300); + expect(stats.total_output_tokens).toBe(150); + expect(stats.total_cached_tokens).toBe(50); + expect(stats.avg_ttft_ms).toBe(125); + expect(stats.models).toContain("gpt-4"); + }); + + test("selectAgentTokenUsageStats filters by date range correctly", async () => { + const now = new Date(); + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + const twoDaysAgo = new Date(now.getTime() - 2 * 24 * 60 * 60 * 1000); + + // Step from 2 days ago (should be excluded) + await createChatRunStep({ + startedAt: twoDaysAgo, + completedAt: twoDaysAgo, + inputTokens: 1000, + outputTokens: 1000, + cachedTokens: 1000, + model: "gpt-4", + }); + + // Step from 1 day ago (should be included) + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + cachedTokens: 20, + model: "gpt-4", + }); + + const stats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate: oneDayAgo, + endDate: now, + }); + + expect(stats.total_input_tokens).toBe(100); + expect(stats.total_output_tokens).toBe(50); + expect(stats.total_cached_tokens).toBe(20); + }); + + test("selectAgentChatsWithGranularity counts unique chats", async () => { + const now = new Date(); + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + + // Create 3 steps for the same chat + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + // Create a different chat + const chat2 = await createTestChat(querier, { + agent_id: agentId, + created_by: userId, + organization_id: orgId, + }); + const oldChatId = chatId; + chatId = chat2.id; + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + chatId = oldChatId; + + const chats = await querier.selectAgentChatsWithGranularity({ + agentID: agentId, + startDate: new Date(oneDayAgo.getTime() - 1000), + endDate: new Date(now.getTime() + 1000), + granularity: "1 day", + }); + + expect(chats.length).toBeGreaterThan(0); + const totalUniqueChats = chats.reduce((sum, c) => sum + c.unique_chats, 0); + expect(totalUniqueChats).toBe(2); + }); + + test("selectAgentRuntimeWithGranularity calculates runtime correctly", async () => { + const now = new Date(); + const startTime = new Date(now.getTime() - 60 * 60 * 1000); // 1 hour ago + const endTime = new Date(now.getTime() - 30 * 60 * 1000); // 30 minutes ago + + await createChatRunStep({ + startedAt: startTime, + completedAt: endTime, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const runtime = await querier.selectAgentRuntimeWithGranularity({ + agentID: agentId, + startDate: new Date(startTime.getTime() - 1000), + endDate: new Date(now.getTime() + 1000), + granularity: "1 hour", + }); + + expect(runtime.length).toBeGreaterThan(0); + const totalRuntime = runtime.reduce((sum, r) => sum + r.runtime_seconds, 0); + // Should be approximately 30 minutes (1800 seconds) + expect(totalRuntime).toBeGreaterThan(1700); + expect(totalRuntime).toBeLessThan(1900); + }); + + test("selectAgentTokenUsageByModelWithGranularity aggregates by model", async () => { + const now = new Date(); + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + cachedTokens: 10, + model: "gpt-4", + }); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 200, + outputTokens: 100, + cachedTokens: 20, + model: "gpt-3.5-turbo", + }); + + const usage = await querier.selectAgentTokenUsageByModelWithGranularity({ + agentID: agentId, + startDate: new Date(oneDayAgo.getTime() - 1000), + endDate: new Date(now.getTime() + 1000), + granularity: "1 day", + }); + + expect(usage.length).toBe(2); + + const gpt4Usage = usage.find((u) => u.model === "gpt-4"); + expect(gpt4Usage).toBeDefined(); + expect(gpt4Usage!.input_tokens).toBe(100); + expect(gpt4Usage!.output_tokens).toBe(50); + expect(gpt4Usage!.cached_tokens).toBe(10); + + const gpt35Usage = usage.find((u) => u.model === "gpt-3.5-turbo"); + expect(gpt35Usage).toBeDefined(); + expect(gpt35Usage!.input_tokens).toBe(200); + expect(gpt35Usage!.output_tokens).toBe(100); + expect(gpt35Usage!.cached_tokens).toBe(20); + }); + + test("selectAgentTTFTByModelWithGranularity calculates average TTFT", async () => { + const now = new Date(); + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + ttftMicros: 100000, // 100ms + }); + + await createChatRunStep({ + startedAt: oneDayAgo, + completedAt: now, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + ttftMicros: 200000, // 200ms + }); + + const ttft = await querier.selectAgentTTFTByModelWithGranularity({ + agentID: agentId, + startDate: new Date(oneDayAgo.getTime() - 1000), + endDate: new Date(now.getTime() + 1000), + granularity: "1 day", + }); + + expect(ttft.length).toBe(1); + expect(ttft[0].model).toBe("gpt-4"); + expect(ttft[0].avg_ttft_ms).toBe(150); + }); + + test("24h granularity with hourly buckets", async () => { + const now = new Date(); + const oneDayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000); + + // Create steps in different hours + const hour1 = new Date(oneDayAgo.getTime() + 60 * 60 * 1000); + const hour2 = new Date(oneDayAgo.getTime() + 2 * 60 * 60 * 1000); + + await createChatRunStep({ + startedAt: hour1, + completedAt: hour1, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + await createChatRunStep({ + startedAt: hour2, + completedAt: hour2, + inputTokens: 200, + outputTokens: 100, + model: "gpt-4", + }); + + const usage = await querier.selectAgentTokenUsageByModelWithGranularity({ + agentID: agentId, + startDate: oneDayAgo, + endDate: now, + granularity: "1 hour", + }); + + expect(usage.length).toBe(2); + }); + + test("30d granularity with daily buckets", async () => { + const now = new Date(); + const thirtyDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000); + + // Create steps on different days + const day1 = new Date(thirtyDaysAgo.getTime() + 24 * 60 * 60 * 1000); + const day2 = new Date(thirtyDaysAgo.getTime() + 2 * 24 * 60 * 60 * 1000); + + await createChatRunStep({ + startedAt: day1, + completedAt: day1, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + await createChatRunStep({ + startedAt: day2, + completedAt: day2, + inputTokens: 200, + outputTokens: 100, + model: "gpt-4", + }); + + const usage = await querier.selectAgentTokenUsageByModelWithGranularity({ + agentID: agentId, + startDate: thirtyDaysAgo, + endDate: now, + granularity: "1 day", + }); + + expect(usage.length).toBe(2); + }); + + test("page simulation: 24h range with real date calculation", async () => { + const endTime = new Date(); + const startTime = new Date(); + startTime.setDate(startTime.getDate() - 1); + + // Create a step that's exactly 12 hours ago + const twelveHoursAgo = new Date(endTime.getTime() - 12 * 60 * 60 * 1000); + + await createChatRunStep({ + startedAt: twelveHoursAgo, + completedAt: twelveHoursAgo, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + // This should find the step + const tokenStats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate: startTime, + endDate: endTime, + }); + + expect(tokenStats.total_input_tokens).toBe(100); + expect(tokenStats.total_output_tokens).toBe(50); + }); + + test("page simulation: 30d range with day boundary normalization", async () => { + const endTime = new Date(); + const startTime = new Date(); + startTime.setDate(startTime.getDate() - 30); + + // Normalize to day boundaries like the page does + startTime.setHours(0, 0, 0, 0); + endTime.setHours(23, 59, 59, 999); + + // Create a step at the very start of today + const todayStart = new Date(); + todayStart.setHours(0, 0, 0, 1); + + await createChatRunStep({ + startedAt: todayStart, + completedAt: todayStart, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + // Create a step at the very end of today + const todayEnd = new Date(); + todayEnd.setHours(23, 59, 59, 0); + + await createChatRunStep({ + startedAt: todayEnd, + completedAt: todayEnd, + inputTokens: 200, + outputTokens: 100, + model: "gpt-4", + }); + + // Both should be included + const tokenStats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate: startTime, + endDate: endTime, + }); + + expect(tokenStats.total_input_tokens).toBe(300); + expect(tokenStats.total_output_tokens).toBe(150); + }); + + test("edge case: step started exactly at startDate boundary", async () => { + const startDate = new Date("2025-01-01T00:00:00.000Z"); + const endDate = new Date("2025-01-02T23:59:59.999Z"); + + await createChatRunStep({ + startedAt: new Date("2025-01-01T00:00:00.000Z"), + completedAt: new Date("2025-01-01T00:00:00.100Z"), + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const tokenStats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate, + endDate, + }); + + expect(tokenStats.total_input_tokens).toBe(100); + }); + + test("edge case: step started exactly at endDate boundary", async () => { + const startDate = new Date("2025-01-01T00:00:00.000Z"); + const endDate = new Date("2025-01-02T23:59:59.999Z"); + + await createChatRunStep({ + startedAt: new Date("2025-01-02T23:59:59.999Z"), + completedAt: new Date("2025-01-02T23:59:59.999Z"), + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const tokenStats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate, + endDate, + }); + + expect(tokenStats.total_input_tokens).toBe(100); + }); + + test("edge case: step started 1ms before startDate should be excluded", async () => { + const startDate = new Date("2025-01-01T00:00:00.000Z"); + const endDate = new Date("2025-01-02T23:59:59.999Z"); + + await createChatRunStep({ + startedAt: new Date("2024-12-31T23:59:59.999Z"), + completedAt: new Date("2025-01-01T00:00:00.100Z"), + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const tokenStats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate, + endDate, + }); + + expect(tokenStats.total_input_tokens).toBe(0); + }); + + test("edge case: step started 1ms after endDate should be excluded", async () => { + const startDate = new Date("2025-01-01T00:00:00.000Z"); + const endDate = new Date("2025-01-02T23:59:59.999Z"); + + await createChatRunStep({ + startedAt: new Date("2025-01-03T00:00:00.000Z"), + completedAt: new Date("2025-01-03T00:00:00.100Z"), + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const tokenStats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate, + endDate, + }); + + expect(tokenStats.total_input_tokens).toBe(0); + }); + + test("reproduce issue: exact date calculation from page logic", async () => { + // Simulate the exact logic from page.tsx + function getTimeRangeConfig(range: "24h" | "7d" | "30d"): { + days: number; + granularity: "1 hour" | "1 day"; + } { + switch (range) { + case "24h": + return { days: 1, granularity: "1 hour" }; + case "7d": + return { days: 7, granularity: "1 hour" }; + case "30d": + return { days: 30, granularity: "1 day" }; + } + } + + // Test 30d range + const range = "30d"; + const { days, granularity } = getTimeRangeConfig(range); + + const endTime = new Date(); + const startTime = new Date(); + startTime.setDate(startTime.getDate() - days); + + if (granularity === "1 day") { + startTime.setHours(0, 0, 0, 0); + endTime.setHours(23, 59, 59, 999); + } + + // Insert data 15 days ago + const fifteenDaysAgo = new Date( + endTime.getTime() - 15 * 24 * 60 * 60 * 1000 + ); + fifteenDaysAgo.setHours(12, 0, 0, 0); + + await createChatRunStep({ + startedAt: fifteenDaysAgo, + completedAt: fifteenDaysAgo, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const stats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate: startTime, + endDate: endTime, + }); + + // This data should definitely be included + expect(stats.total_input_tokens).toBe(100); + expect(stats.total_output_tokens).toBe(50); + }); + + test("timezone issue: local time normalization may not match database timezone", async () => { + // This test demonstrates a potential timezone issue + // The page does: endTime.setHours(23, 59, 59, 999) + // But this creates a local time, which when passed to Postgres + // might be interpreted differently depending on timezone settings + + const endTime = new Date(); + const startTime = new Date(); + startTime.setDate(startTime.getDate() - 30); + + startTime.setHours(0, 0, 0, 0); + endTime.setHours(23, 59, 59, 999); + + console.log("Start time (local):", startTime.toISOString()); + console.log("End time (local):", endTime.toISOString()); + console.log("Start time (string):", startTime.toString()); + console.log("End time (string):", endTime.toString()); + + // Create a step that should be included + const midDay = new Date(); + midDay.setHours(12, 0, 0, 0); + + await createChatRunStep({ + startedAt: midDay, + completedAt: midDay, + inputTokens: 100, + outputTokens: 50, + model: "gpt-4", + }); + + const stats = await querier.selectAgentTokenUsageStats({ + agentID: agentId, + startDate: startTime, + endDate: endTime, + }); + + // This should work, but let's verify the actual behavior + expect(stats.total_input_tokens).toBe(100); + }); +}); diff --git a/packages/database/tsconfig.json b/packages/database/tsconfig.json new file mode 100644 index 0000000..1183e7f --- /dev/null +++ b/packages/database/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "incremental": true, + "verbatimModuleSyntax": true, + "module": "esnext", + "esModuleInterop": true, + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + }, + "types": ["bun-types"] + }, + "include": ["**/*.ts", "**/*.tsx"], + "exclude": ["node_modules", ".next"] +} diff --git a/packages/database/tsconfig.tsbuildinfo b/packages/database/tsconfig.tsbuildinfo new file mode 100644 index 0000000..5354ac8 --- /dev/null +++ b/packages/database/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"version":"7.0.0-dev.20251005.1","root":[193,499,[512,513],[522,524],[658,662],[664,665],[756,758],[762,766]],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.intl.d.ts","lib.esnext.disposable.d.ts","lib.esnext.promise.d.ts","lib.esnext.decorators.d.ts","lib.esnext.iterator.d.ts","lib.esnext.float16.d.ts","lib.esnext.error.d.ts","lib.esnext.sharedmemory.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../node_modules/@types/node/compatibility/iterators.d.ts","../../node_modules/@types/node/globals.typedarray.d.ts","../../node_modules/@types/node/buffer.buffer.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../node_modules/@types/node/web-globals/crypto.d.ts","../../node_modules/@types/node/web-globals/domexception.d.ts","../../node_modules/@types/node/web-globals/events.d.ts","../../node_modules/buffer/index.d.ts","../../node_modules/undici-types/utility.d.ts","../../node_modules/undici-types/header.d.ts","../../node_modules/undici-types/readable.d.ts","../../node_modules/undici-types/fetch.d.ts","../../node_modules/undici-types/formdata.d.ts","../../node_modules/undici-types/connector.d.ts","../../node_modules/undici-types/client-stats.d.ts","../../node_modules/undici-types/client.d.ts","../../node_modules/undici-types/errors.d.ts","../../node_modules/undici-types/dispatcher.d.ts","../../node_modules/undici-types/global-dispatcher.d.ts","../../node_modules/undici-types/global-origin.d.ts","../../node_modules/undici-types/pool-stats.d.ts","../../node_modules/undici-types/pool.d.ts","../../node_modules/undici-types/handlers.d.ts","../../node_modules/undici-types/balanced-pool.d.ts","../../node_modules/undici-types/h2c-client.d.ts","../../node_modules/undici-types/agent.d.ts","../../node_modules/undici-types/mock-interceptor.d.ts","../../node_modules/undici-types/mock-call-history.d.ts","../../node_modules/undici-types/mock-agent.d.ts","../../node_modules/undici-types/mock-client.d.ts","../../node_modules/undici-types/mock-pool.d.ts","../../node_modules/undici-types/snapshot-agent.d.ts","../../node_modules/undici-types/mock-errors.d.ts","../../node_modules/undici-types/proxy-agent.d.ts","../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../node_modules/undici-types/retry-handler.d.ts","../../node_modules/undici-types/retry-agent.d.ts","../../node_modules/undici-types/api.d.ts","../../node_modules/undici-types/cache-interceptor.d.ts","../../node_modules/undici-types/interceptors.d.ts","../../node_modules/undici-types/util.d.ts","../../node_modules/undici-types/cookies.d.ts","../../node_modules/undici-types/patch.d.ts","../../node_modules/undici-types/websocket.d.ts","../../node_modules/undici-types/eventsource.d.ts","../../node_modules/undici-types/diagnostics-channel.d.ts","../../node_modules/undici-types/content-type.d.ts","../../node_modules/undici-types/cache.d.ts","../../node_modules/undici-types/index.d.ts","../../node_modules/@types/node/web-globals/fetch.d.ts","../../node_modules/@types/node/web-globals/navigator.d.ts","../../node_modules/@types/node/web-globals/storage.d.ts","../../node_modules/@types/node/web-globals/streams.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/inspector.generated.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/readline/promises.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/sea.d.ts","../../node_modules/@types/node/sqlite.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/dotenv/lib/main.d.ts","../../node_modules/drizzle-kit/index.d.mts","./drizzle.config.ts","../../node_modules/@electric-sql/pglite/dist/pglite-BPiZge4p.d.ts","../../node_modules/@electric-sql/pglite/dist/index.d.ts","../../node_modules/@electric-sql/pglite/dist/contrib/uuid_ossp.d.ts","../../node_modules/@electric-sql/pglite/dist/vector/index.d.ts","../../node_modules/drizzle-orm/entity.d.ts","../../node_modules/drizzle-orm/logger.d.ts","../../node_modules/drizzle-orm/casing.d.ts","../../node_modules/drizzle-orm/table.d.ts","../../node_modules/drizzle-orm/operations.d.ts","../../node_modules/drizzle-orm/subquery.d.ts","../../node_modules/drizzle-orm/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/sql/sql.d.ts","../../node_modules/drizzle-orm/utils.d.ts","../../node_modules/drizzle-orm/sql/expressions/conditions.d.ts","../../node_modules/drizzle-orm/sql/expressions/select.d.ts","../../node_modules/drizzle-orm/sql/expressions/index.d.ts","../../node_modules/drizzle-orm/sql/functions/aggregate.d.ts","../../node_modules/drizzle-orm/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/sql/functions/vector.d.ts","../../node_modules/drizzle-orm/sql/functions/index.d.ts","../../node_modules/drizzle-orm/sql/index.d.ts","../../node_modules/drizzle-orm/gel-core/checks.d.ts","../../node_modules/drizzle-orm/gel-core/sequence.d.ts","../../node_modules/drizzle-orm/gel-core/columns/int.common.d.ts","../../node_modules/drizzle-orm/gel-core/columns/bigintT.d.ts","../../node_modules/drizzle-orm/gel-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/gel-core/columns/bytes.d.ts","../../node_modules/drizzle-orm/gel-core/columns/custom.d.ts","../../node_modules/drizzle-orm/gel-core/columns/date-duration.d.ts","../../node_modules/drizzle-orm/gel-core/columns/decimal.d.ts","../../node_modules/drizzle-orm/gel-core/columns/double-precision.d.ts","../../node_modules/drizzle-orm/gel-core/columns/duration.d.ts","../../node_modules/drizzle-orm/gel-core/columns/integer.d.ts","../../node_modules/drizzle-orm/gel-core/columns/json.d.ts","../../node_modules/drizzle-orm/gel-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/gel-core/columns/localdate.d.ts","../../node_modules/drizzle-orm/gel-core/columns/localtime.d.ts","../../node_modules/drizzle-orm/gel-core/columns/real.d.ts","../../node_modules/drizzle-orm/gel-core/columns/relative-duration.d.ts","../../node_modules/drizzle-orm/gel-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/gel-core/columns/text.d.ts","../../node_modules/drizzle-orm/gel-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/gel-core/columns/timestamptz.d.ts","../../node_modules/drizzle-orm/gel-core/columns/uuid.d.ts","../../node_modules/drizzle-orm/gel-core/columns/all.d.ts","../../node_modules/drizzle-orm/gel-core/indexes.d.ts","../../node_modules/drizzle-orm/gel-core/roles.d.ts","../../node_modules/drizzle-orm/gel-core/policies.d.ts","../../node_modules/drizzle-orm/gel-core/primary-keys.d.ts","../../node_modules/drizzle-orm/gel-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/gel-core/table.d.ts","../../node_modules/drizzle-orm/gel-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/gel-core/columns/common.d.ts","../../node_modules/drizzle-orm/gel-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/gel-core/columns/index.d.ts","../../node_modules/drizzle-orm/gel-core/view-base.d.ts","../../node_modules/drizzle-orm/cache/core/types.d.ts","../../node_modules/drizzle-orm/relations.d.ts","../../node_modules/drizzle-orm/session.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/query-promise.d.ts","../../node_modules/drizzle-orm/runnable-query.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/raw.d.ts","../../node_modules/drizzle-orm/gel-core/subquery.d.ts","../../node_modules/drizzle-orm/gel-core/db.d.ts","../../node_modules/drizzle-orm/gel-core/session.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/refresh-materialized-view.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/gel-core/dialect.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/gel-core/view-common.d.ts","../../node_modules/drizzle-orm/gel-core/view.d.ts","../../node_modules/drizzle-orm/gel-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/gel-core/alias.d.ts","../../node_modules/drizzle-orm/gel-core/schema.d.ts","../../node_modules/drizzle-orm/gel-core/utils.d.ts","../../node_modules/drizzle-orm/gel-core/index.d.ts","../../node_modules/drizzle-orm/mysql-core/checks.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/binary.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/char.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/custom.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/date.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/datetime.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/decimal.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/double.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/enum.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/float.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/int.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/json.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/mediumint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/real.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/serial.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/text.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/time.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/tinyint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/varbinary.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/varchar.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/year.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/all.d.ts","../../node_modules/drizzle-orm/mysql-core/indexes.d.ts","../../node_modules/drizzle-orm/mysql-core/primary-keys.d.ts","../../node_modules/drizzle-orm/mysql-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/mysql-core/table.d.ts","../../node_modules/drizzle-orm/mysql-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/common.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/mysql-core/columns/index.d.ts","../../node_modules/drizzle-orm/migrator.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/mysql-core/subquery.d.ts","../../node_modules/drizzle-orm/mysql-core/view-base.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/mysql-core/dialect.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/mysql-core/db.d.ts","../../node_modules/drizzle-orm/mysql-core/session.d.ts","../../node_modules/drizzle-orm/mysql-core/view-common.d.ts","../../node_modules/drizzle-orm/mysql-core/view.d.ts","../../node_modules/drizzle-orm/mysql-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/mysql-core/alias.d.ts","../../node_modules/drizzle-orm/mysql-core/schema.d.ts","../../node_modules/drizzle-orm/mysql-core/utils.d.ts","../../node_modules/drizzle-orm/mysql-core/index.d.ts","../../node_modules/drizzle-orm/pg-core/checks.d.ts","../../node_modules/drizzle-orm/pg-core/columns/bigserial.d.ts","../../node_modules/drizzle-orm/pg-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/pg-core/columns/char.d.ts","../../node_modules/drizzle-orm/pg-core/columns/cidr.d.ts","../../node_modules/drizzle-orm/pg-core/columns/custom.d.ts","../../node_modules/drizzle-orm/pg-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/pg-core/columns/date.d.ts","../../node_modules/drizzle-orm/pg-core/columns/double-precision.d.ts","../../node_modules/drizzle-orm/pg-core/columns/inet.d.ts","../../node_modules/drizzle-orm/pg-core/sequence.d.ts","../../node_modules/drizzle-orm/pg-core/columns/int.common.d.ts","../../node_modules/drizzle-orm/pg-core/columns/integer.d.ts","../../node_modules/drizzle-orm/pg-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/pg-core/columns/interval.d.ts","../../node_modules/drizzle-orm/pg-core/columns/json.d.ts","../../node_modules/drizzle-orm/pg-core/columns/jsonb.d.ts","../../node_modules/drizzle-orm/pg-core/columns/line.d.ts","../../node_modules/drizzle-orm/pg-core/columns/macaddr.d.ts","../../node_modules/drizzle-orm/pg-core/columns/macaddr8.d.ts","../../node_modules/drizzle-orm/pg-core/columns/numeric.d.ts","../../node_modules/drizzle-orm/pg-core/columns/point.d.ts","../../node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.d.ts","../../node_modules/drizzle-orm/pg-core/columns/real.d.ts","../../node_modules/drizzle-orm/pg-core/columns/serial.d.ts","../../node_modules/drizzle-orm/pg-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/pg-core/columns/smallserial.d.ts","../../node_modules/drizzle-orm/pg-core/columns/text.d.ts","../../node_modules/drizzle-orm/pg-core/columns/time.d.ts","../../node_modules/drizzle-orm/pg-core/columns/uuid.d.ts","../../node_modules/drizzle-orm/pg-core/columns/varchar.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.d.ts","../../node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.d.ts","../../node_modules/drizzle-orm/pg-core/columns/all.d.ts","../../node_modules/drizzle-orm/pg-core/indexes.d.ts","../../node_modules/drizzle-orm/pg-core/roles.d.ts","../../node_modules/drizzle-orm/pg-core/policies.d.ts","../../node_modules/drizzle-orm/pg-core/primary-keys.d.ts","../../node_modules/drizzle-orm/pg-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/pg-core/table.d.ts","../../node_modules/drizzle-orm/pg-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/pg-core/columns/common.d.ts","../../node_modules/drizzle-orm/pg-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/pg-core/columns/enum.d.ts","../../node_modules/drizzle-orm/pg-core/columns/index.d.ts","../../node_modules/drizzle-orm/pg-core/view-base.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/raw.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.d.ts","../../node_modules/drizzle-orm/pg-core/subquery.d.ts","../../node_modules/drizzle-orm/pg-core/db.d.ts","../../node_modules/drizzle-orm/pg-core/session.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/pg-core/dialect.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/pg-core/view-common.d.ts","../../node_modules/drizzle-orm/pg-core/view.d.ts","../../node_modules/drizzle-orm/pg-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/pg-core/alias.d.ts","../../node_modules/drizzle-orm/pg-core/schema.d.ts","../../node_modules/drizzle-orm/pg-core/utils.d.ts","../../node_modules/drizzle-orm/pg-core/utils/array.d.ts","../../node_modules/drizzle-orm/pg-core/utils/index.d.ts","../../node_modules/drizzle-orm/pg-core/index.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/binary.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/boolean.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/char.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/custom.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/date.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/datetime.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/decimal.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/double.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/enum.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/float.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/int.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/json.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/mediumint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/real.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/serial.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/smallint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/text.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/time.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/date.common.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/timestamp.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/tinyint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/varbinary.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/varchar.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/vector.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/year.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/all.d.ts","../../node_modules/drizzle-orm/singlestore-core/indexes.d.ts","../../node_modules/drizzle-orm/singlestore-core/primary-keys.d.ts","../../node_modules/drizzle-orm/singlestore-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/singlestore-core/table.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/common.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/bigint.d.ts","../../node_modules/drizzle-orm/singlestore-core/columns/index.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/singlestore-core/dialect.d.ts","../../node_modules/drizzle-orm/cache/core/index.d.ts","../../node_modules/drizzle-orm/singlestore/session.d.ts","../../node_modules/drizzle-orm/singlestore/driver.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/singlestore-core/subquery.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/singlestore-core/db.d.ts","../../node_modules/drizzle-orm/singlestore-core/session.d.ts","../../node_modules/drizzle-orm/singlestore-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/singlestore-core/alias.d.ts","../../node_modules/drizzle-orm/singlestore-core/schema.d.ts","../../node_modules/drizzle-orm/singlestore-core/utils.d.ts","../../node_modules/drizzle-orm/singlestore-core/index.d.ts","../../node_modules/drizzle-orm/sqlite-core/checks.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/custom.d.ts","../../node_modules/drizzle-orm/sqlite-core/indexes.d.ts","../../node_modules/drizzle-orm/sqlite-core/primary-keys.d.ts","../../node_modules/drizzle-orm/sqlite-core/unique-constraint.d.ts","../../node_modules/drizzle-orm/sqlite-core/view-base.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/count.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/query.d.ts","../../node_modules/drizzle-orm/sqlite-core/subquery.d.ts","../../node_modules/drizzle-orm/sqlite-core/db.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/raw.d.ts","../../node_modules/drizzle-orm/sqlite-core/session.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/delete.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/update.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/select.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/index.d.ts","../../node_modules/drizzle-orm/sqlite-core/dialect.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/query-builder.d.ts","../../node_modules/drizzle-orm/sqlite-core/view.d.ts","../../node_modules/drizzle-orm/sqlite-core/utils.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/integer.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/numeric.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/real.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/text.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/all.d.ts","../../node_modules/drizzle-orm/sqlite-core/table.d.ts","../../node_modules/drizzle-orm/sqlite-core/foreign-keys.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/common.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts","../../node_modules/drizzle-orm/sqlite-core/columns/index.d.ts","../../node_modules/drizzle-orm/sqlite-core/query-builders/select.types.d.ts","../../node_modules/drizzle-orm/sqlite-core/alias.d.ts","../../node_modules/drizzle-orm/sqlite-core/index.d.ts","../../node_modules/drizzle-orm/column-builder.d.ts","../../node_modules/drizzle-orm/column.d.ts","../../node_modules/drizzle-orm/alias.d.ts","../../node_modules/drizzle-orm/errors.d.ts","../../node_modules/drizzle-orm/view-common.d.ts","../../node_modules/drizzle-orm/index.d.ts","../../node_modules/drizzle-orm/cache/core/cache.d.ts","../../node_modules/drizzle-orm/pglite/session.d.ts","../../node_modules/drizzle-orm/pglite/driver.d.ts","../../node_modules/drizzle-orm/pglite/index.d.ts","../../node_modules/drizzle-orm/pglite/migrator.d.ts","./dump_schema.ts","../../node_modules/pg-types/index.d.ts","../../node_modules/pg-protocol/dist/messages.d.ts","../../node_modules/pg-protocol/dist/serializer.d.ts","../../node_modules/pg-protocol/dist/parser.d.ts","../../node_modules/pg-protocol/dist/index.d.ts","../../node_modules/@types/pg/lib/type-overrides.d.ts","../../node_modules/@types/pg/index.d.ts","../../node_modules/@types/pg/index.d.mts","../../node_modules/drizzle-orm/node-postgres/session.d.ts","../../node_modules/drizzle-orm/node-postgres/driver.d.ts","../../node_modules/drizzle-orm/node-postgres/index.d.ts","../../node_modules/drizzle-orm/node-postgres/migrator.d.ts","./migrate.ts","./scripts/dump_full_schema.ts","../../node_modules/postgres/types/index.d.ts","../../node_modules/drizzle-orm/postgres-js/session.d.ts","../../node_modules/drizzle-orm/postgres-js/driver.d.ts","../../node_modules/drizzle-orm/postgres-js/index.d.ts","../../node_modules/@neondatabase/serverless/index.d.mts","../../node_modules/drizzle-orm/neon-serverless/session.d.ts","../../node_modules/drizzle-orm/neon-serverless/driver.d.ts","../../node_modules/drizzle-orm/neon-serverless/index.d.ts","./src/postgres.ts","./src/encryption.ts","./src/observability/filters.ts","../../node_modules/@ai-sdk/provider/dist/index.d.ts","../../node_modules/zod/v4/core/standard-schema.d.cts","../../node_modules/zod/v4/core/util.d.cts","../../node_modules/zod/v4/core/versions.d.cts","../../node_modules/zod/v4/core/schemas.d.cts","../../node_modules/zod/v4/core/checks.d.cts","../../node_modules/zod/v4/core/errors.d.cts","../../node_modules/zod/v4/core/core.d.cts","../../node_modules/zod/v4/core/parse.d.cts","../../node_modules/zod/v4/core/regexes.d.cts","../../node_modules/zod/v4/locales/ar.d.cts","../../node_modules/zod/v4/locales/az.d.cts","../../node_modules/zod/v4/locales/be.d.cts","../../node_modules/zod/v4/locales/ca.d.cts","../../node_modules/zod/v4/locales/cs.d.cts","../../node_modules/zod/v4/locales/de.d.cts","../../node_modules/zod/v4/locales/en.d.cts","../../node_modules/zod/v4/locales/eo.d.cts","../../node_modules/zod/v4/locales/es.d.cts","../../node_modules/zod/v4/locales/fa.d.cts","../../node_modules/zod/v4/locales/fi.d.cts","../../node_modules/zod/v4/locales/fr.d.cts","../../node_modules/zod/v4/locales/fr-CA.d.cts","../../node_modules/zod/v4/locales/he.d.cts","../../node_modules/zod/v4/locales/hu.d.cts","../../node_modules/zod/v4/locales/id.d.cts","../../node_modules/zod/v4/locales/it.d.cts","../../node_modules/zod/v4/locales/ja.d.cts","../../node_modules/zod/v4/locales/kh.d.cts","../../node_modules/zod/v4/locales/ko.d.cts","../../node_modules/zod/v4/locales/mk.d.cts","../../node_modules/zod/v4/locales/ms.d.cts","../../node_modules/zod/v4/locales/nl.d.cts","../../node_modules/zod/v4/locales/no.d.cts","../../node_modules/zod/v4/locales/ota.d.cts","../../node_modules/zod/v4/locales/ps.d.cts","../../node_modules/zod/v4/locales/pl.d.cts","../../node_modules/zod/v4/locales/pt.d.cts","../../node_modules/zod/v4/locales/ru.d.cts","../../node_modules/zod/v4/locales/sl.d.cts","../../node_modules/zod/v4/locales/sv.d.cts","../../node_modules/zod/v4/locales/ta.d.cts","../../node_modules/zod/v4/locales/th.d.cts","../../node_modules/zod/v4/locales/tr.d.cts","../../node_modules/zod/v4/locales/ua.d.cts","../../node_modules/zod/v4/locales/ur.d.cts","../../node_modules/zod/v4/locales/vi.d.cts","../../node_modules/zod/v4/locales/zh-CN.d.cts","../../node_modules/zod/v4/locales/zh-TW.d.cts","../../node_modules/zod/v4/locales/index.d.cts","../../node_modules/zod/v4/core/registries.d.cts","../../node_modules/zod/v4/core/doc.d.cts","../../node_modules/zod/v4/core/function.d.cts","../../node_modules/zod/v4/core/api.d.cts","../../node_modules/zod/v4/core/json-schema.d.cts","../../node_modules/zod/v4/core/to-json-schema.d.cts","../../node_modules/zod/v4/core/index.d.cts","../../node_modules/zod/v4/classic/errors.d.cts","../../node_modules/zod/v4/classic/parse.d.cts","../../node_modules/zod/v4/classic/schemas.d.cts","../../node_modules/zod/v4/classic/checks.d.cts","../../node_modules/zod/v4/classic/compat.d.cts","../../node_modules/zod/v4/classic/iso.d.cts","../../node_modules/zod/v4/classic/coerce.d.cts","../../node_modules/zod/v4/classic/external.d.cts","../../node_modules/zod/v4/classic/index.d.cts","../../node_modules/zod/v4/index.d.cts","../../node_modules/@standard-schema/spec/dist/index.d.ts","../../node_modules/zod/v3/helpers/typeAliases.d.cts","../../node_modules/zod/v3/helpers/util.d.cts","../../node_modules/zod/v3/ZodError.d.cts","../../node_modules/zod/v3/locales/en.d.cts","../../node_modules/zod/v3/errors.d.cts","../../node_modules/zod/v3/helpers/parseUtil.d.cts","../../node_modules/zod/v3/helpers/enumUtil.d.cts","../../node_modules/zod/v3/helpers/errorUtil.d.cts","../../node_modules/zod/v3/helpers/partialUtil.d.cts","../../node_modules/zod/v3/standard-schema.d.cts","../../node_modules/zod/v3/types.d.cts","../../node_modules/zod/v3/external.d.cts","../../node_modules/zod/v3/index.d.cts","../../node_modules/eventsource-parser/dist/stream.d.ts","../../node_modules/ai/node_modules/@ai-sdk/provider-utils/dist/index.d.ts","../../node_modules/ai/node_modules/@ai-sdk/gateway/dist/index.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/types.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/utils.d.ts","../../node_modules/@opentelemetry/api/build/src/common/Exception.d.ts","../../node_modules/@opentelemetry/api/build/src/common/Time.d.ts","../../node_modules/@opentelemetry/api/build/src/common/Attributes.d.ts","../../node_modules/@opentelemetry/api/build/src/context/types.d.ts","../../node_modules/@opentelemetry/api/build/src/context/context.d.ts","../../node_modules/@opentelemetry/api/build/src/api/context.d.ts","../../node_modules/@opentelemetry/api/build/src/diag/types.d.ts","../../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.d.ts","../../node_modules/@opentelemetry/api/build/src/api/diag.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/ObservableResult.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/Metric.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/Meter.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.d.ts","../../node_modules/@opentelemetry/api/build/src/api/metrics.d.ts","../../node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.d.ts","../../node_modules/@opentelemetry/api/build/src/baggage/context-helpers.d.ts","../../node_modules/@opentelemetry/api/build/src/api/propagation.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/attributes.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/trace_state.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/span_context.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/link.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/status.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/span.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/span_kind.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/tracer.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/tracer_options.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/tracer_provider.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/Sampler.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/trace_flags.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/internal/utils.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.d.ts","../../node_modules/@opentelemetry/api/build/src/trace/context-utils.d.ts","../../node_modules/@opentelemetry/api/build/src/api/trace.d.ts","../../node_modules/@opentelemetry/api/build/src/context-api.d.ts","../../node_modules/@opentelemetry/api/build/src/diag-api.d.ts","../../node_modules/@opentelemetry/api/build/src/metrics-api.d.ts","../../node_modules/@opentelemetry/api/build/src/propagation-api.d.ts","../../node_modules/@opentelemetry/api/build/src/trace-api.d.ts","../../node_modules/@opentelemetry/api/build/src/index.d.ts","../../node_modules/ai/dist/index.d.ts","./src/shared.ts","./src/schema.ts","./src/observability/logs.ts","./src/observability/traces.ts","./src/querier.ts","../../node_modules/bcrypt-ts/dist/node.d.mts","./src/test.ts","./src/agent-permissions.test.ts","../../node_modules/zod/index.d.cts","../../node_modules/hono/dist/types/utils/http-status.d.ts","../../node_modules/hono/dist/types/request/constants.d.ts","../../node_modules/hono/dist/types/router.d.ts","../../node_modules/hono/dist/types/utils/headers.d.ts","../../node_modules/hono/dist/types/utils/types.d.ts","../../node_modules/hono/dist/types/types.d.ts","../../node_modules/hono/dist/types/utils/body.d.ts","../../node_modules/hono/dist/types/request.d.ts","../../node_modules/hono/dist/types/utils/mime.d.ts","../../node_modules/hono/dist/types/context.d.ts","../../node_modules/hono/dist/types/hono-base.d.ts","../blink/dist/node/index.node-BbqFCkOX.d.ts","../blink/dist/node/agent/index.node.d.ts","../compute-protocol/node_modules/zod/v4/core/standard-schema.d.cts","../compute-protocol/node_modules/zod/v4/core/util.d.cts","../compute-protocol/node_modules/zod/v4/core/versions.d.cts","../compute-protocol/node_modules/zod/v4/core/schemas.d.cts","../compute-protocol/node_modules/zod/v4/core/checks.d.cts","../compute-protocol/node_modules/zod/v4/core/errors.d.cts","../compute-protocol/node_modules/zod/v4/core/core.d.cts","../compute-protocol/node_modules/zod/v4/core/parse.d.cts","../compute-protocol/node_modules/zod/v4/core/regexes.d.cts","../compute-protocol/node_modules/zod/v4/locales/ar.d.cts","../compute-protocol/node_modules/zod/v4/locales/az.d.cts","../compute-protocol/node_modules/zod/v4/locales/be.d.cts","../compute-protocol/node_modules/zod/v4/locales/bg.d.cts","../compute-protocol/node_modules/zod/v4/locales/ca.d.cts","../compute-protocol/node_modules/zod/v4/locales/cs.d.cts","../compute-protocol/node_modules/zod/v4/locales/da.d.cts","../compute-protocol/node_modules/zod/v4/locales/de.d.cts","../compute-protocol/node_modules/zod/v4/locales/en.d.cts","../compute-protocol/node_modules/zod/v4/locales/eo.d.cts","../compute-protocol/node_modules/zod/v4/locales/es.d.cts","../compute-protocol/node_modules/zod/v4/locales/fa.d.cts","../compute-protocol/node_modules/zod/v4/locales/fi.d.cts","../compute-protocol/node_modules/zod/v4/locales/fr.d.cts","../compute-protocol/node_modules/zod/v4/locales/fr-CA.d.cts","../compute-protocol/node_modules/zod/v4/locales/he.d.cts","../compute-protocol/node_modules/zod/v4/locales/hu.d.cts","../compute-protocol/node_modules/zod/v4/locales/id.d.cts","../compute-protocol/node_modules/zod/v4/locales/is.d.cts","../compute-protocol/node_modules/zod/v4/locales/it.d.cts","../compute-protocol/node_modules/zod/v4/locales/ja.d.cts","../compute-protocol/node_modules/zod/v4/locales/ka.d.cts","../compute-protocol/node_modules/zod/v4/locales/kh.d.cts","../compute-protocol/node_modules/zod/v4/locales/km.d.cts","../compute-protocol/node_modules/zod/v4/locales/ko.d.cts","../compute-protocol/node_modules/zod/v4/locales/lt.d.cts","../compute-protocol/node_modules/zod/v4/locales/mk.d.cts","../compute-protocol/node_modules/zod/v4/locales/ms.d.cts","../compute-protocol/node_modules/zod/v4/locales/nl.d.cts","../compute-protocol/node_modules/zod/v4/locales/no.d.cts","../compute-protocol/node_modules/zod/v4/locales/ota.d.cts","../compute-protocol/node_modules/zod/v4/locales/ps.d.cts","../compute-protocol/node_modules/zod/v4/locales/pl.d.cts","../compute-protocol/node_modules/zod/v4/locales/pt.d.cts","../compute-protocol/node_modules/zod/v4/locales/ru.d.cts","../compute-protocol/node_modules/zod/v4/locales/sl.d.cts","../compute-protocol/node_modules/zod/v4/locales/sv.d.cts","../compute-protocol/node_modules/zod/v4/locales/ta.d.cts","../compute-protocol/node_modules/zod/v4/locales/th.d.cts","../compute-protocol/node_modules/zod/v4/locales/tr.d.cts","../compute-protocol/node_modules/zod/v4/locales/ua.d.cts","../compute-protocol/node_modules/zod/v4/locales/uk.d.cts","../compute-protocol/node_modules/zod/v4/locales/ur.d.cts","../compute-protocol/node_modules/zod/v4/locales/vi.d.cts","../compute-protocol/node_modules/zod/v4/locales/zh-CN.d.cts","../compute-protocol/node_modules/zod/v4/locales/zh-TW.d.cts","../compute-protocol/node_modules/zod/v4/locales/yo.d.cts","../compute-protocol/node_modules/zod/v4/locales/index.d.cts","../compute-protocol/node_modules/zod/v4/core/registries.d.cts","../compute-protocol/node_modules/zod/v4/core/doc.d.cts","../compute-protocol/node_modules/zod/v4/core/api.d.cts","../compute-protocol/node_modules/zod/v4/core/json-schema.d.cts","../compute-protocol/node_modules/zod/v4/core/to-json-schema.d.cts","../compute-protocol/node_modules/zod/v4/core/index.d.cts","../compute-protocol/node_modules/zod/v4/classic/errors.d.cts","../compute-protocol/node_modules/zod/v4/classic/parse.d.cts","../compute-protocol/node_modules/zod/v4/classic/schemas.d.cts","../compute-protocol/node_modules/zod/v4/classic/checks.d.cts","../compute-protocol/node_modules/zod/v4/classic/compat.d.cts","../compute-protocol/node_modules/zod/v4/classic/iso.d.cts","../compute-protocol/node_modules/zod/v4/classic/coerce.d.cts","../compute-protocol/node_modules/zod/v4/classic/external.d.cts","../compute-protocol/node_modules/zod/index.d.cts","../compute-protocol/dist/schema-BjdOf5Yg.d.ts","../compute-protocol/dist/client-u55b3voC.d.ts","../compute-protocol/dist/client.d.ts","../../node_modules/@blink.so/api/dist/client.node.d.ts","./src/convert.ts","./src/encryption.test.ts","./src/knock-service.ts","../../node_modules/pg-gateway/dist/connection-Wgmmyk18.d.ts","../../node_modules/pg-gateway/dist/index.d.ts","../../node_modules/pg-gateway/dist/platforms/node/index.d.ts","./src/postgres-worker.ts","./src/postgres.test.ts","./src/querier.test.ts","./src/usage-queries.test.ts","./src/observability/logs.test.ts","../../node_modules/bun-types/globals.d.ts","../../node_modules/bun-types/s3.d.ts","../../node_modules/bun-types/fetch.d.ts","../../node_modules/bun-types/bun.d.ts","../../node_modules/@types/bun/index.d.ts","../../node_modules/bun-types/extensions.d.ts","../../node_modules/bun-types/devserver.d.ts","../../node_modules/bun-types/ffi.d.ts","../../node_modules/bun-types/html-rewriter.d.ts","../../node_modules/bun-types/jsc.d.ts","../../node_modules/bun-types/sqlite.d.ts","../../node_modules/bun-types/vendor/expect-type/utils.d.ts","../../node_modules/bun-types/vendor/expect-type/overloads.d.ts","../../node_modules/bun-types/vendor/expect-type/branding.d.ts","../../node_modules/bun-types/vendor/expect-type/messages.d.ts","../../node_modules/bun-types/vendor/expect-type/index.d.ts","../../node_modules/bun-types/test.d.ts","../../node_modules/bun-types/wasm.d.ts","../../node_modules/bun-types/overrides.d.ts","../../node_modules/bun-types/deprecated.d.ts","../../node_modules/bun-types/redis.d.ts","../../node_modules/bun-types/shell.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/react/index.d.ts","../../node_modules/bun-types/experimental.d.ts","../../node_modules/bun-types/sql.d.ts","../../node_modules/bun-types/security.d.ts","../../node_modules/bun-types/bun.ns.d.ts","../../node_modules/bun-types/index.d.ts"],"fileInfos":[{"version":"71cf8049ea8d435bcdf47408dac2525c","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"24660545bd04f64286946ca58f9461fc","impliedNodeFormat":99},{"version":"006807822602069b83b496ad7e25e6ca","impliedNodeFormat":99},{"version":"4d9b146f28d6be2c3542b08b595febfe","impliedNodeFormat":99},{"version":"455ea9b314b4d327c535fb65bd954959","impliedNodeFormat":99},{"version":"c079fccc6ede08aa4f8ca702c3ba328e","impliedNodeFormat":99},{"version":"c349310240662575d10e855fb8cff0b9","impliedNodeFormat":99},{"version":"4ccba7d48aa8b5a54b56f9a48b076496","impliedNodeFormat":99},{"version":"92ef9b8df31d3a08512928a3066d8fa9","impliedNodeFormat":99},{"version":"43f782dfe0cfccc03603dff6d7ffbe56","impliedNodeFormat":99},{"version":"af52c5f9c7d4f8a91e85748a8ab9c442","impliedNodeFormat":99},{"version":"1bd73602c7001221ecdb45a83c47f811","impliedNodeFormat":99},{"version":"9cf691967d2e0b0210f5864fdf1ad87a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"8485851ca9672f7054ee1193bc9229b5","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"751a26973b059fed1d0ecc4b02a0aa43","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"be28f9bf546cb528601aaa04d7034fc8","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"3bc4e9a53ee556f3dc15abc1179278dd","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2c63fa39e2cdd849306f21679fdac8b1","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e1a9f024b1a69565194afcdb4b57ef1d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"9fa1fffd5b2b67d8d8c33e295cb91a9f","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4d8ab857b044eaa0661bd0aebebc038b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"748df784ad0b12a20c5f5ce011418c3c","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"1f3a8dca322a95bc3ffc20a28e72893a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"d901677b09e934598f913e2c05f827b0","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"ab7a40e3c7854c54c6f329376cf3f9b6","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"00ece0060faf280c5873f3cfe62d7d19","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"cf5a418e3fbdb27a784c5fc37be6797a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"a73a6f599fda19ffee929d4386bab691","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"14475f4288b8cf4a098c2806834a1c0b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"fbae9331a88fa1a8a336fe90253cbbc7","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"d4124f01474cfa693099d8be321979e4","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e3e80cf65ee855fd4a5813ea19701f93","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"cd8650f4caf8166f19fd93217907da21","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c39604220a24016cb90fe3094a6b4b56","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2652c52b1c748791681ca0a4d751b09b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"9540816cf2a3418a9254e43f1055e767","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"f9616d828e6afe0f8146e9ac3b33fa59","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4f00a6f131995907fe9b0faf4dbabc18","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"47f85dd672027fda65064cbfee6b2d71","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"8adddec358b9acfa3d65fd4d2013ac84","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"8170fe225cf3b8b74c06f1fe8913924f","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c9dbd0e301b2bd8fc6d5dcb75dc61ec4","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"3a64170086e7ddb980f07478f95f7c49","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"a804e69080dc542b8de4079fdde7ebef","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"783d6e41b4c30cc983d131b2f413044a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"11b11ae792c173835b03d064a0853462","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4cdc220ae24b55dcc69d30252c36ce9d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"36fd93eca51199e9dfee76d7dbbf2719","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"7fc46463d5c6871146e3aac105f21a2d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"21ed16210f33f30f1e2df6dd5bc584d9","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"b2d1055a33f1612669aed4b1c06ab438","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"6779bb060769fcc1b3063d7d6dacca83","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"5de91aed11cf11bbf79c2323600f2a28","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2843d76b135201d1ba75d56f45238760","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"98afe632d712655c371691bc02dd15f8","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e33a3b1212a9f61f3d7229e068573681","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2be269e94382bba86f42d7d4109c6ddc","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"045bc80bcb8ba75cf56e2c9af4636a06","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"5c327c3a580ef35777e7f2b97b6b23e4","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"9965653fed0cc40aff9f23e6250e449a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"3f0224f4e28ecc5c714451c6fe9ed637","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"31bf9dad4e4564649a923b1f8e9fe016","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"ab498520bb087228060205c259f9f1db","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2ed49ae6f083c5ceea392013d5500bd1","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"4f1fc94e4ceefdf65dfae80b7ca74761","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"bb0f36efb1ca5ac2c05b884ea9eb300d","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"e7e8f73cc8fbc557946f3c599af084dd","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c108a3fdbc1f311f3505db4b5d6d4311","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"bf2ba43f37aefa733d387c1b1477906b","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"b5af3bd27050b2af3ba57b2b37f431f6","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"91cfeba82a5dd4c400c77ab8b5af4bc7","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"0ddc167cfc604225cb84a9620926049e","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"f244cb057e35de9b71f7d2e330a684dc","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"6ff13a1f4d84ba0dfb73813250150f0a","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"c277a50101d5ab0655c320101c70d3a2","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"815784e3a8d0d7682680536b3f7a25bc","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"59ae3ec3878ab72bfbfb82c7593d3a52","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"43bb073f85094030dbdac6036ec860d0","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"142e3750ad8fcff9893edc2eed0affcb","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"75f52d5da55e5899f01782e3b911d988","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"45c91c5f844a9ee1df11d1b71c484b0e","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"39e009135c77d60baa790854b51d2195","affectsGlobalScope":true,"impliedNodeFormat":99},{"version":"2514e9a2749c0fc18d2f478e9e1e641e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6ae4c332ecb24e76c1e47c0e21d4663d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ee0752d1e70c56ca160360425752a9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf33440030f0a0fae7d1efd6c293a8d2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9af0a7e3ef1c42cd066b9f8d365cc1ba","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7b772cebc7136c34fc77954aef70519d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9eca652586205dc5b07f9ba57b1c8500","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ec5f75939754ce94652189ec7d0d3058","affectsGlobalScope":true,"impliedNodeFormat":1},"27ac8812a712750df047dfd949bc28f3","49133c0dfbc32ab95668c3443dea49e5","85c2cf74d24d4069fac4686501a2d7e3","83f416ded62bb31c035580c3b5a8d334","d261ae135609468365bc2d32742d3e0d","60c67c092ae78d2e7858ca0a88f54659","9508c917bd7e458745e222a82dd24ef0","fcd1a513c1e5802916fa602e8b8e64bc","9cf55e98366383279869ace31be98079","8e2bc11d0328ba95e490a741c44a215d","f36661bccb8b9a0b5ccb8539ae751cb3","705645fe223430c696f47b708d592ca8","28d57c837c94adb42add03d499793cab","8c01a9bbae8449be21b3e018d59a74ac","705c3696b9d9681bf22181718bb08ffc","679024f8e9f58a112f4badf119c4d612","16f740a706028e841b09fb8b1aa8faaf","e6828eaf960f006eb1adb6e7df8913c0","6fdde11403da5129f4388a489f361535","d7e5f7a0f1f883f28458f684106e7643","c2364011a80b6a9e3cc0e77895bad577","38da5c670190f4a35cbc204ca6c616bf","d95cc0eb29beed58f5ce72db21398f53","ecd53256b1ec7379c73316eaf392a69c","db5a9211b779628398011a5b8f5b8b5d","69c7bb9c3befe9ae37eed0e6a6310fee","1cba93fafccb7b2655f0e75229185e83","094ecadae30f65a82b77343dde77a666","f75df12d75dd783b03a0329b95abdb25","b438b08b2f0ed94a95a75c8990d9021b","771a77c9bec862600c95f7a563871b5e","c665284a9cb3dd886b14663cd04742e0","1c3833453f6ed0acab1b4663ccdbd310","0468c0ccd0ec7770b76481b165564d62","188234d616a4f50ed9b14c8f84a39f33","4c116bcf0a47ea8fbf4072f380925fa7","1948703c2f27e582e0a0cc37bd67a868","add85ec26ba695fc99c698dbec065f8c","73ba12091cff7d4499df83bbe40d777b","b744265d8ad12b7d4d5c5dc35d18d44e","eff32168b8348b822afeed9cbf61afa7","af51e27e980746d79714b72188b3ee40",{"version":"26bd041dafacc7f2f6339882e6514fdc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"292c9398a407b33b1d9c9812b673387a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"45df94b3c51b898624bacc2bcd6d9eb2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7d352f71d1b1bcc12c79dd0e4597537c","affectsGlobalScope":true,"impliedNodeFormat":1},"db11b80743ed5356b81d763a708788e6","39078ea063fcaf72bd3cca7e0d13d017","f81aa09811fa65ac6f354ab0018d3c38",{"version":"282318b178d190157a4deacb14f3040a","affectsGlobalScope":true,"impliedNodeFormat":1},"8808902c9175daaaa4cb55f549a45608","54c5c3dcfdb5f7cf5fbbccfff6ead3fa",{"version":"dc14f078230582a2f8fb2138bfcf4f85","affectsGlobalScope":true,"impliedNodeFormat":1},"b2b472cd0bf0f8d5f022e00ca1c401f4","973ebe6a8aa5a2455e23a1dbaa0ad02a","39b3089f3df8d14e0f2ddac0479872d9","cc7a57e86f908c313649aea8d90377e1","5c271f10d8a9b9a1206bc82a4fe5b84d","fbe31979333ec391d8b59e8f42236e8e","6f97553fd1690f568365155d4c51a3b5",{"version":"a3f111d2a29b6cdd04fc4b41aa560c86","affectsGlobalScope":true,"impliedNodeFormat":1},"0129a9b584d122e462a189e3e80eaf21","59e2209cde19223aaac28f3a0269b908","08f313fad74e540b259ad22c66ec6522","86978b8f91524043f71ff8dfaf83288b","4acfe57fcd69b01ad21cb5a7655dfaf2","579675a2c3b0f8c532a82ad9cbd5d384","6c4de7becb0d667144a298a048daa5f8",{"version":"2e0aa7aecec3c5e9ab4a64d08399e9d8","affectsGlobalScope":true,"impliedNodeFormat":1},"b59cb5a2a891b4a59040eecaa4e4fd92","c9053dbbe4fa2853f2d3f73b9a2fee81","bf912705027b3eabad67f9d8ce7d89be",{"version":"c30a191ddcdb0b73c5f4982f6fd2eeb2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b94ac10d8de340fe748ac6d14e67206","affectsGlobalScope":true,"impliedNodeFormat":1},"6b26581aa2587701d570206a0db8c9ee","88a29e2aac8082c0910733950159e1ca","609d3ac6ba921e6e83c5da182c204fb8","0f80958d77cd6301b43c1d7904e3e4bc","3bdc645524ab0d2f6795d3a008833bd7","deb50b47eb75a5566532a763fa1324fa","60ce7e2b7ea6ef20a957106c8bff3756","7e470eddc0bd0486dc2a8ab902de79b7","c8206d568b54e5ea06131963eecd576a","15878f4f50c2e562c0768eb735c2aed5",{"version":"20812a39f9b1118fdea02b1c9c624c3a","affectsGlobalScope":true,"impliedNodeFormat":1},"dd404118e8bd70aff746f7d31e46270b","d84798d74cff30203ab77a949c8e3b33",{"version":"6b8649a280031d9e86955db721cfad87","affectsGlobalScope":true,"impliedNodeFormat":1},"4bc8f13c472858fb74f77388c0c5d885","d2f2e30b61d71ff76f1a5832deb2586e","c72d2516d1e8910caca33c4dff75fcd4","f0231f36cb7117fbe9271ff19ef0f5f4",{"version":"e995f9c4853f0e5bcfafddb750fb9cf9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"05b61990a35c8c3ddca8ab7c65d6ad9f","affectsGlobalScope":true,"impliedNodeFormat":1},"53754b619210c571daf58c393ea6bf83","9d0a504d30d1e9052afa9f6a5a9426c5","9268959cff1006c82e6abbd73824db97",{"version":"a08438ea6c1ea2f0cf4aa6835e2cf1d1","affectsGlobalScope":true,"impliedNodeFormat":1},"595eb99a4776c696a2fe27ca8d877652","eb567c7b5824aab578f75bbccf9f4b05","107122240cb561f34d90f7fac23efcd1",{"version":"ddea8fa2bb8797b800d96aeaf216fdeb","impliedNodeFormat":99},"157b1f5e7ec61fc0fd340de062f9bb9c",{"version":"3538e6d0d6be9590a4b8f5a19a3b930b","impliedNodeFormat":99},{"version":"7fa12912217816614f06e8ecc538e200","impliedNodeFormat":99},{"version":"94bf4f60910cda1e59169e28d7f9a55e","impliedNodeFormat":99},{"version":"7aea23840bb67f4798e44c084553c84a","impliedNodeFormat":99},{"version":"714c3b19603665cb8e057d724eeebf63","impliedNodeFormat":99},{"version":"50a00fffc935465eb3a3c3d6c45c5e19","impliedNodeFormat":99},{"version":"53ce8a3655a6e93536504948b2a2ace8","impliedNodeFormat":99},{"version":"71be3a1fbaeafcb72240a3df20b9420a","impliedNodeFormat":99},{"version":"45148e2f69a9a924a74d078edc004206","impliedNodeFormat":99},{"version":"d5f6ccf24276c260654795378a8d6a2d","impliedNodeFormat":99},{"version":"04835d550ac62fff566961417b0c5375","impliedNodeFormat":99},{"version":"ce0594dba7d746322d88a3cdf1611ffe","impliedNodeFormat":99},{"version":"421de23f3d1be0c2fb233ccb1c16127c","impliedNodeFormat":99},{"version":"0fdbaedd3b6948cbccf1d7e8cad037e5","impliedNodeFormat":99},{"version":"c2297c6416d3faa3588a68449106229e","impliedNodeFormat":99},{"version":"e3aa16c37d19ffa4fd876a477ac05baa","impliedNodeFormat":99},{"version":"63dd986d8cff3b083fc876bfb7e967ab","impliedNodeFormat":99},{"version":"158f07052c77f60420d86ffba1e63318","impliedNodeFormat":99},{"version":"777bf33aa0d11cca892bef7fba82b3dc","impliedNodeFormat":99},{"version":"a7200addb4789cf3af83a4af2b2d50dd","impliedNodeFormat":99},{"version":"641499f82d31a45b4809871c5a27d3d7","impliedNodeFormat":99},{"version":"dfb7c510a82db29a7cceb26a3e2750ac","impliedNodeFormat":99},{"version":"130f03b971a9788cfb9841304305426b","impliedNodeFormat":99},{"version":"2ab66bf7af8a816cf801d80c1b97633a","impliedNodeFormat":99},{"version":"c0bf4c4c2cdbb269274f99a6c5847543","impliedNodeFormat":99},{"version":"10b0b412842c2638c0b3cf6a23ebb197","impliedNodeFormat":99},{"version":"1a3b14bd42f516d756697a807f9b73bf","impliedNodeFormat":99},{"version":"76bbf3f95ed56aa8bb1d5cae265744c7","impliedNodeFormat":99},{"version":"5a73c53443773203126be23537951100","impliedNodeFormat":99},{"version":"4d5d7d16502ef0c0e662e74cf71b4e46","impliedNodeFormat":99},{"version":"cff0b6900594eefe75c53fd3400c5f46","impliedNodeFormat":99},{"version":"42fdfb52d5090c57501739f14ccc84e4","impliedNodeFormat":99},{"version":"3fd92a23bea9bd488a462d2983dc178f","impliedNodeFormat":99},{"version":"99be9d74bf16ca8913b18d10942b42c4","impliedNodeFormat":99},{"version":"cc014ccd8a07364131560d57c35e58ab","impliedNodeFormat":99},{"version":"2d70827e5c726df5563503adb77bcb51","impliedNodeFormat":99},{"version":"38b5ee980cb5d2e10f877ff9c122b1b9","impliedNodeFormat":99},{"version":"728fcea29d3ee6c4d1df5800fe0d6874","impliedNodeFormat":99},{"version":"b587b52e217b826fdd34a926f507103f","impliedNodeFormat":99},{"version":"a76c321e655ffa2c6217d48d973cfb5a","impliedNodeFormat":99},{"version":"8a3b19b0a44d977b52b2256cbd637870","impliedNodeFormat":99},{"version":"52d92f48b1024f3c2e4d9159563ef9ba","impliedNodeFormat":99},{"version":"e6e091fdc426a1dd8639d5ff49026362","impliedNodeFormat":99},{"version":"ca00e233ba211cddf06219e985198452","impliedNodeFormat":99},{"version":"454fdf3e6e103168cffe857b9f5f11da","impliedNodeFormat":99},{"version":"fa9b5cb09517f78df337e3abdad120db","impliedNodeFormat":99},{"version":"e712b89011797425da5e1c452439f9b7","impliedNodeFormat":99},{"version":"132b6d9834e7b8079aed5cead6017dd7","impliedNodeFormat":99},{"version":"da3078066ffba61e5e8cc8993e3d8812","impliedNodeFormat":99},{"version":"aedc3701edad1aeef09e9a5344b9590f","impliedNodeFormat":99},{"version":"cbb54e391247768364940692edc52946","impliedNodeFormat":99},{"version":"a245c03af28b08fa0e07fe931fba5fe9","impliedNodeFormat":99},{"version":"ee495c35b8c7b44e06e24852b5eec676","impliedNodeFormat":99},{"version":"ab95ab31c974cbf30d4fd989cd7da1a8","impliedNodeFormat":99},{"version":"596df3ea2d65b9076c30326bdff1a3e3","impliedNodeFormat":99},{"version":"9cffa02d4f826137fe78396def70d095","impliedNodeFormat":99},{"version":"2de22ca61fc431c5b4a81427fa496d6f","impliedNodeFormat":99},{"version":"3e7215589ffcaf220a8ac75a35cf4f27","impliedNodeFormat":99},{"version":"7062897043c83beb13eb806e1a82511b","impliedNodeFormat":99},{"version":"f07be65f526cf3dc0deb5f9f61902035","impliedNodeFormat":99},{"version":"6fe1bbe6db22c40ce5ff83e8e0822606","impliedNodeFormat":99},{"version":"99489cff48a97fa96990cf226b85ba33","impliedNodeFormat":99},{"version":"c9d8f611ba1d2486bf96eae198a1ea69","impliedNodeFormat":99},{"version":"266a36660d26dff8a5cf2aa64007c6d0","impliedNodeFormat":99},{"version":"bc264b8aea87c8cd0e621d7773b09b07","impliedNodeFormat":99},{"version":"4b33cfcc431db1b5ca01ca41af308638","impliedNodeFormat":99},{"version":"385a10d6cbc8908e0d4642dda53ab490","impliedNodeFormat":99},{"version":"05576823701c81e06117ef80e25756ed","impliedNodeFormat":99},{"version":"4d20d19a3ec5f2a912410381c1fe972e","impliedNodeFormat":99},{"version":"95c8b86ad7c8aebef6c8033752c89527","impliedNodeFormat":99},{"version":"4b6261b53a0f050c2d5d363b61422d41","impliedNodeFormat":99},{"version":"393e05015ea2a53da316969f412ca210","impliedNodeFormat":99},{"version":"5ebe1f5d885317fa481951f4656c7631","impliedNodeFormat":99},{"version":"7d28e9eabbf2b4e36583ccefdbf8ca93","impliedNodeFormat":99},{"version":"a0bdc7a8117a065214b3a1b4d5886052","impliedNodeFormat":99},{"version":"6a094e7d9214a543fdb8ba4e3aea5cb6","impliedNodeFormat":99},{"version":"942a7ef0bd1e93b2116bc4c2203a5c7d","impliedNodeFormat":99},{"version":"d6feae9e78b3d1554f6c1b361646be15","impliedNodeFormat":99},{"version":"13acd0d4a2982cf9dba9fdea4927472d","impliedNodeFormat":99},{"version":"5fd7be43bc1e648ce7f4df800f8165ed","impliedNodeFormat":99},{"version":"e95c411d759f9a4ba7ecc69e2044a36a","impliedNodeFormat":99},{"version":"154ae6c19ad95fbcc9d4087f7aa7be0e","impliedNodeFormat":99},{"version":"b572c264b3b23642a3490cfb35f74e83","impliedNodeFormat":99},{"version":"44fd556d8d3c804a6656b2d69bf791ff","impliedNodeFormat":99},{"version":"5fffe82238f68ae4c56679b439b4a9be","impliedNodeFormat":99},{"version":"247c66b726df9b473cd34e34f76af2ae","impliedNodeFormat":99},{"version":"f29faf2b0c42fdb94408f60a5b3231f0","impliedNodeFormat":99},{"version":"3c82e5b3068987219f3ffff6174ba1b9","impliedNodeFormat":99},{"version":"b56e16cfbda18e5f708d921811c02787","impliedNodeFormat":99},{"version":"787362ce0e33339d46bfa67abf7e9d35","impliedNodeFormat":99},{"version":"adff67c922260166df80fe3e4146eb9c","impliedNodeFormat":99},{"version":"1677f777316365dee684e28c4a823002","impliedNodeFormat":99},{"version":"350420b547a7089cf6b97149b35b342a","impliedNodeFormat":99},{"version":"e567d099c8d8e697d31ed9958c682cea","impliedNodeFormat":99},{"version":"0da6e0bd9e15a17a8bd47edbc2b9481e","impliedNodeFormat":99},{"version":"b87b8ebec3030da2b3343e82d513c4ee","impliedNodeFormat":99},{"version":"0658d55f148de0ca14f1baa3b33decab","impliedNodeFormat":99},{"version":"66852df55bfd9514fb8e64942c486c13","impliedNodeFormat":99},{"version":"c0a6b900fead67770da671cfe0e23bce","impliedNodeFormat":99},{"version":"dfd61b749d7d7c17eb4ef0b1add220e7","impliedNodeFormat":99},{"version":"85a2361345e408351fe8a3ab84ccace6","impliedNodeFormat":99},{"version":"2b87e0279491fc45df00204431fc622a","impliedNodeFormat":99},{"version":"4765e5dfb370873ab2b8a21117bae2f4","impliedNodeFormat":99},{"version":"5572a7b80b2768850b7dee787c235e70","impliedNodeFormat":99},{"version":"18f29d7b4028275dcff292b29e489509","impliedNodeFormat":99},{"version":"2db08c91470c4595f01b088deb5dc86c","impliedNodeFormat":99},{"version":"8a39f07479899bffc37f343b0d8f1ce7","impliedNodeFormat":99},{"version":"ea58a2a7264807cf162586a952989b13","impliedNodeFormat":99},{"version":"c160e01866fbb3a36f1edc60664ec2ad","impliedNodeFormat":99},{"version":"cafd9c4a056e3d25b63e6e13a11e417d","impliedNodeFormat":99},{"version":"ea238b095e40da52a5f02e19f0c28fc0","impliedNodeFormat":99},{"version":"30cb5bc2c6b2b14e5839320e07297c0e","impliedNodeFormat":99},{"version":"efdd2c846698446a335d4de01c80d161","impliedNodeFormat":99},{"version":"c2d5d95f61b2d635e8efce1758922432","impliedNodeFormat":99},{"version":"7399c52ee359f7b58a1e749c64702259","impliedNodeFormat":99},{"version":"e986679987b25d735ea33528cfaf8c72","impliedNodeFormat":99},{"version":"98c682adb0b14dee06e7b644845f7436","impliedNodeFormat":99},{"version":"3f20530cf5e9b0ed0a50dd160243ca57","impliedNodeFormat":99},{"version":"06b52fda7714c3936168498df22e07ac","impliedNodeFormat":99},{"version":"edc0009d28d7ef63c391cc5c10b4df94","impliedNodeFormat":99},{"version":"4f60ac62bc23947ba653716865dcc67a","impliedNodeFormat":99},{"version":"86e357ccdd9f5ddde78b86ba72d28102","impliedNodeFormat":99},{"version":"7355f93367a933267bd049d1bb20a497","impliedNodeFormat":99},{"version":"cc05f18035ba000464c04751ebb1041b","impliedNodeFormat":99},{"version":"8da0726eef4e731ea100c9ebeee43537","impliedNodeFormat":99},{"version":"ddb6b3b4f622e9b842f776b6b2f5b119","impliedNodeFormat":99},{"version":"bba7fd58e6cceeedeadfd27a1b71c144","impliedNodeFormat":99},{"version":"192557d44db1e7867b2c7b4b49ddcf05","impliedNodeFormat":99},{"version":"fd03d9d88d6839cb621080ee954773e3","impliedNodeFormat":99},{"version":"625d872e702cfb2d1847f9fb18bbcbb3","impliedNodeFormat":99},{"version":"2684947271453465345771ca1a0dcc2e","impliedNodeFormat":99},{"version":"0082ad514f1dae7317ebd84135c6b392","impliedNodeFormat":99},{"version":"ffe85605f10a4ac25a9e53faecde8406","impliedNodeFormat":99},{"version":"ce182ade28a5c8b8dd00902e56fc0edb","impliedNodeFormat":99},{"version":"6753409e942625d54a8cd67ea2c32fad","impliedNodeFormat":99},{"version":"387bf665a440625da9a9a651e0f60bc4","impliedNodeFormat":99},{"version":"7aba8ebe33e187effe616f4a7ecd3ef9","impliedNodeFormat":99},{"version":"3a34facf379b84727df2b048a2979296","impliedNodeFormat":99},{"version":"3ca44087cf45107a76804bd49a4b01a7","impliedNodeFormat":99},{"version":"ce0a4546543d94637fc54ce4409e64a4","impliedNodeFormat":99},{"version":"3f49ef61b7a2149be98e77ba998c0c97","impliedNodeFormat":99},{"version":"02738fb76c7f205409fc2d2ccb20157a","impliedNodeFormat":99},{"version":"faa5230e17d5d7a2eab4e9773ec45629","impliedNodeFormat":99},{"version":"748c85ea5a8c25c002996a96c7d8c7e8","impliedNodeFormat":99},{"version":"62fafabfb7f754441b2916ac8d21d361","impliedNodeFormat":99},{"version":"df930773057e4c6e27cd09a051fa66d2","impliedNodeFormat":99},{"version":"50b7db2244b7141ed4989310354b964f","impliedNodeFormat":99},{"version":"1cdebd8c78f4374dcc646249dbc32f71","impliedNodeFormat":99},{"version":"0b76ab6a3c832f69518118690032fa0a","impliedNodeFormat":99},{"version":"a8d16c5059e6c03842d0a07520eeb033","impliedNodeFormat":99},{"version":"c85e75bd3ca44ea3a932b7aa9c6c6092","impliedNodeFormat":99},{"version":"ce580b6683e6960705e8740d3b5b0c58","impliedNodeFormat":99},{"version":"bc3aa19e57b9a19391d40140d46740ed","impliedNodeFormat":99},{"version":"3ff9a6ec605db1baa78163a9746b4d34","impliedNodeFormat":99},{"version":"31fbda5edf5e6a3bda99b80d1e7c6e78","impliedNodeFormat":99},{"version":"1675425c54145a3b3db57fda3d491ec9","impliedNodeFormat":99},{"version":"72322957431ec1d62bef38a7ffde9373","impliedNodeFormat":99},{"version":"dcc95a8e967596b09b7dfde970d0a7fe","impliedNodeFormat":99},{"version":"3a2414c7ba4d703d4cc7831ae631d9d1","impliedNodeFormat":99},{"version":"ee56c2811f83885fd4ca8bfb20afefaf","impliedNodeFormat":99},{"version":"bfaf410d09222779f9ddc04b30fcb782","impliedNodeFormat":99},{"version":"be0d22690abad33e958641c940cb68bc","impliedNodeFormat":99},{"version":"cfd910cf39289cdea7b98fc618c2271b","impliedNodeFormat":99},{"version":"94c677b43f12f2bf6d43b09bc3f77fed","impliedNodeFormat":99},{"version":"ec3c5e884931d957648c371a94b60725","impliedNodeFormat":99},{"version":"41325ae0b770172ef7702647692d53bf","impliedNodeFormat":99},{"version":"3c750d09a9d2591733681fdb606141e6","impliedNodeFormat":99},{"version":"340d6b1c4a27934ac21d0f9c2a39ee6c","impliedNodeFormat":99},{"version":"7bb0bebe2218d2f8d076f3b68588ce72","impliedNodeFormat":99},{"version":"231ae9bf54e0e970b98cd4610063a9fd","impliedNodeFormat":99},{"version":"1cde5ae9abe99befa4cb98a40ddb84e3","impliedNodeFormat":99},{"version":"d0f94532a7212eacc30a045017bf708f","impliedNodeFormat":99},{"version":"9f7307c24ba9b0ad6e790c0ef33f13a6","impliedNodeFormat":99},{"version":"31e84ddd97eb1074536b2c6a7b95ddad","impliedNodeFormat":99},{"version":"dd2a8754d54cf6daec39408e4e1bfe99","impliedNodeFormat":99},{"version":"29fe01646d39a3a3dce34cac90a3dda1","impliedNodeFormat":99},{"version":"ce51852bb1ef980da62e790bd1b6d529","impliedNodeFormat":99},{"version":"0a08799eddcfec892f0f55f7686ee86c","impliedNodeFormat":99},{"version":"018bf658e4c59bb289c936cb52a40b50","impliedNodeFormat":99},{"version":"362625241687ab9dc344831b9c5b2729","impliedNodeFormat":99},{"version":"0a911cca463a242b0b723fbf9ad339a6","impliedNodeFormat":99},{"version":"0e15368f4ae8993e5d28a1e1b50cc2dd","impliedNodeFormat":99},{"version":"8efac2639cbd1e7272a333002763e51f","impliedNodeFormat":99},{"version":"e00b8c7984e3cb3bf880a5984d028ec1","impliedNodeFormat":99},{"version":"63dd409f8cc61165249b476b97f1c58e","impliedNodeFormat":99},{"version":"d2648446db218900426e83aee8f1cf4d","impliedNodeFormat":99},{"version":"c91935a679a9a2a1fc5528b8ba21b7a8","impliedNodeFormat":99},{"version":"9a6fd59814a6d3de4e2d84c851dc5de0","impliedNodeFormat":99},{"version":"a6b26e870aa2b21247e1518f2885f8e3","impliedNodeFormat":99},{"version":"62f17b531125e850653607cce218e80d","impliedNodeFormat":99},{"version":"1b4e0a02431cfd8c09e85956fa8a5dc8","impliedNodeFormat":99},{"version":"ea7fabbe4d18dd4ac8fe62e338eb5e0d","impliedNodeFormat":99},{"version":"beb84ca1fed59406f80b4f1bfab116a1","impliedNodeFormat":99},{"version":"fadfcc50157250d6f4a81df0e0b2a24f","impliedNodeFormat":99},{"version":"ae07ff4b5bcdadcff098c7d740e699db","impliedNodeFormat":99},{"version":"25d19972df6e9330f6080257b37787d7","impliedNodeFormat":99},{"version":"5ebe1f5d885317fa481951f4656c7631","impliedNodeFormat":99},{"version":"0f34343037d1be4c66f3e19f27ed4c9a","impliedNodeFormat":99},{"version":"9a3852a39b6aa67f234a1a6105393a2f","impliedNodeFormat":99},{"version":"242af76f9b2b9d79431d08f551c464e3","impliedNodeFormat":99},{"version":"995257d393770315c191991a5ff87371","impliedNodeFormat":99},{"version":"e811462d14e11a7ba9947ec052a5910f","impliedNodeFormat":99},{"version":"84180235511c07768c4d690d0c8176a0","impliedNodeFormat":99},{"version":"22752b6c2d5f021ad330028a86c74f74","impliedNodeFormat":99},{"version":"52e361ed326cfd9f73c4ca05a6e3e9c7","impliedNodeFormat":99},{"version":"5a37909f317adcd49d750df39aca92c4","impliedNodeFormat":99},{"version":"686a1eb64bd5067d0ebfb902257a570d","impliedNodeFormat":99},{"version":"63b429f873385a42c62e9f5d37d2a2b7","impliedNodeFormat":99},{"version":"fb26b490d6206aaafd9ecf4df57104f6","impliedNodeFormat":99},{"version":"1235e224787acb209c09edf3dfc2eabf","impliedNodeFormat":99},{"version":"36126c950758ce897a8708ca016ee5b0","impliedNodeFormat":99},{"version":"ab09f8b6fd356ffb8ccfe5bdda7ba662","impliedNodeFormat":99},{"version":"87bacf4fcaff0ffc4587febd90e5182a","impliedNodeFormat":99},{"version":"71d73744fd8910454768e89ae1263541","impliedNodeFormat":99},{"version":"d54b7d9dd15af8e1b3713fc0639aaa24","impliedNodeFormat":99},{"version":"8cefec0466ed138cc0940d3b0afbed94","impliedNodeFormat":99},{"version":"f32fa1c8142e413d5ebb33562aeca6aa","impliedNodeFormat":99},{"version":"8851e2f16ea37bb22dc4648c475c0279","impliedNodeFormat":99},{"version":"7ece064083b071c6e0d92d7b5b2661c9","impliedNodeFormat":99},{"version":"1498f4121d36e96c95370c2c83d67c3f","impliedNodeFormat":99},{"version":"91bc1eec4bef0ca5c0c9be30a3b09361","impliedNodeFormat":99},{"version":"ba5784db94097fc80734f127b53f0b53","impliedNodeFormat":99},{"version":"fe61751de6dd78217a073651be48f7f0","impliedNodeFormat":99},{"version":"c848a582ae8d1c4ffa47803fdb908e20","impliedNodeFormat":99},{"version":"47a9f2193a09d79aa1665eae97b02256","impliedNodeFormat":99},{"version":"007d28832acc0101e2a1534792eb026a","impliedNodeFormat":99},{"version":"c1a1c3aa8f5f106084a6468110194603","impliedNodeFormat":99},{"version":"54ca104df5771ec669d6e7db4faf8b1c","impliedNodeFormat":99},{"version":"0829e05ed0c182ce3743c9535c5cc713","impliedNodeFormat":99},{"version":"379c604911c6397b68dd927654bc1d3e","impliedNodeFormat":99},{"version":"0123b9f073faf89a041828bfa537def1","impliedNodeFormat":99},{"version":"0270d491887438eb19ee00dd15a8a9b6","impliedNodeFormat":99},{"version":"f409c1a9d4c1160b1ea10b2cd7aaaa1c","impliedNodeFormat":99},{"version":"8d2927e8b320cbd391b5ce99178d2d4e","impliedNodeFormat":99},{"version":"01304432d7302c48feeb3558e161f270","impliedNodeFormat":99},{"version":"dc5b24b3223f8a1dd082297a3bbbd2fe","impliedNodeFormat":99},{"version":"96ba6613308b7482fac819993ff68fab","impliedNodeFormat":99},{"version":"62fe60faa182bb481ee1bb8835b73a7c","impliedNodeFormat":99},{"version":"3e1df7c99cfcafcc45534787411dd025","impliedNodeFormat":99},{"version":"2af434d779a01096da0b5aa6f93acd3d","impliedNodeFormat":99},{"version":"d67ddcb237741616ff89e3643a559a58","impliedNodeFormat":99},{"version":"9e3210c161b803bb71775583bb2ac2e4","impliedNodeFormat":99},{"version":"fb00105ab243f75f44675b1be9bba9b1","impliedNodeFormat":99},{"version":"4e2517d29aeb12e05e32975d94cd6692","impliedNodeFormat":99},{"version":"9b560f52cc8597ede7e90633ae667181","impliedNodeFormat":99},{"version":"8000e11325f89d37e871f968e9cdc416","impliedNodeFormat":99},{"version":"f299a219276456a7a342cefc1820835a","impliedNodeFormat":99},{"version":"e3c1a70524cc3c74a53837b90e41395c","impliedNodeFormat":99},{"version":"a76bbc6829ef180c87fa604a532e0363","impliedNodeFormat":99},{"version":"685f0b246f56b0962ef72f42d812b64c","impliedNodeFormat":99},{"version":"44832394608e7bc44524c47cac415908","impliedNodeFormat":99},{"version":"96b65b20e0273b38b71892f2b3ca5f82","impliedNodeFormat":99},{"version":"bba7fd58e6cceeedeadfd27a1b71c144","impliedNodeFormat":99},{"version":"438f9beaba749edfcb652e65215c8d4f","impliedNodeFormat":99},{"version":"c72c96f8b66a74eb849e966f4f52b766","impliedNodeFormat":99},{"version":"066b9765815cca5f99ffdd227e123bda","impliedNodeFormat":99},{"version":"9f607ca746f6a50bfba1530c9b03ac43","impliedNodeFormat":99},{"version":"acab2e4611597d2ca2f40b502f9dcb83","impliedNodeFormat":99},{"version":"9d498c4bf7e5934f2f025c338ff36fcf","impliedNodeFormat":99},{"version":"57662a90ecdbdea32204d1a1927d3878","impliedNodeFormat":99},{"version":"2d826128de9730bec19d0e6c31b50ba4","impliedNodeFormat":99},{"version":"2d3482473679745fabae85324fbd87a3","impliedNodeFormat":99},{"version":"30285cfc3bc00b32e12c51a7dd5b2095","impliedNodeFormat":99},{"version":"720e8c0fd3ce5946baa869aa4e20dddb","impliedNodeFormat":99},{"version":"def3374f0af6764bea1b6d60b13f85dc","impliedNodeFormat":99},{"version":"559ad1857f1f86afa2fe373eb60ac8ad","impliedNodeFormat":99},{"version":"f7b69347094ab7ab5c47f10661d55699","impliedNodeFormat":99},{"version":"e401b0d3aaf2203a80829a75fd8466f8","impliedNodeFormat":99},{"version":"d5a5db70373ccb7b5a4790fe20d24429","impliedNodeFormat":99},{"version":"d86ec77ad2687aac2ef98b11cda58180","impliedNodeFormat":99},{"version":"9300dbc8247d3575635d072b7d6cae48","impliedNodeFormat":99},{"version":"0d4e75cb1ba7efd298b865833a885c87","impliedNodeFormat":99},{"version":"e2d8a6a2b3415959fbe9d6aec85a03e3","impliedNodeFormat":99},{"version":"8d134eedc0b8ff43c57971b8ddff623d","impliedNodeFormat":99},{"version":"f8ed19bc10876e40ca0c265738e7278d","impliedNodeFormat":99},{"version":"c19119ebb42d76233f10cff5ff2e8478","impliedNodeFormat":99},{"version":"bba7fd58e6cceeedeadfd27a1b71c144","impliedNodeFormat":99},{"version":"d087f658bd76ed450bd5d4ce506eb116","impliedNodeFormat":99},{"version":"79d22ae71a6246cc98cbc32f7b233716","impliedNodeFormat":99},{"version":"0780dfc40b204f8bf07cf40243f6e60f","impliedNodeFormat":99},{"version":"471ce59dc22c51788bb80a7f684d2636","impliedNodeFormat":99},{"version":"fc21b1a6f6bb562900e49828d58a44c9","impliedNodeFormat":99},{"version":"cd152c1b036c45a640a43a9b0a2832bb","impliedNodeFormat":99},{"version":"ef421774c5ecb5867f63217e6a3b72e6","impliedNodeFormat":99},{"version":"fefd8b78e9e09dca447381c16be0c079","impliedNodeFormat":99},{"version":"376a5e43adec4c567581e0c47025b4e6","impliedNodeFormat":99},{"version":"5c7b7541573946ad3459c89563bbe562","impliedNodeFormat":99},{"version":"25a6407fb3740eace0f5d7fd6e37c2ca","impliedNodeFormat":99},{"version":"30ed220e43073e1c224602703cf384cb","impliedNodeFormat":99},{"version":"dd9ba488ccc254b50a2efc8c991cfdd4","impliedNodeFormat":99},{"version":"64fa3a9664365ac69c8c1bcae894ec63","impliedNodeFormat":99},{"version":"8a62bc6926321b876c227277072541b0","impliedNodeFormat":99},{"version":"637b9fa09d03d462acdc2f85054790c2","impliedNodeFormat":99},{"version":"1521836305c934e63d8b37df49fb8fe6","impliedNodeFormat":99},{"version":"bda02c3326827e48ba13c42ea306da8d","impliedNodeFormat":99},{"version":"3585ebdd7e5d494d7f139ccc81a360f8","impliedNodeFormat":99},{"version":"15f5e660d1ccc494e5ea12ee9dedd0f4","impliedNodeFormat":99},{"version":"d6b0b8924a5009851c4a532b42da3ca7","impliedNodeFormat":99},{"version":"491a08861a422c017967a574015b16a3","impliedNodeFormat":99},{"version":"a67ee837404f22476afa0fc77a48e78c","impliedNodeFormat":99},{"version":"3264eabeff0614d94f1ebdcb10bc1c41","impliedNodeFormat":99},{"version":"942981305684e87461361fd240d208e4","impliedNodeFormat":99},{"version":"3aef2d10cfd4882933203aa16e6ffae7","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},{"version":"2670070f9622ef664b8d02f8ed692e39","impliedNodeFormat":99},"88aa1f2b23550b1b026e93a8ce840c5c","25d40df8bff69a330a687d98bdbc2eb6","87175b4aa2f6ef2d25834a1969a45b51","be8b3bcdd2ba7d7c8c87946a20626c5b","f0f40afc5586d9d11f26c43bf265945a","cd8070bba6df1e7a7b65224ab106d7d0","ce15efa1c092340d16d533b69f4fb1a9","920ad63d18cbe3c2117863eff71fe2cd",{"version":"d24ce383e45fc15d6fa9f750441ba231","impliedNodeFormat":99},{"version":"f3b58d74034c2cbbe8af62152e6c926f","impliedNodeFormat":99},{"version":"902e1e4fd8aaa166e216774393fe14ac","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},{"version":"f390274c22fe9ccb38469da0d7d9f5a3","impliedNodeFormat":99},"9a960a6f0bfaddacfb2e72343cdb8819","58b176f36d77c0078999af55163fbc89","57c770a104667fcd3b84386cb790ba4e",{"version":"4ee1af84823a6b3819011b5cf5b5620f","impliedNodeFormat":99},{"version":"ca23d2c5f54ae1283546398f5361eb0b","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},{"version":"ef1554b8d4fb03fcdf7d11b62cfb2a4f","impliedNodeFormat":99},{"version":"d522b150f5fbc8d7da4848f5a3daaa88","impliedNodeFormat":99},{"version":"563355c252792fcb5242b47bce6dafe6","impliedNodeFormat":99},{"version":"9271034af339f31dadb2cca16c3e8d57","impliedNodeFormat":99},"9ef287f966c57850323bc727f2770bac","2fbadd8fcc861a73bd534a510f7ff818","cb1e5798bc8d5656fff05c3e1de644f4","75af214146a5669542c74170d8ba1426","bbaa64d11b49a5511f78feed2948117a","ca12d9dc1a997586508bec402fd3ab75","f4a7721bb7864b0587a34eac21bdfb9f",{"version":"df5dfe46e135b8e5d3fc4f7a2dd7dc45","affectsGlobalScope":true,"impliedNodeFormat":1},"e7943b38d409d884a588b81e9498b7ee","2685d6050222c030d8880cc283a9997d","5f65afd424d50de7f939dadc91ee7bbe","3333247facc8903d90a9b006f2c60f89","899f5bd6f280315dacce7b3e90e44c9e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","07a970ee7c3ff3c7e5c52d238d62c520","07a970ee7c3ff3c7e5c52d238d62c520","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","07a970ee7c3ff3c7e5c52d238d62c520","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","91a7595feb3cf59778e97dd108fac80e","561f804466f205f73f3cc4c59baf01a8","858e55326c7b6438e6e28307dc831ffd","cdd02c041a3cc6361fe7c287727433c1","907ae20c7c3f1ac9cad51295a5490530","20220050d20ec9dcc49650b0ae7ae6f7","1cf58e1a20498dcb6cbcc8bc7947af7b","1eea9456ee5717b119c17e90b684fcc7","bb6bec8f299bdf7197d23f9717be2a66","1cc59f020b9d62d875bdb28a6e2f745b","85035df3c3e673ced76f6e81e8011815","3cb6ae40a0ec69a4917962acac1d747f","008a044437730ef792d0f178852a0d7d","2ec272900a05d1b72baff78e2ac4b5a8","dec40354e62d8ca81f5996c1760bc6da","a9356de7c324c6f49c15587032b1f65f","11438b42a23b61e96b102fe60b2ee256","f06e385eca707a7f458b12579fac7033","36e44d66b242e6176176dc6d1ee825ea",{"version":"c70b0e85544d842e2cc497fd996ae1e9","impliedNodeFormat":99},"103e91984cbc1b6f8710542be58cb09a","f4ebcc7392593490ac52d69171b544ab","616fdc342e5f30cb0aa90f69441ddca0","78cdd7d6fcc343136ba8b52ed754a971","26cc32869d8b950cb0f0d526a824d646","fd743101a978158919239001d8f2ba49","3d09c4a71884a36bfa2d0ca10e69e75b","c8468714a3d17fcb54967665fc0a1827","6f2a7f08d2b896e6ea3fcc050752727a","a181e2f4e0ea142154934acab40f62a9","259d920dfff27dfba05c2475a1a8c877","af3e7ccf973e817d2c0f3d1d51b397a3","db8be451ca85c5aed9d98b490abd8a4b",{"version":"3f40f3dfae7ab4804f5fe218adcf70ef","impliedNodeFormat":99},"f21b0cac1cc1660f03100c19ea5ad6ce","f05941b4badccad76dc807153120ed1a","da251217111629b56efd856cdeac0a31","87be01ef252a07d166177fd7bfe24419","759f36640d607a4021e79357319dab37","ef54e30ca5824492e5f5c3a5549a3b2d","b628ec4c4df8862128859ee28c186a8a","f1926e0c00597a969ec6df9cbdd0f9de","0a32685184e03cd5b84c25f017bd3c17","33560758617c74c8ec9de02a119176e1","f23b096393b50a79a71cc701e637e88f","d25d4164a5ee91cf9565ff58bc11192b","c60cb8c3b549dfedb0b4c7a9102b9a2e","f5340529f334aeda48e0d1acc719ac2e","76efa1ec64fd885c3acef57e5af814cf","43daa9bd5e906ae3abb8cbcb74c69e78","8c3fbeeb80bf925163d2b605ce8a1c19","87c8a1975886c9695cf89841fb8322df","0c3be1780884a15e39b84633040d69d4","8bea0b0e309a3323272cd69dc2c124fa","463b87882610ef829309c1295d7a7202","43e9f729349175eb07e72ba6be849299","209ab7e32d80320d6bccc7862640e9a0","8f74e9826719670e9937c08eeff088ea","ab16dd88cbfff339c3edead904b6e470","a684f053c33dd09551b22bd5bc0dc30c","974744772966eb6eb67a536714686f5b","1f0a0f2fa5f7530b91a8052a8577b646","d70dff8f11e6b3e716f8e0bf19bcf855","0800f7f1fbbd0f4f4eaa0e505250e21d","643d3c0db96562dec0a80d2ba7df8353","c665788419f40e45c4ec32a3bb8dadb3","4fb4e7528259d93edb4b01d8ca1ea8f5","c162c8659840769f65ee9f8f1327c584","ccb396a398b985ea2e0d45bdc0052244","e3105e2112412126bfa3963de197ff74","2cd29888220b1a60b567e245398a766d","0e85c9ec9ebee83469cf4507c3cf4b2c","6826fe2b1104a1a76927ea4e79b08a8d","b2c555fb57de20e58df2c31b79ed4f99","20e347e26d36ddeb125e4acbc1970d5c","b3de58dade44970fbdde37d2770b3ce5","db902331ca29dac243f752e0fa815d6a","78b093712b6a30c0c0e0c968e2707cc1","e9d7e6b7d30ece2bc321521312f0d32c","42f064a7909385742496a84508847f61","4e89eeecdd77fb0529ab0e34eddcc139","a802149f1013baadb8a502f3baeae587","a8a50c5544d675a1c98d68ab9d95efa2","733727567a3ca2b6be10a1957f9165f1",{"version":"fb4513dc923a4aaba7a12c80431292ce","affectsGlobalScope":true,"impliedNodeFormat":1},"168d3779a8cc8afed49487ada145003b","c14a0db8d95eb76bedb007263d517d6d","941ad8d874584aaa6384a0ed3c0e43be","2a9a869b48b51e21fb3af2babdde9e34","e1de687778006f76916fd39071e71191",{"version":"09df6a4cdbad13fa010749e928be4a2f","impliedNodeFormat":99},"8c489bd949e73193a0da0e925691ff71","63f85be065092e82cf132afa07e835ca","a35c1b81aa4e197bee807e7d3fc9b28d","5672b8859ea1487b5344140b9c11f020","b0233544d7eb27e2b3e75f22fa7ef8cc","96bd952d0511e7128d68ddb50b446004","1481c34e5d10f570b8e478279362c392","ce4c9f1142c3c21a79f6d3ecd9c01f06","f45f47e4821610b33f86fd770ba47aa4","526145d96c3d16c13a5b736e0bffbb73","0ce920bb95c98bfc18b9bc6312cb8e38","9afab2b97479bd1ef668c8ae03c498ce","11d1b1a77e7f929d19971b36b3f2b7c7","8d0429f85301b72db55a275e395ab6d3","cc4dc43d7dba264246cf79a4829160fc","d1a82e2f68380792f316bfeb3e7013de","bbaa64d11b49a5511f78feed2948117a","5b9b11013c6d2710f34a99a9832abfa3","a33ec838d3afa0053a989cc843be3c26","904c558da6cb62827fab0494f676d985","b53e5eafe089103ad7be4f243fb517d4","ebb3a0af4d6e917f467ec795b2e899bd","b77e4c0f4f6658a5315c206e2035354c","2b76267afeb2e83dff758e3fba2faa8a","662eae47724ed2ca873fb608034d0645","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","07a970ee7c3ff3c7e5c52d238d62c520","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","eded9cbb38a7e6d17d9014675f81cef8","daada721cfdc43aa8e7c2e2d14d760de","a21f1b172546b6a64cc7ddea394b54ea","d695b3ee3257a30539a09560afac31a5","5f3c015bce4302b247acedb9ec20e302","b3d7ae3cb2ed173b11f2d2d7bcbd1a4d","737c96105c8743cd1dcfd7fe8183430d","1cc59f020b9d62d875bdb28a6e2f745b","a06c5977df8ff3f289f16a7505c8d539","c7b6d357255c49e69b2798e7ae4b8f84","f04158c558df8c51d46a1fb44c832c1c","d1ab6402ad42100de1cf3f5d15aa9d27","dec40354e62d8ca81f5996c1760bc6da","a9356de7c324c6f49c15587032b1f65f","e04f60dec493fd81dd3c785d6c0682ce","ec7a3f5e189221b1a18bed55a592c89d","6c528c765a73009890ab2b7da78818ac","57a4f24cb0d115c4b63a361727798794","4f53464e24c20570df7f23002a321ca7",{"version":"8670027a58140f8dc67c23721e0e3a11","impliedNodeFormat":99},"3a66f588b23a76ede1a4ac23a1d1b5e1","c26a43cbd8a3d5ac85e92e31be4aa8ba","43c3076dab67a06344582d7a443f63d3",{"version":"5c4104ed0accfa2c9db3e05892b5f845","impliedNodeFormat":99},{"version":"02011ddddec34a8eca1e98c39321a22e","impliedNodeFormat":99},{"version":"99486ba41214a6e94d7c78991d342ded","impliedNodeFormat":99},"2a16c01f0d03f02c05fc94fda9d86d55","0627a351508c2c6c7feba1b1b71cfcd1","d7537653c8083ce474548d88b543b98e","304870f33d43ed4067899213f670a6b6","58555670709a8795f58c6bdb817a1cf0",{"version":"db16c16573abd51fedfa8192d0ceeb79","affectsGlobalScope":true,"impliedNodeFormat":1},"7c4aed4001ce0cf61ea56e4fe170a8aa","d92ae047ecefd1ea6f15d92508c96cf7","bc705196fbb186534806f8d052a7939c","b210cf73199ba01431d4c87407e1deea","4381addfae837b659452efdd7b8192a4",{"version":"803b0e4e42d25332e9f22f1b5f31e50d","affectsGlobalScope":true,"impliedNodeFormat":1},"ca4dd245f2032f512d1330de2593acd9",{"version":"3585cc524c08b2eb40ab817052f89462","affectsGlobalScope":true,"impliedNodeFormat":1},"bb3aaf40646363c84e7f812662701116","2640ffe7f041f216a14f18785059f706","f54c29ade8d0c2940399d6ce4c07f4d8","ed4ce0ea67836b63d1620265be339a88","25d3d41f8140ef5f43c8793a0e21a8e5","704e32e377e486f16b2694b56868448f","67fd4c2cdeac0ac2b2f81f5a4e5412a1","5945eb052c3c7a4e81ba8edc80bbd6e0",{"version":"9b0e3ece53adb5a199e3ea7f284d6831","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6de7bcb8b8e5eb18762490bcd9523753","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a48d8bdcd3d359b71b899ac61f8982df","affectsGlobalScope":true,"impliedNodeFormat":1},"6959ae08cf99993a8c4c7a323e8550b7","d1258ed760464b2fdf7b9387e8a2a0db",{"version":"755636ad6f32b63f262ec9940496a366","affectsGlobalScope":true,"impliedNodeFormat":1},"fdca13c9e1b0225fe2ea7411fc134684","b6ea0e1699f2d02d1cf8f6e6022f6245","a90efa10f81813510ca62670ce290c06","b6b079b1f78ec10c992182bad5ca395a","2f2991fcd85839574abe82038a21cc1a",{"version":"783c17923bf66c26b45994a454207a72","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"97960cd63d59c4ff1d7b2bb54433554e","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,657,666,679,754,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,194,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,507,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,615,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,618,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,623,625,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,611,615,627,628,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,638,641,647,649,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,610,615,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,609,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,610,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,617,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,620,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,650,651,652,653,654,655,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,626,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,622,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,623,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,614,615,621,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,622,623,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,629,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,650,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,615,635,637,638,639,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,638,639,641,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,615,630,633,636,643,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,630,631,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,613,630,633,636,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,614,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,615,632,635,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,631,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,632,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,630,632,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,612,613,630,632,633,634,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,632,635,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,615,635,637,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,638,639,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794,796],[85,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,132,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[83,84,85,86,87,88,89,90,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,132,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,132,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,506,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,500,501,504,505,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,789,790,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,525,591,605,607,608,656,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,525,607,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,525,591,592,605,606,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,132,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,791,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,773,774,776,777,783,784,786,787,788,792,793,794],[85,132,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,776,777,783,784,786,787,788,792,793,794],[85,132,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,767,768,769,770,772,773,774,775,776,777,783,784,785,786,787,788,792,793,794,795],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,782,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,778,779,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,778,779,780,781,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,778,780,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,778,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,205,251,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,250,493,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,275,330,401,453,487,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,205,206,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,244,249,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,214,244,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,218,219,220,221,222,223,224,225,226,227,229,230,231,232,233,234,235,236,237,247,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,217,246,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,246,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,239,244,245,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,244,246,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,246,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,244,246,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,217,218,219,220,221,222,223,224,225,226,227,229,230,231,232,233,234,235,236,237,246,247,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,216,246,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,228,246,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,228,244,246,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,211,244,248,249,251,253,256,257,258,260,266,267,271,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,244,248,251,266,270,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,244,248,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,215,216,239,240,241,242,243,244,245,248,258,259,260,266,267,269,270,272,273,274,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,244,248,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,240,244,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,244,260,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,244,254,255,260,267,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,261,262,263,264,265,268,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,203,204,205,211,239,244,246,254,255,260,262,267,268,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,211,248,258,265,267,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,244,251,254,255,260,267,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,252,254,255,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,254,255,260,267,270,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,211,244,248,249,250,254,255,258,260,267,271,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,202,203,204,205,206,211,244,248,249,260,265,270,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,203,204,205,206,244,246,249,254,255,260,267,271,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,216,244,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,214,250,251,252,259,267,271,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,204,205,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,215,238,239,241,242,243,245,246,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,205,215,239,241,242,243,244,245,248,249,270,275,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,204,205,206,211,246,249,268,269,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,201,202,203,206,214,251,254,488,489,490,491,492,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,305,313,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,305,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,296,297,298,299,300,308,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,307,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,307,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,305,306,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,305,307,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,305,307,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,296,297,298,299,300,307,308,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,287,307,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,295,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,251,305,312,313,318,319,320,321,323,326,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,305,307,310,311,316,317,323,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,305,309,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,276,302,303,304,305,306,309,312,318,320,322,323,324,325,327,328,329,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,305,309,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,305,313,323,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,254,305,307,318,323,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,311,314,315,316,317,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,205,211,250,254,255,305,307,315,316,318,323,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,312,314,318,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,254,305,318,323,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,211,250,254,302,305,309,312,313,318,323,326,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,202,203,204,205,206,211,305,309,313,314,323,325,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,250,254,305,307,318,323,326,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,305,325,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,250,251,318,322,326,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,204,205,211,315,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,276,301,302,303,304,306,307,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,276,302,303,304,305,306,313,314,325,330,493,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,204,205,211,309,313,315,324,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,206,251,384,391,494,518,519,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,519,520,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,205,206,250,251,385,391,395,401,494,518,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,206,251,384,391,494,507,508,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,508,509,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,310,509,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,205,206,250,251,385,391,395,401,439,507,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,205,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,372,378,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,214,372,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,332,333,334,335,336,338,339,340,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,375,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,342,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,367,372,373,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,372,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,374,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,337,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,372,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,332,333,334,335,336,338,339,340,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,374,375,376,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,341,374,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,344,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,372,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,337,344,372,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,337,372,374,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,251,372,377,378,379,380,381,382,383,385,390,391,394,395,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,310,372,377,385,390,394,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,372,377,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,331,341,367,368,369,370,371,372,373,377,383,384,385,390,391,393,394,396,397,398,400,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,372,377,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,368,372,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,372,385,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,211,250,254,255,372,385,391,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,382,386,387,388,389,392,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,203,204,205,211,250,254,255,367,372,374,385,387,391,392,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,377,383,389,391,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,254,255,372,385,391,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,254,255,385,391,394,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,211,250,254,255,372,377,378,383,385,391,395,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,202,203,204,205,206,211,372,377,378,385,389,394,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,203,204,205,206,211,250,254,255,372,374,378,385,391,395,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,341,372,376,394,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,214,250,251,252,384,391,395,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,204,205,211,392,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,331,366,367,369,370,371,373,374,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,205,331,367,369,370,371,372,373,377,378,394,401,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,399,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,204,205,206,211,374,378,392,393,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,195,198,199,206,251,384,391,494,495,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,495,496,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,310,496,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,195,198,199,205,206,250,251,385,391,395,401,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,384,514,515,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,515,516,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,205,206,250,251,385,391,395,401,439,514,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,214,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,202,203,205,206,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,205,206,209,489,493,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,493,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,431,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,421,422,423,424,425,426,433,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,432,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,432,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,431,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,431,432,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,431,432,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,214,432,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,421,422,423,424,425,426,432,433,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,412,432,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,420,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,251,431,438,441,442,443,446,448,449,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,310,431,432,435,436,437,448,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,428,429,430,431,434,438,443,446,447,448,450,451,452,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,431,434,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,431,434,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,431,448,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,254,431,432,438,448,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,435,436,437,444,445,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,205,254,255,431,432,436,438,448,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,438,443,444,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,211,250,254,431,434,438,443,448,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,202,203,204,205,206,211,431,434,444,448,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,254,431,432,438,448,449,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,431,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,250,251,438,447,449,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,204,205,211,445,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,427,428,429,430,432,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,205,428,429,430,431,453,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,206,251,438,440,447,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,199,205,206,250,251,438,439,448,449,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,205,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,207,208,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,210,212,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,205,211,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,205,209,213,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,200,201,203,204,206,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,459,480,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,480,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,455,475,476,477,478,483,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,482,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,480,481,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,480,482,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,455,475,476,477,478,482,483,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,474,480,482,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,482,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,206,480,482,488,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,205,206,251,459,460,461,462,465,470,471,480,485,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,310,465,470,480,484,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,480,484,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,454,456,457,458,462,463,465,470,471,473,474,480,481,484,486,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,480,484,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,465,473,480,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,254,255,465,471,480,482,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,466,467,468,469,472,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,211,254,255,456,465,467,471,472,480,482,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,462,469,471,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,206,251,254,255,465,471,480,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,252,254,255,471,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,211,250,254,255,459,462,465,471,480,484,485,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,201,202,203,204,205,206,211,459,465,469,473,480,484,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,203,204,205,206,254,255,459,465,471,480,482,485,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,205,250,251,252,254,463,464,471,485,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,204,205,211,472,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,201,454,456,457,458,479,481,482,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,480,482,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,203,205,454,456,457,458,459,473,480,481,487,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,204,205,211,459,472,482,488,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,198,202,205,206,489,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,199,201,205,489,494,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,667,669,670,671,672,674,675,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,669,672,676,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,668,669,670,671,672,673,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,667,670,671,676,677,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,674,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,759,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,501,502,503,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,501,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,98,101,104,105,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,101,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,101,105,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,95,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,99,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,97,98,101,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,95,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,97,101,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,92,93,94,96,100,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,101,109,117,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,93,99,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,101,126,127,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,93,96,101,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,101,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,92,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,95,96,97,99,100,101,102,103,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,129,130,131,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,101,119,122,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,101,109,110,111,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,99,101,110,112,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,100,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,93,95,101,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,101,105,110,112,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,105,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,99,101,104,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,93,97,101,109,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,101,119,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,112,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,95,101,126,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,604,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,593,594,605,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,595,596,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,593,594,595,597,598,603,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,594,595,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,603,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,595,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,593,594,595,598,599,600,601,602,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,581,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,581,584,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,574,581,582,583,584,585,586,587,588,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,589,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,581,582,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,581,583,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,527,529,530,531,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,527,529,531,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,527,529,531,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,527,529,530,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,527,529,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,527,528,529,530,531,532,533,534,574,575,576,577,578,579,580,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,529,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,526,527,528,530,531,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,529,575,579,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,529,530,531,532,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,590,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,531,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,678,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,657,667,677,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,751,752,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,752,753,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,751,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,750,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,742,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,742,745,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,736,742,743,744,745,746,747,748,749,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,742,743,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,742,744,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,681,683,684,685,686,737,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,681,683,685,686,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,681,683,685,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,680,681,683,684,686,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,681,682,683,684,685,686,687,688,736,737,738,739,740,741,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,683,686,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,680,681,682,684,685,686,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,683,737,740,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,683,684,685,686,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,685,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,191,192,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,195,196,197,497,498,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,191,507,510,511,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,195,493,497,767,768,769,770,772,773,774,776,777,783,784,785,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,522,662,664,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,658,659,755,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,523,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,522,660,662,664,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,493,510,524,659,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,195,196,197,497,498,664,760,761,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,401,514,517,518,521,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,522,659,662,664,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,401,493,514,523,524,658,659,660,661,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,401,493,657,658,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,401,522,659,662,663,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794],[85,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,401,522,662,664,767,768,769,770,772,773,774,776,777,783,784,786,787,788,792,793,794]],"options":{"allowJs":true,"esModuleInterop":true,"jsx":1,"module":99,"skipLibCheck":true,"strict":true,"target":4,"verbatimModuleSyntax":true},"referencedMap":[[525,1],[755,2],[196,3],[195,3],[194,1],[197,3],[518,4],[617,5],[620,6],[626,7],[629,8],[650,9],[628,10],[609,1],[610,11],[611,12],[614,1],[612,1],[613,1],[651,13],[616,5],[615,1],[652,14],[619,6],[618,1],[656,15],[653,16],[623,17],[625,18],[622,19],[624,20],[621,17],[654,21],[627,5],[655,22],[640,23],[642,24],[644,25],[643,26],[637,27],[630,28],[649,29],[646,30],[648,31],[633,32],[635,33],[632,30],[636,1],[647,34],[634,1],[645,1],[631,1],[638,35],[639,1],[641,36],[592,1],[771,37],[137,38],[138,39],[139,40],[85,41],[140,42],[141,43],[142,44],[83,1],[143,45],[144,46],[145,47],[146,48],[147,49],[148,50],[149,51],[150,52],[151,53],[152,54],[153,55],[86,1],[84,1],[154,56],[155,57],[156,58],[190,59],[157,60],[158,61],[159,62],[160,63],[161,64],[162,65],[163,66],[164,67],[165,68],[166,69],[167,70],[168,71],[169,72],[170,73],[171,74],[172,75],[174,76],[173,77],[175,78],[176,79],[177,80],[178,81],[179,82],[180,83],[181,84],[182,85],[183,86],[184,87],[185,88],[186,89],[187,90],[87,1],[88,1],[89,1],[90,1],[133,91],[134,1],[135,1],[136,92],[188,93],[189,94],[507,95],[506,96],[505,95],[789,1],[791,97],[81,1],[82,1],[13,1],[14,1],[16,1],[15,1],[2,1],[17,1],[18,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[3,1],[25,1],[26,1],[4,1],[27,1],[31,1],[28,1],[29,1],[30,1],[32,1],[33,1],[34,1],[5,1],[35,1],[36,1],[37,1],[38,1],[6,1],[42,1],[39,1],[40,1],[41,1],[43,1],[7,1],[44,1],[49,1],[50,1],[45,1],[46,1],[47,1],[48,1],[8,1],[54,1],[51,1],[52,1],[53,1],[55,1],[9,1],[56,1],[57,1],[58,1],[60,1],[59,1],[61,1],[62,1],[10,1],[63,1],[64,1],[65,1],[11,1],[66,1],[67,1],[68,1],[69,1],[70,1],[1,1],[71,1],[72,1],[12,1],[76,1],[74,1],[79,1],[78,1],[73,1],[77,1],[75,1],[80,1],[657,98],[608,99],[607,100],[663,1],[91,1],[770,101],[795,1],[786,102],[773,103],[792,104],[772,105],[769,106],[774,107],[767,108],[775,1],[796,109],[776,110],[785,1],[787,111],[768,112],[794,113],[788,114],[793,115],[777,116],[783,117],[780,118],[782,119],[781,120],[779,121],[778,1],[784,122],[790,1],[191,123],[192,92],[490,124],[494,125],[439,126],[250,1],[200,127],[488,128],[489,129],[198,1],[491,130],[272,131],[215,132],[238,133],[247,134],[218,134],[219,135],[220,135],[246,136],[221,137],[222,135],[228,138],[223,139],[224,135],[225,135],[248,140],[217,141],[226,134],[227,139],[229,142],[230,142],[231,139],[232,135],[233,134],[234,135],[235,143],[236,143],[237,135],[259,144],[267,145],[245,146],[275,147],[239,148],[241,149],[242,146],[253,150],[261,151],[266,152],[263,153],[268,154],[256,155],[257,156],[264,157],[265,158],[271,159],[262,160],[240,130],[273,161],[216,130],[260,162],[258,163],[244,164],[243,146],[274,165],[249,166],[269,1],[270,167],[493,168],[199,130],[310,1],[327,169],[276,170],[301,171],[308,172],[277,172],[278,172],[279,173],[307,174],[280,175],[295,172],[281,176],[282,176],[283,173],[284,172],[285,173],[286,172],[309,177],[287,172],[288,172],[289,178],[290,172],[291,172],[292,178],[293,173],[294,172],[296,179],[297,178],[298,172],[299,173],[300,172],[322,180],[318,181],[306,182],[330,183],[302,184],[303,182],[319,185],[311,186],[320,187],[317,188],[315,189],[321,190],[314,191],[326,192],[316,193],[328,194],[323,195],[312,196],[305,197],[304,182],[329,198],[313,166],[324,1],[325,199],[520,200],[521,201],[519,202],[509,203],[510,204],[511,205],[508,206],[202,207],[396,208],[331,209],[366,210],[375,211],[332,212],[333,212],[334,213],[335,212],[374,214],[336,215],[337,216],[338,217],[339,212],[376,218],[377,219],[340,212],[342,220],[343,211],[345,221],[346,222],[347,222],[348,213],[349,212],[350,212],[351,218],[352,213],[353,213],[354,222],[355,212],[356,211],[357,212],[358,213],[359,223],[344,224],[360,212],[361,213],[362,212],[363,212],[364,212],[365,212],[384,225],[391,226],[373,227],[401,228],[367,229],[369,230],[370,227],[379,231],[386,232],[390,233],[388,234],[392,235],[380,236],[381,156],[382,237],[389,238],[395,239],[387,240],[368,130],[397,241],[341,130],[385,242],[383,243],[372,244],[371,227],[398,245],[399,1],[400,246],[378,166],[393,1],[394,247],[496,248],[497,249],[498,250],[495,251],[516,252],[517,253],[515,254],[211,255],[204,256],[254,130],[251,257],[255,258],[252,259],[450,260],[427,261],[433,262],[402,262],[403,262],[404,263],[432,264],[405,265],[420,262],[406,266],[407,266],[408,263],[409,262],[410,267],[411,262],[434,268],[412,262],[413,262],[414,269],[415,262],[416,262],[417,269],[418,263],[419,262],[421,270],[422,269],[423,262],[424,263],[425,262],[426,262],[447,271],[438,272],[453,273],[428,274],[429,275],[442,276],[435,277],[446,278],[437,279],[445,280],[444,281],[449,282],[436,283],[451,284],[448,285],[443,286],[431,287],[430,275],[452,288],[441,289],[440,290],[207,291],[209,292],[208,291],[210,291],[213,293],[212,294],[214,295],[205,296],[486,297],[454,298],[479,299],[483,300],[482,301],[455,302],[484,303],[475,304],[476,300],[477,305],[478,306],[463,307],[471,308],[481,309],[487,310],[456,311],[457,309],[460,312],[466,313],[470,314],[468,315],[472,316],[461,317],[464,318],[469,319],[485,320],[467,321],[465,322],[462,323],[480,324],[458,325],[474,326],[459,166],[473,327],[203,166],[201,328],[206,329],[492,1],[606,1],[676,330],[677,331],[674,332],[668,1],[669,1],[672,333],[673,334],[670,1],[667,1],[675,1],[671,1],[759,1],[760,335],[761,335],[504,336],[501,337],[503,338],[502,1],[500,1],[514,1],[109,339],[121,340],[107,341],[122,1],[131,342],[98,343],[99,344],[97,92],[130,337],[125,345],[129,346],[101,347],[118,348],[100,349],[128,350],[95,351],[96,345],[102,352],[103,1],[108,346],[106,352],[93,353],[132,354],[123,355],[112,356],[111,352],[113,357],[116,358],[110,359],[114,360],[126,337],[104,361],[105,362],[117,363],[94,1],[120,364],[119,352],[115,365],[124,1],[92,1],[127,366],[666,367],[595,368],[597,369],[604,370],[599,1],[600,1],[598,371],[601,372],[593,1],[594,1],[605,367],[596,373],[602,1],[603,374],[585,375],[588,376],[586,376],[582,375],[589,377],[590,378],[587,376],[583,379],[584,380],[578,381],[530,382],[532,383],[576,1],[531,384],[577,385],[581,386],[579,1],[533,382],[534,1],[575,387],[529,388],[526,1],[580,389],[527,390],[528,1],[591,391],[535,392],[536,392],[537,392],[538,392],[539,392],[540,392],[541,392],[542,392],[543,392],[544,392],[545,392],[547,392],[546,392],[548,392],[549,392],[550,392],[574,393],[551,392],[552,392],[553,392],[554,392],[555,392],[556,392],[557,392],[558,392],[559,392],[561,392],[560,392],[562,392],[563,392],[564,392],[565,392],[566,392],[567,392],[568,392],[569,392],[570,392],[571,392],[572,392],[573,392],[679,394],[678,395],[753,396],[754,397],[752,398],[751,399],[746,400],[749,401],[747,401],[743,400],[750,402],[748,401],[744,403],[745,404],[739,405],[684,406],[686,407],[738,1],[685,408],[742,409],[740,1],[687,406],[688,1],[737,410],[683,411],[680,1],[741,412],[681,413],[682,1],[689,414],[690,414],[691,414],[692,414],[693,414],[694,414],[695,414],[696,414],[697,414],[698,414],[699,414],[700,414],[701,414],[703,414],[702,414],[704,414],[705,414],[706,414],[736,415],[707,414],[708,414],[709,414],[710,414],[711,414],[712,414],[713,414],[714,414],[715,414],[716,414],[717,414],[718,414],[719,414],[721,414],[720,414],[722,414],[723,414],[724,414],[725,414],[726,414],[727,414],[728,414],[729,414],[730,414],[731,414],[732,414],[735,414],[733,414],[734,414],[193,416],[499,417],[512,418],[513,419],[665,420],[756,421],[757,422],[523,1],[758,1],[524,259],[766,423],[660,424],[661,424],[762,425],[763,420],[522,426],[764,427],[662,428],[659,429],[658,1],[664,430],[765,431]],"affectedFilesPendingEmit":[193,499,512,513,665,756,757,523,758,524,766,660,661,762,763,522,764,662,659,658,664,765]} \ No newline at end of file diff --git a/packages/desktop/src/agent.tsx b/packages/desktop/src/agent.tsx index c807c04..780581c 100644 --- a/packages/desktop/src/agent.tsx +++ b/packages/desktop/src/agent.tsx @@ -1,15 +1,14 @@ -import React, { useState, useEffect, useMemo, useCallback } from "react"; -import { createRoot } from "react-dom/client"; -import { useDevMode, Logger } from "blink/react"; import { setEsbuildInstance } from "blink/build"; +import { Logger, useDevMode } from "blink/react"; +import { Copy } from "lucide-react"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; +import { createRoot } from "react-dom/client"; import { MessageBubble } from "./components/MessageBubble"; import SourceBrowser, { buildFileTree, type TreeNode, } from "./components/SourceBrowser"; import { Button } from "./components/ui/button"; -import { Copy } from "lucide-react"; -import { Alert, AlertDescription, AlertTitle } from "./components/ui/alert"; // Declare electron API declare const require: any; diff --git a/packages/desktop/src/app.tsx b/packages/desktop/src/app.tsx index f56f599..9d35555 100644 --- a/packages/desktop/src/app.tsx +++ b/packages/desktop/src/app.tsx @@ -1,17 +1,9 @@ -import React, { useState, useEffect, Suspense } from "react"; +import React, { Suspense, useState } from "react"; import { createRoot } from "react-dom/client"; -import { useAuth } from "./hooks/useAuth"; -import { ThemeProvider } from "./contexts/ThemeContext"; -import { Button } from "./components/ui/button"; -import { - Card, - CardHeader, - CardTitle, - CardDescription, - CardContent, - CardFooter, -} from "./components/ui/card"; import { Alert, AlertDescription } from "./components/ui/alert"; +import { Button } from "./components/ui/button"; +import { ThemeProvider } from "./contexts/ThemeContext"; +import { useAuth } from "./hooks/useAuth"; const AgentView = React.lazy(() => import("./components/AgentView")); diff --git a/packages/desktop/src/components/AgentView.tsx b/packages/desktop/src/components/AgentView.tsx index 7d2e152..c3d45b1 100644 --- a/packages/desktop/src/components/AgentView.tsx +++ b/packages/desktop/src/components/AgentView.tsx @@ -1,8 +1,22 @@ -import React, { useState, useEffect, useMemo, useCallback } from "react"; -import { useDevMode, Logger } from "blink/react"; -import { setEsbuildInstance } from "blink/build"; import { isToolOrDynamicToolUIPart } from "ai"; -import { useTheme } from "../contexts/ThemeContext"; +import type { ID } from "blink"; +import { setEsbuildInstance } from "blink/build"; +import { Logger, useDevMode } from "blink/react"; +import { + ArrowDown, + ArrowLeftRight, + ExternalLink, + Eye, + EyeOff, + FolderTree, + LogOut, + Plus, + SendHorizonal, + Settings, + Trash2, + User, +} from "lucide-react"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; import { MessageBubble } from "../components/MessageBubble"; import SourceBrowser, { buildFileTree, @@ -17,27 +31,11 @@ import { DialogHeader, DialogTitle, } from "../components/ui/dialog"; -import { Tooltip } from "../components/ui/tooltip"; -import { Switch } from "../components/ui/switch"; import { Select } from "../components/ui/select"; -import { - SendHorizonal, - Copy, - Trash2, - ArrowLeftRight, - Plus, - FolderTree, - Settings, - Eye, - EyeOff, - LogOut, - User, - ExternalLink, - ArrowDown, -} from "lucide-react"; +import { Switch } from "../components/ui/switch"; +import { Tooltip } from "../components/ui/tooltip"; +import { useTheme } from "../contexts/ThemeContext"; import { useAuth } from "../hooks/useAuth"; -import { Alert, AlertDescription, AlertTitle } from "./ui/alert"; -import type { ID } from "blink"; declare const require: any; diff --git a/packages/desktop/src/components/MessageBubble.tsx b/packages/desktop/src/components/MessageBubble.tsx index fd6513d..50c114c 100644 --- a/packages/desktop/src/components/MessageBubble.tsx +++ b/packages/desktop/src/components/MessageBubble.tsx @@ -1,8 +1,8 @@ +import type { UIMessage } from "ai"; +import { getToolOrDynamicToolName, isToolOrDynamicToolUIPart } from "ai"; import React from "react"; import ReactMarkdown from "react-markdown"; import rehypeHighlight from "rehype-highlight"; -import type { UIMessage } from "ai"; -import { getToolOrDynamicToolName, isToolOrDynamicToolUIPart } from "ai"; // Declare electron API for opening external links declare const require: any; diff --git a/packages/desktop/src/components/SourceBrowser.tsx b/packages/desktop/src/components/SourceBrowser.tsx index 3a3c7dd..aa8677f 100644 --- a/packages/desktop/src/components/SourceBrowser.tsx +++ b/packages/desktop/src/components/SourceBrowser.tsx @@ -1,10 +1,10 @@ -import React, { useState, useMemo, memo, useEffect } from "react"; +import { ChevronDown, ExternalLink, File, X } from "lucide-react"; +import React, { memo, useEffect, useState } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { - vscDarkPlus, vs, + vscDarkPlus, } from "react-syntax-highlighter/dist/esm/styles/prism"; -import { ExternalLink, ChevronDown, ChevronRight, File, X } from "lucide-react"; import { useTheme } from "../contexts/ThemeContext"; declare const require: any; diff --git a/packages/desktop/src/components/ui/alert.tsx b/packages/desktop/src/components/ui/alert.tsx index 5d1316e..249ea22 100644 --- a/packages/desktop/src/components/ui/alert.tsx +++ b/packages/desktop/src/components/ui/alert.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react"; import { cn } from "../../lib/utils"; @@ -57,4 +57,4 @@ const AlertDescription = React.forwardRef< )); AlertDescription.displayName = "AlertDescription"; -export { Alert, AlertTitle, AlertDescription }; +export { Alert, AlertDescription, AlertTitle }; diff --git a/packages/desktop/src/components/ui/button.tsx b/packages/desktop/src/components/ui/button.tsx index d0775eb..9cb0247 100644 --- a/packages/desktop/src/components/ui/button.tsx +++ b/packages/desktop/src/components/ui/button.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react"; import { cn } from "../../lib/utils"; diff --git a/packages/desktop/src/components/ui/card.tsx b/packages/desktop/src/components/ui/card.tsx index ce6a53e..0a2a203 100644 --- a/packages/desktop/src/components/ui/card.tsx +++ b/packages/desktop/src/components/ui/card.tsx @@ -74,9 +74,9 @@ CardFooter.displayName = "CardFooter"; export { Card, - CardHeader, - CardTitle, - CardDescription, CardContent, + CardDescription, CardFooter, + CardHeader, + CardTitle, }; diff --git a/packages/desktop/src/components/ui/dialog.tsx b/packages/desktop/src/components/ui/dialog.tsx index af4c58c..988471c 100644 --- a/packages/desktop/src/components/ui/dialog.tsx +++ b/packages/desktop/src/components/ui/dialog.tsx @@ -1,5 +1,4 @@ import React from "react"; -import { Button } from "./button"; interface DialogProps { open: boolean; diff --git a/packages/desktop/src/components/ui/switch.tsx b/packages/desktop/src/components/ui/switch.tsx index eb24ff6..27c9d60 100644 --- a/packages/desktop/src/components/ui/switch.tsx +++ b/packages/desktop/src/components/ui/switch.tsx @@ -1,5 +1,3 @@ -import React from "react"; - interface SwitchProps { checked: boolean; onCheckedChange: (checked: boolean) => void; diff --git a/packages/desktop/src/components/ui/tooltip.tsx b/packages/desktop/src/components/ui/tooltip.tsx index c951682..2e5a063 100644 --- a/packages/desktop/src/components/ui/tooltip.tsx +++ b/packages/desktop/src/components/ui/tooltip.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef, useEffect } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { createPortal } from "react-dom"; interface TooltipProps { diff --git a/packages/desktop/src/contexts/ThemeContext.tsx b/packages/desktop/src/contexts/ThemeContext.tsx index fd019cc..b8e4bb7 100644 --- a/packages/desktop/src/contexts/ThemeContext.tsx +++ b/packages/desktop/src/contexts/ThemeContext.tsx @@ -1,8 +1,8 @@ -import React, { +import { createContext, useContext, - useState, useEffect, + useState, type ReactNode, } from "react"; diff --git a/packages/desktop/src/file-viewer.tsx b/packages/desktop/src/file-viewer.tsx index c4506d0..a82bfb8 100644 --- a/packages/desktop/src/file-viewer.tsx +++ b/packages/desktop/src/file-viewer.tsx @@ -1,9 +1,9 @@ -import React, { useState, useEffect } from "react"; +import React, { useEffect, useState } from "react"; import { createRoot } from "react-dom/client"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { - vscDarkPlus, vs, + vscDarkPlus, } from "react-syntax-highlighter/dist/esm/styles/prism"; declare const require: any; diff --git a/packages/desktop/src/hooks/index.ts b/packages/desktop/src/hooks/index.ts index 785a6e7..7b1c05d 100644 --- a/packages/desktop/src/hooks/index.ts +++ b/packages/desktop/src/hooks/index.ts @@ -1,2 +1,2 @@ -export { useAuth, getAuthToken, setAuthToken, clearAuthToken } from "./useAuth"; +export { clearAuthToken, getAuthToken, setAuthToken, useAuth } from "./useAuth"; export type { AuthState, UseAuthReturn } from "./useAuth"; diff --git a/packages/desktop/src/hooks/useAuth.ts b/packages/desktop/src/hooks/useAuth.ts index 166af1e..0dc00c3 100644 --- a/packages/desktop/src/hooks/useAuth.ts +++ b/packages/desktop/src/hooks/useAuth.ts @@ -1,7 +1,7 @@ -import { useState, useEffect } from "react"; +import Client from "@blink.so/api"; import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs"; import { dirname, join } from "path"; -import Client from "@blink.so/api"; +import { useEffect, useState } from "react"; declare const require: any; diff --git a/packages/desktop/src/main.ts b/packages/desktop/src/main.ts index 4272c72..64a053f 100644 --- a/packages/desktop/src/main.ts +++ b/packages/desktop/src/main.ts @@ -1,13 +1,13 @@ import { app, BrowserWindow, + dialog, ipcMain, - nativeImage, Menu, - dialog, + nativeImage, } from "electron"; -import { join } from "path"; import { readFileSync } from "fs"; +import { join } from "path"; // esbuild injects __dirname for CJS declare const __dirname: string; diff --git a/packages/desktop/src/renderer.tsx b/packages/desktop/src/renderer.tsx index 0bb756f..72917a7 100644 --- a/packages/desktop/src/renderer.tsx +++ b/packages/desktop/src/renderer.tsx @@ -1,9 +1,7 @@ -import React, { useState, useEffect } from "react"; +import { Logger, useDevMode } from "blink/react"; +import React, { useState } from "react"; import { createRoot } from "react-dom/client"; -import { useDevMode, Logger } from "blink/react"; import { useAuth } from "./hooks/useAuth"; -import { existsSync } from "fs"; -import { join } from "path"; // Declare electron API available via nodeIntegration declare const require: any; diff --git a/packages/model-intent/src/index.test.ts b/packages/model-intent/src/index.test.ts index dced87c..1a007d4 100644 --- a/packages/model-intent/src/index.test.ts +++ b/packages/model-intent/src/index.test.ts @@ -1,13 +1,13 @@ -import { test, expect, describe } from "bun:test"; -import { z } from "zod"; import { - streamText, simulateReadableStream, + streamText, tool, type ModelMessage, type ToolSet, } from "ai"; import { MockLanguageModelV2 } from "ai/test"; +import { describe, expect, test } from "bun:test"; +import { z } from "zod"; import withModelIntent from "./index"; type Properties = { foo: string; bar?: number }; diff --git a/packages/multiplexer/src/multiplexer.test.ts b/packages/multiplexer/src/multiplexer.test.ts index 5c0b74a..9f0694e 100644 --- a/packages/multiplexer/src/multiplexer.test.ts +++ b/packages/multiplexer/src/multiplexer.test.ts @@ -1,9 +1,9 @@ -import { test, expect, describe, beforeEach } from "bun:test"; +import { beforeEach, describe, expect, test } from "bun:test"; import Multiplexer, { + Flag, FrameCodec, - Stream, MessageType, - Flag, + Stream, type Frame, } from "./multiplexer"; diff --git a/packages/runtime/package.json b/packages/runtime/package.json new file mode 100644 index 0000000..9f31e08 --- /dev/null +++ b/packages/runtime/package.json @@ -0,0 +1,16 @@ +{ + "name": "@blink.so/runtime", + "private": true, + "type": "module", + "exports": { + "./server": "./src/server.ts", + "./types": "./src/types.ts", + "./node/wrapper": "./src/node/wrapper-node.generated.ts", + "./lambda": "./src/lambda/runtime-lambda.ts" + }, + "dependencies": {}, + "devDependencies": { + "aws4fetch": "^1.0.20", + "jszip": "^3.10.1" + } +} diff --git a/packages/runtime/scripts/generate.ts b/packages/runtime/scripts/generate.ts new file mode 100644 index 0000000..4109d1d --- /dev/null +++ b/packages/runtime/scripts/generate.ts @@ -0,0 +1,49 @@ +#!/usr/bin/env bun +import { join } from "node:path"; + +const wrapperNode = join(__dirname, "../src/node/wrapper-node.ts"); + +let result = await Bun.build({ + entrypoints: [wrapperNode], + target: "node", + format: "esm", + minify: true, +}); + +let output = result.outputs[0]; +if (!output) { + throw new Error("No output generated"); +} + +await Bun.write( + join(__dirname, "../src/node/wrapper-node.generated.ts"), + ` +// This file has been generated by the ${import.meta.filename} script. +// Do not edit this file manually. + +export default ${JSON.stringify(await output.text())} +`.trim() +); + +const wrapperLambda = join(__dirname, "../src/lambda/wrapper-lambda.ts"); + +result = await Bun.build({ + entrypoints: [wrapperLambda], + target: "node", + format: "esm", +}); + +output = result.outputs[0]; +if (!output) { + throw new Error("No output generated"); +} + +await Bun.write( + join(__dirname, "../src/lambda/wrapper-lambda.generated.ts"), + ` +// This file has been generated by the ${import.meta.filename} script. +// Do not edit this file manually. + +export default ${JSON.stringify(await output.text())} +`.trim() +); diff --git a/packages/runtime/src/lambda/fixtures/client-using-storage.ts b/packages/runtime/src/lambda/fixtures/client-using-storage.ts new file mode 100644 index 0000000..32e33b3 --- /dev/null +++ b/packages/runtime/src/lambda/fixtures/client-using-storage.ts @@ -0,0 +1,32 @@ +import { APIServerURLEnvironmentVariable } from "blink/client"; +import { api } from "blink/control"; +import { hc } from "hono/client"; +import http from "http"; + +// Here we're going to make it actually attempt to request the Blink API. +const client = hc(process.env[APIServerURLEnvironmentVariable]!); + +http + .createServer(async (req, res) => { + await client.kv[":key"].$post({ + param: { + key: "test", + }, + json: { + value: "Hello, world!", + }, + }); + + const resp = await client.kv[":key"].$get({ + param: { + key: "test", + }, + }); + if (!resp.ok) { + throw new Error(`Failed to get storage: ${await resp.text()}`); + } + const value = await resp.json(); + res.end(value.value); + }) + .listen(parseInt(process.env.PORT as string)) + .unref(); diff --git a/packages/runtime/src/lambda/runtime-lambda.ts b/packages/runtime/src/lambda/runtime-lambda.ts new file mode 100644 index 0000000..66b5b0f --- /dev/null +++ b/packages/runtime/src/lambda/runtime-lambda.ts @@ -0,0 +1,341 @@ +import { AwsClient } from "aws4fetch"; +import JSZip from "jszip"; +import { Readable } from "node:stream"; +import lambdaWrapperCode from "./wrapper-lambda.generated"; + +const defaultRuntime = "nodejs22.x"; + +export interface AWSOptions { + readonly accessKeyId: string; + readonly secretAccessKey: string; + readonly region: string; +} + +export interface DeployOptions { + readonly aws: AWSOptions; + readonly lambdaRoleArn: string; + + // ID is a unique identifier for the deployment. + // This becomes the `FunctionName` for the Lambda. + readonly id: string; + readonly logGroupName: string; + + readonly files: + | Record + | AsyncIterable<{ path: string; content: string | ReadableStream }>; + + readonly entrypoint: string; + readonly env?: Record; + + // The memory size of the Lambda function. + // 128MB - 10240MB. Defaults to 256MB. + readonly memoryMB?: number; +} + +export interface Deployment { + readonly url: string; + readonly arn: string; +} + +/** + * Upserts a Lambda function by ID returning it's + * accessible URL and ARN. + * + * @param options - The options for the deployment. + * @returns The deployment information. + * @example + * ```ts + * const { url, arn } = await deploy({ + * aws: { + * accessKeyId: process.env.AWS_ACCESS_KEY_ID!, + * secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!, + * region: "us-east-1", + * }, + * lambdaRoleArn: "arn:aws:iam::816024705661:role/user-http-lambda-role", + * id: "blink-test-agent", + * files: { + * "index.js": "", + * }, + * entrypoint: "index.js", + * env: { + * AI_GATEWAY_API_KEY: process.env.AI_GATEWAY_API_KEY, + * }, + * }); + * ``` + */ +export async function deploy(options: DeployOptions): Promise { + const aws = createAWSClient(options.aws); + + // Create or update CloudWatch log group + await upsertLogGroup(aws, options.aws.region, options.logGroupName); + + const zip = new JSZip(); + + // Process files one at a time to reduce memory pressure + if (Symbol.asyncIterator in options.files) { + for await (const { path, content } of options.files) { + // Convert ReadableStream to Promise which JSZip supports + if (content instanceof ReadableStream) { + // This works - it's just hacky because of web/node types. + zip.file(path, Readable.fromWeb(content as any)); + } else { + zip.file(path, content); + } + } + } else { + for (const [path, content] of Object.entries(options.files)) { + zip.file(path, content); + } + } + + const wrapperEntrypoint = `__wrapper`; + const lambdaHandler = `${wrapperEntrypoint}.handler`; + // This wrapper code is a simple conversion of the default `fetch` function + // agents export to run on AWS Lambda. We intentionally avoid doing any + // platform-specific code at build, so that we can flexibly migrate to + // other runtimes in the future. + zip.file(`${wrapperEntrypoint}.js`, lambdaWrapperCode); + + const base64 = await zip.generateAsync({ + type: "base64", + compression: "DEFLATE", + compressionOptions: { level: 6 }, + streamFiles: true, + }); + + // I don't know why, but there are separate versions of the API. + // Someone later can experiment why it needs to work this way... + const base2015 = `https://lambda.${options.aws.region}.amazonaws.com/2015-03-31`; + const base2021 = `https://lambda.${options.aws.region}.amazonaws.com/2021-10-31`; + + const Environment = { + Variables: { + ...options.env, + // This is a special environment variable used + // by our wrapper code to determine the entrypoint. + ENTRYPOINT: options.entrypoint, + }, + }; + + // We first attempt to update the configuration of an existing function. + // This is weird, but if we update the code first, this request fails + // with a 409 conflict. + let res = await aws.fetch( + `${base2015}/functions/${encodeURIComponent(options.id)}/configuration`, + { + method: "PUT", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + Environment, + Handler: lambdaHandler, + // The default timeout is 3 seconds, which is too short + // for the vast majority of agents. + Timeout: 300, + MemorySize: options.memoryMB ?? 256, + LoggingConfig: { + LogFormat: "JSON", + LogGroup: options.logGroupName, + }, + }), + } + ); + if (res.status === 404) { + // Function does not exist, so we create it. + res = await aws.fetch(`${base2015}/functions`, { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + FunctionName: options.id, + Runtime: defaultRuntime, + Handler: lambdaHandler, + Role: options.lambdaRoleArn, + Code: { ZipFile: base64 }, + Publish: true, + Environment, + Timeout: 300, + MemorySize: options.memoryMB ?? 256, + LoggingConfig: { + LogFormat: "JSON", + LogGroup: options.logGroupName, + }, + }), + }); + + if (res.status !== 201) { + const body = await res.text(); + throw new Error(`Failed to create function: ${res.status} ${body}`); + } + } else if (res.status !== 200) { + const body = await res.text(); + throw new Error(`Failed to deploy: ${res.status} ${body}`); + } else { + // If it was a 200, we updated env vars successfully + // and we can now update the code. + res = await aws.fetch( + `${base2015}/functions/${encodeURIComponent(options.id)}/code`, + { + method: "PUT", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + ZipFile: base64, + Publish: true, + }), + } + ); + } + + const updatePolicy = (async () => { + const policyRes = await aws.fetch( + `${base2015}/functions/${encodeURIComponent(options.id)}/policy`, + { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + StatementId: "furl-public", + Action: "lambda:InvokeFunctionUrl", + Principal: "*", + FunctionUrlAuthType: "NONE", + }), + } + ); + if (policyRes.status !== 201 && policyRes.status !== 409) { + const body = await policyRes.text(); + throw new Error( + `Failed to update function policy: ${policyRes.status} ${body}` + ); + } + })(); + + const updateURL = (async () => { + // Attempt to update the function URL configuration so that we can + // actually invoke this bad-boy. + const updateURLBody = { + // TODO: Change this once we have the auth proxying. + AuthType: "NONE", + Cors: { AllowOrigins: ["*"] }, + InvokeMode: "RESPONSE_STREAM", + }; + res = await aws.fetch( + `${base2021}/functions/${encodeURIComponent(options.id)}/url`, + { + method: "PUT", + headers: { "content-type": "application/json" }, + body: JSON.stringify(updateURLBody), + } + ); + if (res.status === 404) { + // If the function URL configuration does not exist, we create it. + res = await aws.fetch( + `${base2021}/functions/${encodeURIComponent(options.id)}/url`, + { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify(updateURLBody), + } + ); + } else if (res.status !== 200) { + const body = await res.text(); + throw new Error( + `Failed to update function URL configuration: ${res.status} ${body}` + ); + } + + const json = (await res.json()) as { + FunctionUrl: string; + FunctionArn: string; + }; + return { + url: json.FunctionUrl, + arn: json.FunctionArn, + }; + })(); + + // We put these in parallel for speed. + await updatePolicy; + return updateURL; +} + +function createAWSClient(options: AWSOptions): AwsClient { + return new AwsClient({ + accessKeyId: options.accessKeyId, + secretAccessKey: options.secretAccessKey, + region: options.region, + }); +} + +async function upsertLogGroup( + aws: AwsClient, + region: string, + logGroupName: string +): Promise { + const logsBaseUrl = `https://logs.${region}.amazonaws.com/`; + + // First, try to describe the log group to see if it exists + let logGroupExists = false; + try { + const describeRes = await aws.fetch(logsBaseUrl, { + method: "POST", + headers: { + "Content-Type": "application/x-amz-json-1.1", + "X-Amz-Target": "Logs_20140328.DescribeLogGroups", + }, + body: JSON.stringify({ + logGroupNamePrefix: logGroupName, + limit: 1, + }), + }); + + if (describeRes.ok) { + const data = (await describeRes.json()) as { + logGroups: { logGroupName: string }[]; + }; + logGroupExists = data.logGroups.some( + (lg) => lg.logGroupName === logGroupName + ); + } + } catch (error) { + // If describe fails, assume log group doesn't exist + logGroupExists = false; + } + + if (!logGroupExists) { + // Create the log group + const createRes = await aws.fetch(logsBaseUrl, { + method: "POST", + headers: { + "Content-Type": "application/x-amz-json-1.1", + "X-Amz-Target": "Logs_20140328.CreateLogGroup", + }, + body: JSON.stringify({ + logGroupName, + }), + }); + + if (!createRes.ok) { + const body = await createRes.text(); + throw new Error( + `Failed to create log group: ${createRes.status} ${body}` + ); + } + } + + // Set retention policy to 30 days + const retentionRes = await aws.fetch(logsBaseUrl, { + method: "POST", + headers: { + "Content-Type": "application/x-amz-json-1.1", + "X-Amz-Target": "Logs_20140328.PutRetentionPolicy", + }, + body: JSON.stringify({ + logGroupName, + retentionInDays: 30, + }), + }); + + if (!retentionRes.ok) { + const body = await retentionRes.text(); + throw new Error( + `Failed to set log group retention: ${retentionRes.status} ${body}` + ); + } +} diff --git a/packages/runtime/src/lambda/wrapper-lambda.generated.ts b/packages/runtime/src/lambda/wrapper-lambda.generated.ts new file mode 100644 index 0000000..e9a2d3c --- /dev/null +++ b/packages/runtime/src/lambda/wrapper-lambda.generated.ts @@ -0,0 +1,4 @@ +// This file has been generated by the /home/kyle/projects/coder/blink.so/packages/runtime/scripts/generate.ts script. +// Do not edit this file manually. + +export default 'import { createRequire } from "node:module";\nvar __defProp = Object.defineProperty;\nvar __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, {\n get: all[name],\n enumerable: true,\n configurable: true,\n set: (newValue) => all[name] = () => newValue\n });\n};\nvar __require = /* @__PURE__ */ createRequire(import.meta.url);\n\n// ../../node_modules/@whatwg-node/fetch/dist/shouldSkipPonyfill.js\nvar require_shouldSkipPonyfill = __commonJS((exports, module) => {\n function isNextJs() {\n return Object.keys(globalThis).some((key) => key.startsWith("__NEXT"));\n }\n module.exports = function shouldSkipPonyfill() {\n if (globalThis.Deno) {\n return true;\n }\n if (globalThis.Bun) {\n return true;\n }\n if (isNextJs()) {\n return true;\n }\n return false;\n };\n});\n\n// ../../node_modules/urlpattern-polyfill/dist/urlpattern.cjs\nvar require_urlpattern = __commonJS((exports, module) => {\n var U = Object.defineProperty;\n var Re = Object.getOwnPropertyDescriptor;\n var Ee = Object.getOwnPropertyNames;\n var Oe = Object.prototype.hasOwnProperty;\n var a = (e, t) => U(e, "name", { value: t, configurable: true });\n var ke = (e, t) => {\n for (var r in t)\n U(e, r, { get: t[r], enumerable: true });\n };\n var Te = (e, t, r, n) => {\n if (t && typeof t == "object" || typeof t == "function")\n for (let o of Ee(t))\n !Oe.call(e, o) && o !== r && U(e, o, { get: () => t[o], enumerable: !(n = Re(t, o)) || n.enumerable });\n return e;\n };\n var Ae = (e) => Te(U({}, "__esModule", { value: true }), e);\n var He = {};\n ke(He, { URLPattern: () => M });\n module.exports = Ae(He);\n var P = class {\n type = 3;\n name = "";\n prefix = "";\n value = "";\n suffix = "";\n modifier = 3;\n constructor(t, r, n, o, l, f) {\n this.type = t, this.name = r, this.prefix = n, this.value = o, this.suffix = l, this.modifier = f;\n }\n hasCustomName() {\n return this.name !== "" && typeof this.name != "number";\n }\n };\n a(P, "Part");\n var ye = /[$_\\p{ID_Start}]/u;\n var we = /[$_\\u200C\\u200D\\p{ID_Continue}]/u;\n var F = ".*";\n function Ce(e, t) {\n return (t ? /^[\\x00-\\xFF]*$/ : /^[\\x00-\\x7F]*$/).test(e);\n }\n a(Ce, "isASCII");\n function W(e, t = false) {\n let r = [], n = 0;\n for (;n < e.length; ) {\n let o = e[n], l = a(function(f) {\n if (!t)\n throw new TypeError(f);\n r.push({ type: "INVALID_CHAR", index: n, value: e[n++] });\n }, "ErrorOrInvalid");\n if (o === "*") {\n r.push({ type: "ASTERISK", index: n, value: e[n++] });\n continue;\n }\n if (o === "+" || o === "?") {\n r.push({ type: "OTHER_MODIFIER", index: n, value: e[n++] });\n continue;\n }\n if (o === "\\\\") {\n r.push({ type: "ESCAPED_CHAR", index: n++, value: e[n++] });\n continue;\n }\n if (o === "{") {\n r.push({ type: "OPEN", index: n, value: e[n++] });\n continue;\n }\n if (o === "}") {\n r.push({ type: "CLOSE", index: n, value: e[n++] });\n continue;\n }\n if (o === ":") {\n let f = "", s = n + 1;\n for (;s < e.length; ) {\n let i = e.substr(s, 1);\n if (s === n + 1 && ye.test(i) || s !== n + 1 && we.test(i)) {\n f += e[s++];\n continue;\n }\n break;\n }\n if (!f) {\n l(`Missing parameter name at ${n}`);\n continue;\n }\n r.push({ type: "NAME", index: n, value: f }), n = s;\n continue;\n }\n if (o === "(") {\n let f = 1, s = "", i = n + 1, c = false;\n if (e[i] === "?") {\n l(`Pattern cannot start with "?" at ${i}`);\n continue;\n }\n for (;i < e.length; ) {\n if (!Ce(e[i], false)) {\n l(`Invalid character \'${e[i]}\' at ${i}.`), c = true;\n break;\n }\n if (e[i] === "\\\\") {\n s += e[i++] + e[i++];\n continue;\n }\n if (e[i] === ")") {\n if (f--, f === 0) {\n i++;\n break;\n }\n } else if (e[i] === "(" && (f++, e[i + 1] !== "?")) {\n l(`Capturing groups are not allowed at ${i}`), c = true;\n break;\n }\n s += e[i++];\n }\n if (c)\n continue;\n if (f) {\n l(`Unbalanced pattern at ${n}`);\n continue;\n }\n if (!s) {\n l(`Missing pattern at ${n}`);\n continue;\n }\n r.push({ type: "REGEX", index: n, value: s }), n = i;\n continue;\n }\n r.push({ type: "CHAR", index: n, value: e[n++] });\n }\n return r.push({ type: "END", index: n, value: "" }), r;\n }\n a(W, "lexer");\n function _(e, t = {}) {\n let r = W(e);\n t.delimiter ??= "/#?", t.prefixes ??= "./";\n let n = `[^${x(t.delimiter)}]+?`, o = [], l = 0, f = 0, s = "", i = new Set, c = a((u) => {\n if (f < r.length && r[f].type === u)\n return r[f++].value;\n }, "tryConsume"), h = a(() => c("OTHER_MODIFIER") ?? c("ASTERISK"), "tryConsumeModifier"), p = a((u) => {\n let d = c(u);\n if (d !== undefined)\n return d;\n let { type: g, index: y } = r[f];\n throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`);\n }, "mustConsume"), A = a(() => {\n let u = "", d;\n for (;d = c("CHAR") ?? c("ESCAPED_CHAR"); )\n u += d;\n return u;\n }, "consumeText"), be = a((u) => u, "DefaultEncodePart"), N = t.encodePart || be, H = "", v = a((u) => {\n H += u;\n }, "appendToPendingFixedValue"), D = a(() => {\n H.length && (o.push(new P(3, "", "", N(H), "", 3)), H = "");\n }, "maybeAddPartFromPendingFixedValue"), Z = a((u, d, g, y, B) => {\n let m = 3;\n switch (B) {\n case "?":\n m = 1;\n break;\n case "*":\n m = 0;\n break;\n case "+":\n m = 2;\n break;\n }\n if (!d && !g && m === 3) {\n v(u);\n return;\n }\n if (D(), !d && !g) {\n if (!u)\n return;\n o.push(new P(3, "", "", N(u), "", m));\n return;\n }\n let S;\n g ? g === "*" ? S = F : S = g : S = n;\n let k = 2;\n S === n ? (k = 1, S = "") : S === F && (k = 0, S = "");\n let E;\n if (d ? E = d : g && (E = l++), i.has(E))\n throw new TypeError(`Duplicate name \'${E}\'.`);\n i.add(E), o.push(new P(k, E, N(u), S, N(y), m));\n }, "addPart");\n for (;f < r.length; ) {\n let u = c("CHAR"), d = c("NAME"), g = c("REGEX");\n if (!d && !g && (g = c("ASTERISK")), d || g) {\n let m = u ?? "";\n t.prefixes.indexOf(m) === -1 && (v(m), m = ""), D();\n let S = h();\n Z(m, d, g, "", S);\n continue;\n }\n let y = u ?? c("ESCAPED_CHAR");\n if (y) {\n v(y);\n continue;\n }\n if (c("OPEN")) {\n let m = A(), S = c("NAME"), k = c("REGEX");\n !S && !k && (k = c("ASTERISK"));\n let E = A();\n p("CLOSE");\n let Pe = h();\n Z(m, S, k, E, Pe);\n continue;\n }\n D(), p("END");\n }\n return o;\n }\n a(_, "parse");\n function x(e) {\n return e.replace(/([.+*?^${}()[\\]|/\\\\])/g, "\\\\$1");\n }\n a(x, "escapeString");\n function q(e) {\n return e && e.ignoreCase ? "ui" : "u";\n }\n a(q, "flags");\n function J(e, t, r) {\n return z(_(e, r), t, r);\n }\n a(J, "stringToRegexp");\n function T(e) {\n switch (e) {\n case 0:\n return "*";\n case 1:\n return "?";\n case 2:\n return "+";\n case 3:\n return "";\n }\n }\n a(T, "modifierToString");\n function z(e, t, r = {}) {\n r.delimiter ??= "/#?", r.prefixes ??= "./", r.sensitive ??= false, r.strict ??= false, r.end ??= true, r.start ??= true, r.endsWith = "";\n let n = r.start ? "^" : "";\n for (let s of e) {\n if (s.type === 3) {\n s.modifier === 3 ? n += x(s.value) : n += `(?:${x(s.value)})${T(s.modifier)}`;\n continue;\n }\n t && t.push(s.name);\n let i = `[^${x(r.delimiter)}]+?`, c = s.value;\n if (s.type === 1 ? c = i : s.type === 0 && (c = F), !s.prefix.length && !s.suffix.length) {\n s.modifier === 3 || s.modifier === 1 ? n += `(${c})${T(s.modifier)}` : n += `((?:${c})${T(s.modifier)})`;\n continue;\n }\n if (s.modifier === 3 || s.modifier === 1) {\n n += `(?:${x(s.prefix)}(${c})${x(s.suffix)})`, n += T(s.modifier);\n continue;\n }\n n += `(?:${x(s.prefix)}`, n += `((?:${c})(?:`, n += x(s.suffix), n += x(s.prefix), n += `(?:${c}))*)${x(s.suffix)})`, s.modifier === 0 && (n += "?");\n }\n let o = `[${x(r.endsWith)}]|$`, l = `[${x(r.delimiter)}]`;\n if (r.end)\n return r.strict || (n += `${l}?`), r.endsWith.length ? n += `(?=${o})` : n += "$", new RegExp(n, q(r));\n r.strict || (n += `(?:${l}(?=${o}))?`);\n let f = false;\n if (e.length) {\n let s = e[e.length - 1];\n s.type === 3 && s.modifier === 3 && (f = r.delimiter.indexOf(s) > -1);\n }\n return f || (n += `(?=${l}|${o})`), new RegExp(n, q(r));\n }\n a(z, "partsToRegexp");\n var b = { delimiter: "", prefixes: "", sensitive: true, strict: true };\n var Q = { delimiter: ".", prefixes: "", sensitive: true, strict: true };\n var ee = { delimiter: "/", prefixes: "/", sensitive: true, strict: true };\n function te(e, t) {\n return e.length ? e[0] === "/" ? true : !t || e.length < 2 ? false : (e[0] == "\\\\" || e[0] == "{") && e[1] == "/" : false;\n }\n a(te, "isAbsolutePathname");\n function re(e, t) {\n return e.startsWith(t) ? e.substring(t.length, e.length) : e;\n }\n a(re, "maybeStripPrefix");\n function Le(e, t) {\n return e.endsWith(t) ? e.substr(0, e.length - t.length) : e;\n }\n a(Le, "maybeStripSuffix");\n function j(e) {\n return !e || e.length < 2 ? false : e[0] === "[" || (e[0] === "\\\\" || e[0] === "{") && e[1] === "[";\n }\n a(j, "treatAsIPv6Hostname");\n var ne = ["ftp", "file", "http", "https", "ws", "wss"];\n function $(e) {\n if (!e)\n return true;\n for (let t of ne)\n if (e.test(t))\n return true;\n return false;\n }\n a($, "isSpecialScheme");\n function se(e, t) {\n if (e = re(e, "#"), t || e === "")\n return e;\n let r = new URL("https://example.com");\n return r.hash = e, r.hash ? r.hash.substring(1, r.hash.length) : "";\n }\n a(se, "canonicalizeHash");\n function ie(e, t) {\n if (e = re(e, "?"), t || e === "")\n return e;\n let r = new URL("https://example.com");\n return r.search = e, r.search ? r.search.substring(1, r.search.length) : "";\n }\n a(ie, "canonicalizeSearch");\n function ae(e, t) {\n return t || e === "" ? e : j(e) ? V(e) : G(e);\n }\n a(ae, "canonicalizeHostname");\n function oe(e, t) {\n if (t || e === "")\n return e;\n let r = new URL("https://example.com");\n return r.password = e, r.password;\n }\n a(oe, "canonicalizePassword");\n function ce(e, t) {\n if (t || e === "")\n return e;\n let r = new URL("https://example.com");\n return r.username = e, r.username;\n }\n a(ce, "canonicalizeUsername");\n function le(e, t, r) {\n if (r || e === "")\n return e;\n if (t && !ne.includes(t))\n return new URL(`${t}:${e}`).pathname;\n let n = e[0] == "/";\n return e = new URL(n ? e : "/-" + e, "https://example.com").pathname, n || (e = e.substring(2, e.length)), e;\n }\n a(le, "canonicalizePathname");\n function fe(e, t, r) {\n return K(t) === e && (e = ""), r || e === "" ? e : Y(e);\n }\n a(fe, "canonicalizePort");\n function he(e, t) {\n return e = Le(e, ":"), t || e === "" ? e : w(e);\n }\n a(he, "canonicalizeProtocol");\n function K(e) {\n switch (e) {\n case "ws":\n case "http":\n return "80";\n case "wws":\n case "https":\n return "443";\n case "ftp":\n return "21";\n default:\n return "";\n }\n }\n a(K, "defaultPortForProtocol");\n function w(e) {\n if (e === "")\n return e;\n if (/^[-+.A-Za-z0-9]*$/.test(e))\n return e.toLowerCase();\n throw new TypeError(`Invalid protocol \'${e}\'.`);\n }\n a(w, "protocolEncodeCallback");\n function ue(e) {\n if (e === "")\n return e;\n let t = new URL("https://example.com");\n return t.username = e, t.username;\n }\n a(ue, "usernameEncodeCallback");\n function de(e) {\n if (e === "")\n return e;\n let t = new URL("https://example.com");\n return t.password = e, t.password;\n }\n a(de, "passwordEncodeCallback");\n function G(e) {\n if (e === "")\n return e;\n if (/[\\t\\n\\r #%/:<>?@[\\]^\\\\|]/g.test(e))\n throw new TypeError(`Invalid hostname \'${e}\'`);\n let t = new URL("https://example.com");\n return t.hostname = e, t.hostname;\n }\n a(G, "hostnameEncodeCallback");\n function V(e) {\n if (e === "")\n return e;\n if (/[^0-9a-fA-F[\\]:]/g.test(e))\n throw new TypeError(`Invalid IPv6 hostname \'${e}\'`);\n return e.toLowerCase();\n }\n a(V, "ipv6HostnameEncodeCallback");\n function Y(e) {\n if (e === "" || /^[0-9]*$/.test(e) && parseInt(e) <= 65535)\n return e;\n throw new TypeError(`Invalid port \'${e}\'.`);\n }\n a(Y, "portEncodeCallback");\n function pe(e) {\n if (e === "")\n return e;\n let t = new URL("https://example.com");\n return t.pathname = e[0] !== "/" ? "/-" + e : e, e[0] !== "/" ? t.pathname.substring(2, t.pathname.length) : t.pathname;\n }\n a(pe, "standardURLPathnameEncodeCallback");\n function ge(e) {\n return e === "" ? e : new URL(`data:${e}`).pathname;\n }\n a(ge, "pathURLPathnameEncodeCallback");\n function me(e) {\n if (e === "")\n return e;\n let t = new URL("https://example.com");\n return t.search = e, t.search.substring(1, t.search.length);\n }\n a(me, "searchEncodeCallback");\n function Se(e) {\n if (e === "")\n return e;\n let t = new URL("https://example.com");\n return t.hash = e, t.hash.substring(1, t.hash.length);\n }\n a(Se, "hashEncodeCallback");\n var C = class {\n #i;\n #n = [];\n #t = {};\n #e = 0;\n #s = 1;\n #l = 0;\n #o = 0;\n #d = 0;\n #p = 0;\n #g = false;\n constructor(t) {\n this.#i = t;\n }\n get result() {\n return this.#t;\n }\n parse() {\n for (this.#n = W(this.#i, true);this.#e < this.#n.length; this.#e += this.#s) {\n if (this.#s = 1, this.#n[this.#e].type === "END") {\n if (this.#o === 0) {\n this.#b(), this.#f() ? this.#r(9, 1) : this.#h() ? this.#r(8, 1) : this.#r(7, 0);\n continue;\n } else if (this.#o === 2) {\n this.#u(5);\n continue;\n }\n this.#r(10, 0);\n break;\n }\n if (this.#d > 0)\n if (this.#A())\n this.#d -= 1;\n else\n continue;\n if (this.#T()) {\n this.#d += 1;\n continue;\n }\n switch (this.#o) {\n case 0:\n this.#P() && this.#u(1);\n break;\n case 1:\n if (this.#P()) {\n this.#C();\n let t = 7, r = 1;\n this.#E() ? (t = 2, r = 3) : this.#g && (t = 2), this.#r(t, r);\n }\n break;\n case 2:\n this.#S() ? this.#u(3) : (this.#x() || this.#h() || this.#f()) && this.#u(5);\n break;\n case 3:\n this.#O() ? this.#r(4, 1) : this.#S() && this.#r(5, 1);\n break;\n case 4:\n this.#S() && this.#r(5, 1);\n break;\n case 5:\n this.#y() ? this.#p += 1 : this.#w() && (this.#p -= 1), this.#k() && !this.#p ? this.#r(6, 1) : this.#x() ? this.#r(7, 0) : this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);\n break;\n case 6:\n this.#x() ? this.#r(7, 0) : this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);\n break;\n case 7:\n this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);\n break;\n case 8:\n this.#f() && this.#r(9, 1);\n break;\n case 9:\n break;\n case 10:\n break;\n }\n }\n this.#t.hostname !== undefined && this.#t.port === undefined && (this.#t.port = "");\n }\n #r(t, r) {\n switch (this.#o) {\n case 0:\n break;\n case 1:\n this.#t.protocol = this.#c();\n break;\n case 2:\n break;\n case 3:\n this.#t.username = this.#c();\n break;\n case 4:\n this.#t.password = this.#c();\n break;\n case 5:\n this.#t.hostname = this.#c();\n break;\n case 6:\n this.#t.port = this.#c();\n break;\n case 7:\n this.#t.pathname = this.#c();\n break;\n case 8:\n this.#t.search = this.#c();\n break;\n case 9:\n this.#t.hash = this.#c();\n break;\n case 10:\n break;\n }\n this.#o !== 0 && t !== 10 && ([1, 2, 3, 4].includes(this.#o) && [6, 7, 8, 9].includes(t) && (this.#t.hostname ??= ""), [1, 2, 3, 4, 5, 6].includes(this.#o) && [8, 9].includes(t) && (this.#t.pathname ??= this.#g ? "/" : ""), [1, 2, 3, 4, 5, 6, 7].includes(this.#o) && t === 9 && (this.#t.search ??= "")), this.#R(t, r);\n }\n #R(t, r) {\n this.#o = t, this.#l = this.#e + r, this.#e += r, this.#s = 0;\n }\n #b() {\n this.#e = this.#l, this.#s = 0;\n }\n #u(t) {\n this.#b(), this.#o = t;\n }\n #m(t) {\n return t < 0 && (t = this.#n.length - t), t < this.#n.length ? this.#n[t] : this.#n[this.#n.length - 1];\n }\n #a(t, r) {\n let n = this.#m(t);\n return n.value === r && (n.type === "CHAR" || n.type === "ESCAPED_CHAR" || n.type === "INVALID_CHAR");\n }\n #P() {\n return this.#a(this.#e, ":");\n }\n #E() {\n return this.#a(this.#e + 1, "/") && this.#a(this.#e + 2, "/");\n }\n #S() {\n return this.#a(this.#e, "@");\n }\n #O() {\n return this.#a(this.#e, ":");\n }\n #k() {\n return this.#a(this.#e, ":");\n }\n #x() {\n return this.#a(this.#e, "/");\n }\n #h() {\n if (this.#a(this.#e, "?"))\n return true;\n if (this.#n[this.#e].value !== "?")\n return false;\n let t = this.#m(this.#e - 1);\n return t.type !== "NAME" && t.type !== "REGEX" && t.type !== "CLOSE" && t.type !== "ASTERISK";\n }\n #f() {\n return this.#a(this.#e, "#");\n }\n #T() {\n return this.#n[this.#e].type == "OPEN";\n }\n #A() {\n return this.#n[this.#e].type == "CLOSE";\n }\n #y() {\n return this.#a(this.#e, "[");\n }\n #w() {\n return this.#a(this.#e, "]");\n }\n #c() {\n let t = this.#n[this.#e], r = this.#m(this.#l).index;\n return this.#i.substring(r, t.index);\n }\n #C() {\n let t = {};\n Object.assign(t, b), t.encodePart = w;\n let r = J(this.#c(), undefined, t);\n this.#g = $(r);\n }\n };\n a(C, "Parser");\n var X = ["protocol", "username", "password", "hostname", "port", "pathname", "search", "hash"];\n var O = "*";\n function xe(e, t) {\n if (typeof e != "string")\n throw new TypeError("parameter 1 is not of type \'string\'.");\n let r = new URL(e, t);\n return { protocol: r.protocol.substring(0, r.protocol.length - 1), username: r.username, password: r.password, hostname: r.hostname, port: r.port, pathname: r.pathname, search: r.search !== "" ? r.search.substring(1, r.search.length) : undefined, hash: r.hash !== "" ? r.hash.substring(1, r.hash.length) : undefined };\n }\n a(xe, "extractValues");\n function R(e, t) {\n return t ? I(e) : e;\n }\n a(R, "processBaseURLString");\n function L(e, t, r) {\n let n;\n if (typeof t.baseURL == "string")\n try {\n n = new URL(t.baseURL), t.protocol === undefined && (e.protocol = R(n.protocol.substring(0, n.protocol.length - 1), r)), !r && t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.username === undefined && (e.username = R(n.username, r)), !r && t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.username === undefined && t.password === undefined && (e.password = R(n.password, r)), t.protocol === undefined && t.hostname === undefined && (e.hostname = R(n.hostname, r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && (e.port = R(n.port, r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.pathname === undefined && (e.pathname = R(n.pathname, r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.pathname === undefined && t.search === undefined && (e.search = R(n.search.substring(1, n.search.length), r)), t.protocol === undefined && t.hostname === undefined && t.port === undefined && t.pathname === undefined && t.search === undefined && t.hash === undefined && (e.hash = R(n.hash.substring(1, n.hash.length), r));\n } catch {\n throw new TypeError(`invalid baseURL \'${t.baseURL}\'.`);\n }\n if (typeof t.protocol == "string" && (e.protocol = he(t.protocol, r)), typeof t.username == "string" && (e.username = ce(t.username, r)), typeof t.password == "string" && (e.password = oe(t.password, r)), typeof t.hostname == "string" && (e.hostname = ae(t.hostname, r)), typeof t.port == "string" && (e.port = fe(t.port, e.protocol, r)), typeof t.pathname == "string") {\n if (e.pathname = t.pathname, n && !te(e.pathname, r)) {\n let o = n.pathname.lastIndexOf("/");\n o >= 0 && (e.pathname = R(n.pathname.substring(0, o + 1), r) + e.pathname);\n }\n e.pathname = le(e.pathname, e.protocol, r);\n }\n return typeof t.search == "string" && (e.search = ie(t.search, r)), typeof t.hash == "string" && (e.hash = se(t.hash, r)), e;\n }\n a(L, "applyInit");\n function I(e) {\n return e.replace(/([+*?:{}()\\\\])/g, "\\\\$1");\n }\n a(I, "escapePatternString");\n function Ie(e) {\n return e.replace(/([.+*?^${}()[\\]|/\\\\])/g, "\\\\$1");\n }\n a(Ie, "escapeRegexpString");\n function Ne(e, t) {\n t.delimiter ??= "/#?", t.prefixes ??= "./", t.sensitive ??= false, t.strict ??= false, t.end ??= true, t.start ??= true, t.endsWith = "";\n let r = ".*", n = `[^${Ie(t.delimiter)}]+?`, o = /[$_\\u200C\\u200D\\p{ID_Continue}]/u, l = "";\n for (let f = 0;f < e.length; ++f) {\n let s = e[f];\n if (s.type === 3) {\n if (s.modifier === 3) {\n l += I(s.value);\n continue;\n }\n l += `{${I(s.value)}}${T(s.modifier)}`;\n continue;\n }\n let i = s.hasCustomName(), c = !!s.suffix.length || !!s.prefix.length && (s.prefix.length !== 1 || !t.prefixes.includes(s.prefix)), h = f > 0 ? e[f - 1] : null, p = f < e.length - 1 ? e[f + 1] : null;\n if (!c && i && s.type === 1 && s.modifier === 3 && p && !p.prefix.length && !p.suffix.length)\n if (p.type === 3) {\n let A = p.value.length > 0 ? p.value[0] : "";\n c = o.test(A);\n } else\n c = !p.hasCustomName();\n if (!c && !s.prefix.length && h && h.type === 3) {\n let A = h.value[h.value.length - 1];\n c = t.prefixes.includes(A);\n }\n c && (l += "{"), l += I(s.prefix), i && (l += `:${s.name}`), s.type === 2 ? l += `(${s.value})` : s.type === 1 ? i || (l += `(${n})`) : s.type === 0 && (!i && (!h || h.type === 3 || h.modifier !== 3 || c || s.prefix !== "") ? l += "*" : l += `(${r})`), s.type === 1 && i && s.suffix.length && o.test(s.suffix[0]) && (l += "\\\\"), l += I(s.suffix), c && (l += "}"), s.modifier !== 3 && (l += T(s.modifier));\n }\n return l;\n }\n a(Ne, "partsToPattern");\n var M = class {\n #i;\n #n = {};\n #t = {};\n #e = {};\n #s = {};\n #l = false;\n constructor(t = {}, r, n) {\n try {\n let o;\n if (typeof r == "string" ? o = r : n = r, typeof t == "string") {\n let i = new C(t);\n if (i.parse(), t = i.result, o === undefined && typeof t.protocol != "string")\n throw new TypeError("A base URL must be provided for a relative constructor string.");\n t.baseURL = o;\n } else {\n if (!t || typeof t != "object")\n throw new TypeError("parameter 1 is not of type \'string\' and cannot convert to dictionary.");\n if (o)\n throw new TypeError("parameter 1 is not of type \'string\'.");\n }\n typeof n > "u" && (n = { ignoreCase: false });\n let l = { ignoreCase: n.ignoreCase === true }, f = { pathname: O, protocol: O, username: O, password: O, hostname: O, port: O, search: O, hash: O };\n this.#i = L(f, t, true), K(this.#i.protocol) === this.#i.port && (this.#i.port = "");\n let s;\n for (s of X) {\n if (!(s in this.#i))\n continue;\n let i = {}, c = this.#i[s];\n switch (this.#t[s] = [], s) {\n case "protocol":\n Object.assign(i, b), i.encodePart = w;\n break;\n case "username":\n Object.assign(i, b), i.encodePart = ue;\n break;\n case "password":\n Object.assign(i, b), i.encodePart = de;\n break;\n case "hostname":\n Object.assign(i, Q), j(c) ? i.encodePart = V : i.encodePart = G;\n break;\n case "port":\n Object.assign(i, b), i.encodePart = Y;\n break;\n case "pathname":\n $(this.#n.protocol) ? (Object.assign(i, ee, l), i.encodePart = pe) : (Object.assign(i, b, l), i.encodePart = ge);\n break;\n case "search":\n Object.assign(i, b, l), i.encodePart = me;\n break;\n case "hash":\n Object.assign(i, b, l), i.encodePart = Se;\n break;\n }\n try {\n this.#s[s] = _(c, i), this.#n[s] = z(this.#s[s], this.#t[s], i), this.#e[s] = Ne(this.#s[s], i), this.#l = this.#l || this.#s[s].some((h) => h.type === 2);\n } catch {\n throw new TypeError(`invalid ${s} pattern \'${this.#i[s]}\'.`);\n }\n }\n } catch (o) {\n throw new TypeError(`Failed to construct \'URLPattern\': ${o.message}`);\n }\n }\n get [Symbol.toStringTag]() {\n return "URLPattern";\n }\n test(t = {}, r) {\n let n = { pathname: "", protocol: "", username: "", password: "", hostname: "", port: "", search: "", hash: "" };\n if (typeof t != "string" && r)\n throw new TypeError("parameter 1 is not of type \'string\'.");\n if (typeof t > "u")\n return false;\n try {\n typeof t == "object" ? n = L(n, t, false) : n = L(n, xe(t, r), false);\n } catch {\n return false;\n }\n let o;\n for (o of X)\n if (!this.#n[o].exec(n[o]))\n return false;\n return true;\n }\n exec(t = {}, r) {\n let n = { pathname: "", protocol: "", username: "", password: "", hostname: "", port: "", search: "", hash: "" };\n if (typeof t != "string" && r)\n throw new TypeError("parameter 1 is not of type \'string\'.");\n if (typeof t > "u")\n return;\n try {\n typeof t == "object" ? n = L(n, t, false) : n = L(n, xe(t, r), false);\n } catch {\n return null;\n }\n let o = {};\n r ? o.inputs = [t, r] : o.inputs = [t];\n let l;\n for (l of X) {\n let f = this.#n[l].exec(n[l]);\n if (!f)\n return null;\n let s = {};\n for (let [i, c] of this.#t[l].entries())\n if (typeof c == "string" || typeof c == "number") {\n let h = f[i + 1];\n s[c] = h;\n }\n o[l] = { input: n[l] ?? "", groups: s };\n }\n return o;\n }\n static compareComponent(t, r, n) {\n let o = a((i, c) => {\n for (let h of ["type", "modifier", "prefix", "value", "suffix"]) {\n if (i[h] < c[h])\n return -1;\n if (i[h] === c[h])\n continue;\n return 1;\n }\n return 0;\n }, "comparePart"), l = new P(3, "", "", "", "", 3), f = new P(0, "", "", "", "", 3), s = a((i, c) => {\n let h = 0;\n for (;h < Math.min(i.length, c.length); ++h) {\n let p = o(i[h], c[h]);\n if (p)\n return p;\n }\n return i.length === c.length ? 0 : o(i[h] ?? l, c[h] ?? l);\n }, "comparePartList");\n return !r.#e[t] && !n.#e[t] ? 0 : r.#e[t] && !n.#e[t] ? s(r.#s[t], [f]) : !r.#e[t] && n.#e[t] ? s([f], n.#s[t]) : s(r.#s[t], n.#s[t]);\n }\n get protocol() {\n return this.#e.protocol;\n }\n get username() {\n return this.#e.username;\n }\n get password() {\n return this.#e.password;\n }\n get hostname() {\n return this.#e.hostname;\n }\n get port() {\n return this.#e.port;\n }\n get pathname() {\n return this.#e.pathname;\n }\n get search() {\n return this.#e.search;\n }\n get hash() {\n return this.#e.hash;\n }\n get hasRegExpGroups() {\n return this.#l;\n }\n };\n a(M, "URLPattern");\n});\n\n// ../../node_modules/urlpattern-polyfill/index.cjs\nvar require_urlpattern_polyfill = __commonJS((exports, module) => {\n var { URLPattern } = require_urlpattern();\n module.exports = { URLPattern };\n if (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n }\n});\n\n// ../../node_modules/@whatwg-node/promise-helpers/cjs/index.js\nvar require_cjs = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.isPromise = isPromise2;\n exports.isActualPromise = isActualPromise2;\n exports.handleMaybePromise = handleMaybePromise2;\n exports.fakePromise = fakePromise2;\n exports.createDeferredPromise = createDeferredPromise2;\n exports.iterateAsync = iterateAsync2;\n exports.iterateAsyncVoid = iterateAsync2;\n exports.fakeRejectPromise = fakeRejectPromise2;\n exports.mapMaybePromise = mapMaybePromise;\n exports.mapAsyncIterator = mapAsyncIterator;\n exports.promiseLikeFinally = promiseLikeFinally2;\n exports.unfakePromise = unfakePromise2;\n var kFakePromise2 = Symbol.for("@whatwg-node/promise-helpers/FakePromise");\n function isPromise2(value) {\n return value?.then != null;\n }\n function isActualPromise2(value) {\n const maybePromise = value;\n return maybePromise && maybePromise.then && maybePromise.catch && maybePromise.finally;\n }\n function handleMaybePromise2(inputFactory, outputSuccessFactory, outputErrorFactory, finallyFactory) {\n let result$ = fakePromise2().then(inputFactory).then(outputSuccessFactory, outputErrorFactory);\n if (finallyFactory) {\n result$ = result$.finally(finallyFactory);\n }\n return unfakePromise2(result$);\n }\n function fakePromise2(value) {\n if (value && isActualPromise2(value)) {\n return value;\n }\n if (isPromise2(value)) {\n return {\n then: (resolve, reject) => fakePromise2(value.then(resolve, reject)),\n catch: (reject) => fakePromise2(value.then((res) => res, reject)),\n finally: (cb) => fakePromise2(cb ? promiseLikeFinally2(value, cb) : value),\n [Symbol.toStringTag]: "Promise"\n };\n }\n return {\n then(resolve) {\n if (resolve) {\n try {\n return fakePromise2(resolve(value));\n } catch (err) {\n return fakeRejectPromise2(err);\n }\n }\n return this;\n },\n catch() {\n return this;\n },\n finally(cb) {\n if (cb) {\n try {\n return fakePromise2(cb()).then(() => value, () => value);\n } catch (err) {\n return fakeRejectPromise2(err);\n }\n }\n return this;\n },\n [Symbol.toStringTag]: "Promise",\n __fakePromiseValue: value,\n [kFakePromise2]: "resolved"\n };\n }\n function createDeferredPromise2() {\n if (Promise.withResolvers) {\n return Promise.withResolvers();\n }\n let resolveFn;\n let rejectFn;\n const promise = new Promise(function deferredPromiseExecutor(resolve, reject) {\n resolveFn = resolve;\n rejectFn = reject;\n });\n return {\n promise,\n get resolve() {\n return resolveFn;\n },\n get reject() {\n return rejectFn;\n }\n };\n }\n function iterateAsync2(iterable, callback, results) {\n if (iterable?.length === 0) {\n return;\n }\n const iterator = iterable[Symbol.iterator]();\n let index = 0;\n function iterate() {\n const { done: endOfIterator, value } = iterator.next();\n if (endOfIterator) {\n return;\n }\n let endedEarly = false;\n function endEarly() {\n endedEarly = true;\n }\n return handleMaybePromise2(function handleCallback() {\n return callback(value, endEarly, index++);\n }, function handleCallbackResult(result) {\n if (result) {\n results?.push(result);\n }\n if (endedEarly) {\n return;\n }\n return iterate();\n });\n }\n return iterate();\n }\n function fakeRejectPromise2(error) {\n return {\n then(_resolve, reject) {\n if (reject) {\n try {\n return fakePromise2(reject(error));\n } catch (err) {\n return fakeRejectPromise2(err);\n }\n }\n return this;\n },\n catch(reject) {\n if (reject) {\n try {\n return fakePromise2(reject(error));\n } catch (err) {\n return fakeRejectPromise2(err);\n }\n }\n return this;\n },\n finally(cb) {\n if (cb) {\n try {\n cb();\n } catch (err) {\n return fakeRejectPromise2(err);\n }\n }\n return this;\n },\n __fakeRejectError: error,\n [Symbol.toStringTag]: "Promise",\n [kFakePromise2]: "rejected"\n };\n }\n function mapMaybePromise(input, onSuccess, onError) {\n return handleMaybePromise2(() => input, onSuccess, onError);\n }\n function mapAsyncIterator(iterator, onNext, onError, onEnd) {\n if (Symbol.asyncIterator in iterator) {\n iterator = iterator[Symbol.asyncIterator]();\n }\n let $return;\n let abruptClose;\n let onEndWithValue;\n if (onEnd) {\n let onEndWithValueResult;\n onEndWithValue = (value) => {\n onEndWithValueResult ||= handleMaybePromise2(onEnd, () => value, () => value);\n return onEndWithValueResult;\n };\n }\n if (typeof iterator.return === "function") {\n $return = iterator.return;\n abruptClose = (error) => {\n const rethrow = () => {\n throw error;\n };\n return $return.call(iterator).then(rethrow, rethrow);\n };\n }\n function mapResult(result) {\n if (result.done) {\n return onEndWithValue ? onEndWithValue(result) : result;\n }\n return handleMaybePromise2(() => result.value, (value) => handleMaybePromise2(() => onNext(value), iteratorResult, abruptClose));\n }\n let mapReject;\n if (onError) {\n let onErrorResult;\n const reject = onError;\n mapReject = (error) => {\n onErrorResult ||= handleMaybePromise2(() => error, (error2) => handleMaybePromise2(() => reject(error2), iteratorResult, abruptClose));\n return onErrorResult;\n };\n }\n return {\n next() {\n return iterator.next().then(mapResult, mapReject);\n },\n return() {\n const res$ = $return ? $return.call(iterator).then(mapResult, mapReject) : fakePromise2({ value: undefined, done: true });\n return onEndWithValue ? res$.then(onEndWithValue) : res$;\n },\n throw(error) {\n if (typeof iterator.throw === "function") {\n return iterator.throw(error).then(mapResult, mapReject);\n }\n if (abruptClose) {\n return abruptClose(error);\n }\n return fakeRejectPromise2(error);\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n }\n function iteratorResult(value) {\n return { value, done: false };\n }\n function isFakePromise2(value) {\n return value?.[kFakePromise2] === "resolved";\n }\n function isFakeRejectPromise2(value) {\n return value?.[kFakePromise2] === "rejected";\n }\n function promiseLikeFinally2(value, onFinally) {\n if ("finally" in value) {\n return value.finally(onFinally);\n }\n return value.then((res) => {\n const finallyRes = onFinally();\n return isPromise2(finallyRes) ? finallyRes.then(() => res) : res;\n }, (err) => {\n const finallyRes = onFinally();\n if (isPromise2(finallyRes)) {\n return finallyRes.then(() => {\n throw err;\n });\n } else {\n throw err;\n }\n });\n }\n function unfakePromise2(promise) {\n if (isFakePromise2(promise)) {\n return promise.__fakePromiseValue;\n }\n if (isFakeRejectPromise2(promise)) {\n throw promise.__fakeRejectError;\n }\n return promise;\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js\nvar require_sbmh = __commonJS((exports, module) => {\n var { EventEmitter } = __require("node:events");\n var { inherits } = __require("node:util");\n function SBMH(needle) {\n if (typeof needle === "string") {\n needle = Buffer.from(needle);\n }\n if (!Buffer.isBuffer(needle)) {\n throw new TypeError("The needle has to be a String or a Buffer.");\n }\n const needleLength = needle.length;\n const needleLastCharIndex = needleLength - 1;\n if (needleLength === 0) {\n throw new Error("The needle cannot be an empty String/Buffer.");\n }\n if (needleLength > 256) {\n throw new Error("The needle cannot have a length bigger than 256.");\n }\n this.maxMatches = Infinity;\n this.matches = 0;\n this._occ = new Uint8Array(256).fill(needleLength);\n this._lookbehind_size = 0;\n this._needle = needle;\n this._bufpos = 0;\n this._lookbehind = Buffer.alloc(needleLastCharIndex);\n for (var i = 0;i < needleLastCharIndex; ++i) {\n this._occ[needle[i]] = needleLastCharIndex - i;\n }\n }\n inherits(SBMH, EventEmitter);\n SBMH.prototype.reset = function() {\n this._lookbehind_size = 0;\n this.matches = 0;\n this._bufpos = 0;\n };\n SBMH.prototype.push = function(chunk, pos) {\n if (!Buffer.isBuffer(chunk)) {\n chunk = Buffer.from(chunk, "binary");\n }\n const chlen = chunk.length;\n this._bufpos = pos || 0;\n let r;\n while (r !== chlen && this.matches < this.maxMatches) {\n r = this._sbmh_feed(chunk);\n }\n return r;\n };\n SBMH.prototype._sbmh_feed = function(data) {\n const len = data.length;\n const needle = this._needle;\n const needleLength = needle.length;\n const needleLastCharIndex = needleLength - 1;\n const needleLastChar = needle[needleLastCharIndex];\n let pos = -this._lookbehind_size;\n let ch;\n if (pos < 0) {\n while (pos < 0 && pos <= len - needleLength) {\n ch = data[pos + needleLastCharIndex];\n if (ch === needleLastChar && this._sbmh_memcmp(data, pos, needleLastCharIndex)) {\n this._lookbehind_size = 0;\n ++this.matches;\n this.emit("info", true);\n return this._bufpos = pos + needleLength;\n }\n pos += this._occ[ch];\n }\n while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) {\n ++pos;\n }\n if (pos >= 0) {\n this.emit("info", false, this._lookbehind, 0, this._lookbehind_size);\n this._lookbehind_size = 0;\n } else {\n const bytesToCutOff = this._lookbehind_size + pos;\n if (bytesToCutOff > 0) {\n this.emit("info", false, this._lookbehind, 0, bytesToCutOff);\n }\n this._lookbehind_size -= bytesToCutOff;\n this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff, this._lookbehind_size);\n data.copy(this._lookbehind, this._lookbehind_size);\n this._lookbehind_size += len;\n this._bufpos = len;\n return len;\n }\n }\n pos = data.indexOf(needle, pos + this._bufpos);\n if (pos !== -1) {\n ++this.matches;\n if (pos === 0) {\n this.emit("info", true);\n } else {\n this.emit("info", true, data, this._bufpos, pos);\n }\n return this._bufpos = pos + needleLength;\n }\n pos = len - needleLastCharIndex;\n if (pos < 0) {\n pos = 0;\n }\n while (pos !== len && (data[pos] !== needle[0] || Buffer.compare(data.subarray(pos + 1, len), needle.subarray(1, len - pos)) !== 0)) {\n ++pos;\n }\n if (pos !== len) {\n data.copy(this._lookbehind, 0, pos, len);\n this._lookbehind_size = len - pos;\n }\n if (pos !== 0) {\n this.emit("info", false, data, this._bufpos, pos);\n }\n this._bufpos = len;\n return len;\n };\n SBMH.prototype._sbmh_lookup_char = function(data, pos) {\n return pos < 0 ? this._lookbehind[this._lookbehind_size + pos] : data[pos];\n };\n SBMH.prototype._sbmh_memcmp = function(data, pos, len) {\n for (var i = 0;i < len; ++i) {\n if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) {\n return false;\n }\n }\n return true;\n };\n module.exports = SBMH;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js\nvar require_PartStream = __commonJS((exports, module) => {\n var inherits = __require("node:util").inherits;\n var ReadableStream2 = __require("node:stream").Readable;\n function PartStream(opts) {\n ReadableStream2.call(this, opts);\n }\n inherits(PartStream, ReadableStream2);\n PartStream.prototype._read = function(n) {};\n module.exports = PartStream;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/utils/getLimit.js\nvar require_getLimit = __commonJS((exports, module) => {\n module.exports = function getLimit(limits, name, defaultLimit) {\n if (!limits || limits[name] === undefined || limits[name] === null) {\n return defaultLimit;\n }\n if (typeof limits[name] !== "number" || isNaN(limits[name])) {\n throw new TypeError("Limit " + name + " is not a valid number");\n }\n return limits[name];\n };\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js\nvar require_HeaderParser = __commonJS((exports, module) => {\n var EventEmitter = __require("node:events").EventEmitter;\n var inherits = __require("node:util").inherits;\n var getLimit = require_getLimit();\n var StreamSearch = require_sbmh();\n var B_DCRLF = Buffer.from(`\\r\n\\r\n`);\n var RE_CRLF = /\\r\\n/g;\n var RE_HDR = /^([^:]+):[ \\t]?([\\x00-\\xFF]+)?$/;\n function HeaderParser(cfg) {\n EventEmitter.call(this);\n cfg = cfg || {};\n const self2 = this;\n this.nread = 0;\n this.maxed = false;\n this.npairs = 0;\n this.maxHeaderPairs = getLimit(cfg, "maxHeaderPairs", 2000);\n this.maxHeaderSize = getLimit(cfg, "maxHeaderSize", 80 * 1024);\n this.buffer = "";\n this.header = {};\n this.finished = false;\n this.ss = new StreamSearch(B_DCRLF);\n this.ss.on("info", function(isMatch, data, start, end) {\n if (data && !self2.maxed) {\n if (self2.nread + end - start >= self2.maxHeaderSize) {\n end = self2.maxHeaderSize - self2.nread + start;\n self2.nread = self2.maxHeaderSize;\n self2.maxed = true;\n } else {\n self2.nread += end - start;\n }\n self2.buffer += data.toString("binary", start, end);\n }\n if (isMatch) {\n self2._finish();\n }\n });\n }\n inherits(HeaderParser, EventEmitter);\n HeaderParser.prototype.push = function(data) {\n const r = this.ss.push(data);\n if (this.finished) {\n return r;\n }\n };\n HeaderParser.prototype.reset = function() {\n this.finished = false;\n this.buffer = "";\n this.header = {};\n this.ss.reset();\n };\n HeaderParser.prototype._finish = function() {\n if (this.buffer) {\n this._parseHeader();\n }\n this.ss.matches = this.ss.maxMatches;\n const header = this.header;\n this.header = {};\n this.buffer = "";\n this.finished = true;\n this.nread = this.npairs = 0;\n this.maxed = false;\n this.emit("header", header);\n };\n HeaderParser.prototype._parseHeader = function() {\n if (this.npairs === this.maxHeaderPairs) {\n return;\n }\n const lines = this.buffer.split(RE_CRLF);\n const len = lines.length;\n let m, h;\n for (var i = 0;i < len; ++i) {\n if (lines[i].length === 0) {\n continue;\n }\n if (lines[i][0] === "\\t" || lines[i][0] === " ") {\n if (h) {\n this.header[h][this.header[h].length - 1] += lines[i];\n continue;\n }\n }\n const posColon = lines[i].indexOf(":");\n if (posColon === -1 || posColon === 0) {\n return;\n }\n m = RE_HDR.exec(lines[i]);\n h = m[1].toLowerCase();\n this.header[h] = this.header[h] || [];\n this.header[h].push(m[2] || "");\n if (++this.npairs === this.maxHeaderPairs) {\n break;\n }\n }\n };\n module.exports = HeaderParser;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js\nvar require_Dicer = __commonJS((exports, module) => {\n var WritableStream2 = __require("node:stream").Writable;\n var inherits = __require("node:util").inherits;\n var StreamSearch = require_sbmh();\n var PartStream = require_PartStream();\n var HeaderParser = require_HeaderParser();\n var DASH = 45;\n var B_ONEDASH = Buffer.from("-");\n var B_CRLF = Buffer.from(`\\r\n`);\n var EMPTY_FN = function() {};\n function Dicer(cfg) {\n if (!(this instanceof Dicer)) {\n return new Dicer(cfg);\n }\n WritableStream2.call(this, cfg);\n if (!cfg || !cfg.headerFirst && typeof cfg.boundary !== "string") {\n throw new TypeError("Boundary required");\n }\n if (typeof cfg.boundary === "string") {\n this.setBoundary(cfg.boundary);\n } else {\n this._bparser = undefined;\n }\n this._headerFirst = cfg.headerFirst;\n this._dashes = 0;\n this._parts = 0;\n this._finished = false;\n this._realFinish = false;\n this._isPreamble = true;\n this._justMatched = false;\n this._firstWrite = true;\n this._inHeader = true;\n this._part = undefined;\n this._cb = undefined;\n this._ignoreData = false;\n this._partOpts = { highWaterMark: cfg.partHwm };\n this._pause = false;\n const self2 = this;\n this._hparser = new HeaderParser(cfg);\n this._hparser.on("header", function(header) {\n self2._inHeader = false;\n self2._part.emit("header", header);\n });\n }\n inherits(Dicer, WritableStream2);\n Dicer.prototype.emit = function(ev) {\n if (ev === "finish" && !this._realFinish) {\n if (!this._finished) {\n const self2 = this;\n process.nextTick(function() {\n self2.emit("error", new Error("Unexpected end of multipart data"));\n if (self2._part && !self2._ignoreData) {\n const type = self2._isPreamble ? "Preamble" : "Part";\n self2._part.emit("error", new Error(type + " terminated early due to unexpected end of multipart data"));\n self2._part.push(null);\n process.nextTick(function() {\n self2._realFinish = true;\n self2.emit("finish");\n self2._realFinish = false;\n });\n return;\n }\n self2._realFinish = true;\n self2.emit("finish");\n self2._realFinish = false;\n });\n }\n } else {\n WritableStream2.prototype.emit.apply(this, arguments);\n }\n };\n Dicer.prototype._write = function(data, encoding, cb) {\n if (!this._hparser && !this._bparser) {\n return cb();\n }\n if (this._headerFirst && this._isPreamble) {\n if (!this._part) {\n this._part = new PartStream(this._partOpts);\n if (this.listenerCount("preamble") !== 0) {\n this.emit("preamble", this._part);\n } else {\n this._ignore();\n }\n }\n const r = this._hparser.push(data);\n if (!this._inHeader && r !== undefined && r < data.length) {\n data = data.slice(r);\n } else {\n return cb();\n }\n }\n if (this._firstWrite) {\n this._bparser.push(B_CRLF);\n this._firstWrite = false;\n }\n this._bparser.push(data);\n if (this._pause) {\n this._cb = cb;\n } else {\n cb();\n }\n };\n Dicer.prototype.reset = function() {\n this._part = undefined;\n this._bparser = undefined;\n this._hparser = undefined;\n };\n Dicer.prototype.setBoundary = function(boundary) {\n const self2 = this;\n this._bparser = new StreamSearch(`\\r\n--` + boundary);\n this._bparser.on("info", function(isMatch, data, start, end) {\n self2._oninfo(isMatch, data, start, end);\n });\n };\n Dicer.prototype._ignore = function() {\n if (this._part && !this._ignoreData) {\n this._ignoreData = true;\n this._part.on("error", EMPTY_FN);\n this._part.resume();\n }\n };\n Dicer.prototype._oninfo = function(isMatch, data, start, end) {\n let buf;\n const self2 = this;\n let i = 0;\n let r;\n let shouldWriteMore = true;\n if (!this._part && this._justMatched && data) {\n while (this._dashes < 2 && start + i < end) {\n if (data[start + i] === DASH) {\n ++i;\n ++this._dashes;\n } else {\n if (this._dashes) {\n buf = B_ONEDASH;\n }\n this._dashes = 0;\n break;\n }\n }\n if (this._dashes === 2) {\n if (start + i < end && this.listenerCount("trailer") !== 0) {\n this.emit("trailer", data.slice(start + i, end));\n }\n this.reset();\n this._finished = true;\n if (self2._parts === 0) {\n self2._realFinish = true;\n self2.emit("finish");\n self2._realFinish = false;\n }\n }\n if (this._dashes) {\n return;\n }\n }\n if (this._justMatched) {\n this._justMatched = false;\n }\n if (!this._part) {\n this._part = new PartStream(this._partOpts);\n this._part._read = function(n) {\n self2._unpause();\n };\n if (this._isPreamble && this.listenerCount("preamble") !== 0) {\n this.emit("preamble", this._part);\n } else if (this._isPreamble !== true && this.listenerCount("part") !== 0) {\n this.emit("part", this._part);\n } else {\n this._ignore();\n }\n if (!this._isPreamble) {\n this._inHeader = true;\n }\n }\n if (data && start < end && !this._ignoreData) {\n if (this._isPreamble || !this._inHeader) {\n if (buf) {\n shouldWriteMore = this._part.push(buf);\n }\n shouldWriteMore = this._part.push(data.slice(start, end));\n if (!shouldWriteMore) {\n this._pause = true;\n }\n } else if (!this._isPreamble && this._inHeader) {\n if (buf) {\n this._hparser.push(buf);\n }\n r = this._hparser.push(data.slice(start, end));\n if (!this._inHeader && r !== undefined && r < end) {\n this._oninfo(false, data, start + r, end);\n }\n }\n }\n if (isMatch) {\n this._hparser.reset();\n if (this._isPreamble) {\n this._isPreamble = false;\n } else {\n if (start !== end) {\n ++this._parts;\n this._part.on("end", function() {\n if (--self2._parts === 0) {\n if (self2._finished) {\n self2._realFinish = true;\n self2.emit("finish");\n self2._realFinish = false;\n } else {\n self2._unpause();\n }\n }\n });\n }\n }\n this._part.push(null);\n this._part = undefined;\n this._ignoreData = false;\n this._justMatched = true;\n this._dashes = 0;\n }\n };\n Dicer.prototype._unpause = function() {\n if (!this._pause) {\n return;\n }\n this._pause = false;\n if (this._cb) {\n const cb = this._cb;\n this._cb = undefined;\n cb();\n }\n };\n module.exports = Dicer;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/utils/decodeText.js\nvar require_decodeText = __commonJS((exports, module) => {\n var utf8Decoder = new TextDecoder("utf-8");\n var textDecoders = new Map([\n ["utf-8", utf8Decoder],\n ["utf8", utf8Decoder]\n ]);\n function getDecoder(charset) {\n let lc;\n while (true) {\n switch (charset) {\n case "utf-8":\n case "utf8":\n return decoders.utf8;\n case "latin1":\n case "ascii":\n case "us-ascii":\n case "iso-8859-1":\n case "iso8859-1":\n case "iso88591":\n case "iso_8859-1":\n case "windows-1252":\n case "iso_8859-1:1987":\n case "cp1252":\n case "x-cp1252":\n return decoders.latin1;\n case "utf16le":\n case "utf-16le":\n case "ucs2":\n case "ucs-2":\n return decoders.utf16le;\n case "base64":\n return decoders.base64;\n default:\n if (lc === undefined) {\n lc = true;\n charset = charset.toLowerCase();\n continue;\n }\n return decoders.other.bind(charset);\n }\n }\n }\n var decoders = {\n utf8: (data, sourceEncoding) => {\n if (data.length === 0) {\n return "";\n }\n if (typeof data === "string") {\n data = Buffer.from(data, sourceEncoding);\n }\n return data.utf8Slice(0, data.length);\n },\n latin1: (data, sourceEncoding) => {\n if (data.length === 0) {\n return "";\n }\n if (typeof data === "string") {\n return data;\n }\n return data.latin1Slice(0, data.length);\n },\n utf16le: (data, sourceEncoding) => {\n if (data.length === 0) {\n return "";\n }\n if (typeof data === "string") {\n data = Buffer.from(data, sourceEncoding);\n }\n return data.ucs2Slice(0, data.length);\n },\n base64: (data, sourceEncoding) => {\n if (data.length === 0) {\n return "";\n }\n if (typeof data === "string") {\n data = Buffer.from(data, sourceEncoding);\n }\n return data.base64Slice(0, data.length);\n },\n other: (data, sourceEncoding) => {\n if (data.length === 0) {\n return "";\n }\n if (typeof data === "string") {\n data = Buffer.from(data, sourceEncoding);\n }\n if (textDecoders.has(exports.toString())) {\n try {\n return textDecoders.get(exports).decode(data);\n } catch {}\n }\n return typeof data === "string" ? data : data.toString();\n }\n };\n function decodeText(text, sourceEncoding, destEncoding) {\n if (text) {\n return getDecoder(destEncoding)(text, sourceEncoding);\n }\n return text;\n }\n module.exports = decodeText;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/utils/parseParams.js\nvar require_parseParams = __commonJS((exports, module) => {\n var decodeText = require_decodeText();\n var RE_ENCODED = /%[a-fA-F0-9][a-fA-F0-9]/g;\n var EncodedLookup = {\n "%00": "\\x00",\n "%01": "\\x01",\n "%02": "\\x02",\n "%03": "\\x03",\n "%04": "\\x04",\n "%05": "\\x05",\n "%06": "\\x06",\n "%07": "\\x07",\n "%08": "\\b",\n "%09": "\\t",\n "%0a": `\n`,\n "%0A": `\n`,\n "%0b": "\\v",\n "%0B": "\\v",\n "%0c": "\\f",\n "%0C": "\\f",\n "%0d": "\\r",\n "%0D": "\\r",\n "%0e": "\\x0E",\n "%0E": "\\x0E",\n "%0f": "\\x0F",\n "%0F": "\\x0F",\n "%10": "\\x10",\n "%11": "\\x11",\n "%12": "\\x12",\n "%13": "\\x13",\n "%14": "\\x14",\n "%15": "\\x15",\n "%16": "\\x16",\n "%17": "\\x17",\n "%18": "\\x18",\n "%19": "\\x19",\n "%1a": "\\x1A",\n "%1A": "\\x1A",\n "%1b": "\\x1B",\n "%1B": "\\x1B",\n "%1c": "\\x1C",\n "%1C": "\\x1C",\n "%1d": "\\x1D",\n "%1D": "\\x1D",\n "%1e": "\\x1E",\n "%1E": "\\x1E",\n "%1f": "\\x1F",\n "%1F": "\\x1F",\n "%20": " ",\n "%21": "!",\n "%22": \'"\',\n "%23": "#",\n "%24": "$",\n "%25": "%",\n "%26": "&",\n "%27": "\'",\n "%28": "(",\n "%29": ")",\n "%2a": "*",\n "%2A": "*",\n "%2b": "+",\n "%2B": "+",\n "%2c": ",",\n "%2C": ",",\n "%2d": "-",\n "%2D": "-",\n "%2e": ".",\n "%2E": ".",\n "%2f": "/",\n "%2F": "/",\n "%30": "0",\n "%31": "1",\n "%32": "2",\n "%33": "3",\n "%34": "4",\n "%35": "5",\n "%36": "6",\n "%37": "7",\n "%38": "8",\n "%39": "9",\n "%3a": ":",\n "%3A": ":",\n "%3b": ";",\n "%3B": ";",\n "%3c": "<",\n "%3C": "<",\n "%3d": "=",\n "%3D": "=",\n "%3e": ">",\n "%3E": ">",\n "%3f": "?",\n "%3F": "?",\n "%40": "@",\n "%41": "A",\n "%42": "B",\n "%43": "C",\n "%44": "D",\n "%45": "E",\n "%46": "F",\n "%47": "G",\n "%48": "H",\n "%49": "I",\n "%4a": "J",\n "%4A": "J",\n "%4b": "K",\n "%4B": "K",\n "%4c": "L",\n "%4C": "L",\n "%4d": "M",\n "%4D": "M",\n "%4e": "N",\n "%4E": "N",\n "%4f": "O",\n "%4F": "O",\n "%50": "P",\n "%51": "Q",\n "%52": "R",\n "%53": "S",\n "%54": "T",\n "%55": "U",\n "%56": "V",\n "%57": "W",\n "%58": "X",\n "%59": "Y",\n "%5a": "Z",\n "%5A": "Z",\n "%5b": "[",\n "%5B": "[",\n "%5c": "\\\\",\n "%5C": "\\\\",\n "%5d": "]",\n "%5D": "]",\n "%5e": "^",\n "%5E": "^",\n "%5f": "_",\n "%5F": "_",\n "%60": "`",\n "%61": "a",\n "%62": "b",\n "%63": "c",\n "%64": "d",\n "%65": "e",\n "%66": "f",\n "%67": "g",\n "%68": "h",\n "%69": "i",\n "%6a": "j",\n "%6A": "j",\n "%6b": "k",\n "%6B": "k",\n "%6c": "l",\n "%6C": "l",\n "%6d": "m",\n "%6D": "m",\n "%6e": "n",\n "%6E": "n",\n "%6f": "o",\n "%6F": "o",\n "%70": "p",\n "%71": "q",\n "%72": "r",\n "%73": "s",\n "%74": "t",\n "%75": "u",\n "%76": "v",\n "%77": "w",\n "%78": "x",\n "%79": "y",\n "%7a": "z",\n "%7A": "z",\n "%7b": "{",\n "%7B": "{",\n "%7c": "|",\n "%7C": "|",\n "%7d": "}",\n "%7D": "}",\n "%7e": "~",\n "%7E": "~",\n "%7f": "",\n "%7F": "",\n "%80": "€",\n "%81": "",\n "%82": "‚",\n "%83": "ƒ",\n "%84": "„",\n "%85": "…",\n "%86": "†",\n "%87": "‡",\n "%88": "ˆ",\n "%89": "‰",\n "%8a": "Š",\n "%8A": "Š",\n "%8b": "‹",\n "%8B": "‹",\n "%8c": "Œ",\n "%8C": "Œ",\n "%8d": "",\n "%8D": "",\n "%8e": "Ž",\n "%8E": "Ž",\n "%8f": "",\n "%8F": "",\n "%90": "",\n "%91": "‘",\n "%92": "’",\n "%93": "“",\n "%94": "”",\n "%95": "•",\n "%96": "–",\n "%97": "—",\n "%98": "˜",\n "%99": "™",\n "%9a": "š",\n "%9A": "š",\n "%9b": "›",\n "%9B": "›",\n "%9c": "œ",\n "%9C": "œ",\n "%9d": "",\n "%9D": "",\n "%9e": "ž",\n "%9E": "ž",\n "%9f": "Ÿ",\n "%9F": "Ÿ",\n "%a0": " ",\n "%A0": " ",\n "%a1": "¡",\n "%A1": "¡",\n "%a2": "¢",\n "%A2": "¢",\n "%a3": "£",\n "%A3": "£",\n "%a4": "¤",\n "%A4": "¤",\n "%a5": "¥",\n "%A5": "¥",\n "%a6": "¦",\n "%A6": "¦",\n "%a7": "§",\n "%A7": "§",\n "%a8": "¨",\n "%A8": "¨",\n "%a9": "©",\n "%A9": "©",\n "%aa": "ª",\n "%Aa": "ª",\n "%aA": "ª",\n "%AA": "ª",\n "%ab": "«",\n "%Ab": "«",\n "%aB": "«",\n "%AB": "«",\n "%ac": "¬",\n "%Ac": "¬",\n "%aC": "¬",\n "%AC": "¬",\n "%ad": "­",\n "%Ad": "­",\n "%aD": "­",\n "%AD": "­",\n "%ae": "®",\n "%Ae": "®",\n "%aE": "®",\n "%AE": "®",\n "%af": "¯",\n "%Af": "¯",\n "%aF": "¯",\n "%AF": "¯",\n "%b0": "°",\n "%B0": "°",\n "%b1": "±",\n "%B1": "±",\n "%b2": "²",\n "%B2": "²",\n "%b3": "³",\n "%B3": "³",\n "%b4": "´",\n "%B4": "´",\n "%b5": "µ",\n "%B5": "µ",\n "%b6": "¶",\n "%B6": "¶",\n "%b7": "·",\n "%B7": "·",\n "%b8": "¸",\n "%B8": "¸",\n "%b9": "¹",\n "%B9": "¹",\n "%ba": "º",\n "%Ba": "º",\n "%bA": "º",\n "%BA": "º",\n "%bb": "»",\n "%Bb": "»",\n "%bB": "»",\n "%BB": "»",\n "%bc": "¼",\n "%Bc": "¼",\n "%bC": "¼",\n "%BC": "¼",\n "%bd": "½",\n "%Bd": "½",\n "%bD": "½",\n "%BD": "½",\n "%be": "¾",\n "%Be": "¾",\n "%bE": "¾",\n "%BE": "¾",\n "%bf": "¿",\n "%Bf": "¿",\n "%bF": "¿",\n "%BF": "¿",\n "%c0": "À",\n "%C0": "À",\n "%c1": "Á",\n "%C1": "Á",\n "%c2": "Â",\n "%C2": "Â",\n "%c3": "Ã",\n "%C3": "Ã",\n "%c4": "Ä",\n "%C4": "Ä",\n "%c5": "Å",\n "%C5": "Å",\n "%c6": "Æ",\n "%C6": "Æ",\n "%c7": "Ç",\n "%C7": "Ç",\n "%c8": "È",\n "%C8": "È",\n "%c9": "É",\n "%C9": "É",\n "%ca": "Ê",\n "%Ca": "Ê",\n "%cA": "Ê",\n "%CA": "Ê",\n "%cb": "Ë",\n "%Cb": "Ë",\n "%cB": "Ë",\n "%CB": "Ë",\n "%cc": "Ì",\n "%Cc": "Ì",\n "%cC": "Ì",\n "%CC": "Ì",\n "%cd": "Í",\n "%Cd": "Í",\n "%cD": "Í",\n "%CD": "Í",\n "%ce": "Î",\n "%Ce": "Î",\n "%cE": "Î",\n "%CE": "Î",\n "%cf": "Ï",\n "%Cf": "Ï",\n "%cF": "Ï",\n "%CF": "Ï",\n "%d0": "Ð",\n "%D0": "Ð",\n "%d1": "Ñ",\n "%D1": "Ñ",\n "%d2": "Ò",\n "%D2": "Ò",\n "%d3": "Ó",\n "%D3": "Ó",\n "%d4": "Ô",\n "%D4": "Ô",\n "%d5": "Õ",\n "%D5": "Õ",\n "%d6": "Ö",\n "%D6": "Ö",\n "%d7": "×",\n "%D7": "×",\n "%d8": "Ø",\n "%D8": "Ø",\n "%d9": "Ù",\n "%D9": "Ù",\n "%da": "Ú",\n "%Da": "Ú",\n "%dA": "Ú",\n "%DA": "Ú",\n "%db": "Û",\n "%Db": "Û",\n "%dB": "Û",\n "%DB": "Û",\n "%dc": "Ü",\n "%Dc": "Ü",\n "%dC": "Ü",\n "%DC": "Ü",\n "%dd": "Ý",\n "%Dd": "Ý",\n "%dD": "Ý",\n "%DD": "Ý",\n "%de": "Þ",\n "%De": "Þ",\n "%dE": "Þ",\n "%DE": "Þ",\n "%df": "ß",\n "%Df": "ß",\n "%dF": "ß",\n "%DF": "ß",\n "%e0": "à",\n "%E0": "à",\n "%e1": "á",\n "%E1": "á",\n "%e2": "â",\n "%E2": "â",\n "%e3": "ã",\n "%E3": "ã",\n "%e4": "ä",\n "%E4": "ä",\n "%e5": "å",\n "%E5": "å",\n "%e6": "æ",\n "%E6": "æ",\n "%e7": "ç",\n "%E7": "ç",\n "%e8": "è",\n "%E8": "è",\n "%e9": "é",\n "%E9": "é",\n "%ea": "ê",\n "%Ea": "ê",\n "%eA": "ê",\n "%EA": "ê",\n "%eb": "ë",\n "%Eb": "ë",\n "%eB": "ë",\n "%EB": "ë",\n "%ec": "ì",\n "%Ec": "ì",\n "%eC": "ì",\n "%EC": "ì",\n "%ed": "í",\n "%Ed": "í",\n "%eD": "í",\n "%ED": "í",\n "%ee": "î",\n "%Ee": "î",\n "%eE": "î",\n "%EE": "î",\n "%ef": "ï",\n "%Ef": "ï",\n "%eF": "ï",\n "%EF": "ï",\n "%f0": "ð",\n "%F0": "ð",\n "%f1": "ñ",\n "%F1": "ñ",\n "%f2": "ò",\n "%F2": "ò",\n "%f3": "ó",\n "%F3": "ó",\n "%f4": "ô",\n "%F4": "ô",\n "%f5": "õ",\n "%F5": "õ",\n "%f6": "ö",\n "%F6": "ö",\n "%f7": "÷",\n "%F7": "÷",\n "%f8": "ø",\n "%F8": "ø",\n "%f9": "ù",\n "%F9": "ù",\n "%fa": "ú",\n "%Fa": "ú",\n "%fA": "ú",\n "%FA": "ú",\n "%fb": "û",\n "%Fb": "û",\n "%fB": "û",\n "%FB": "û",\n "%fc": "ü",\n "%Fc": "ü",\n "%fC": "ü",\n "%FC": "ü",\n "%fd": "ý",\n "%Fd": "ý",\n "%fD": "ý",\n "%FD": "ý",\n "%fe": "þ",\n "%Fe": "þ",\n "%fE": "þ",\n "%FE": "þ",\n "%ff": "ÿ",\n "%Ff": "ÿ",\n "%fF": "ÿ",\n "%FF": "ÿ"\n };\n function encodedReplacer(match) {\n return EncodedLookup[match];\n }\n var STATE_KEY = 0;\n var STATE_VALUE = 1;\n var STATE_CHARSET = 2;\n var STATE_LANG = 3;\n function parseParams(str) {\n const res = [];\n let state = STATE_KEY;\n let charset = "";\n let inquote = false;\n let escaping = false;\n let p = 0;\n let tmp = "";\n const len = str.length;\n for (var i = 0;i < len; ++i) {\n const char = str[i];\n if (char === "\\\\" && inquote) {\n if (escaping) {\n escaping = false;\n } else {\n escaping = true;\n continue;\n }\n } else if (char === \'"\') {\n if (!escaping) {\n if (inquote) {\n inquote = false;\n state = STATE_KEY;\n while (i + 1 < len && str[i + 1] !== ";") {\n ++i;\n }\n } else {\n inquote = true;\n }\n continue;\n } else {\n escaping = false;\n }\n } else {\n if (escaping && inquote) {\n tmp += "\\\\";\n }\n escaping = false;\n if ((state === STATE_CHARSET || state === STATE_LANG) && char === "\'") {\n if (state === STATE_CHARSET) {\n state = STATE_LANG;\n charset = tmp.substring(1);\n } else {\n state = STATE_VALUE;\n }\n tmp = "";\n continue;\n } else if (state === STATE_KEY && (char === "*" || char === "=") && res.length) {\n state = char === "*" ? STATE_CHARSET : STATE_VALUE;\n res[p] = [tmp, undefined];\n tmp = "";\n continue;\n } else if (!inquote && char === ";") {\n state = STATE_KEY;\n if (charset) {\n if (tmp.length) {\n tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), "binary", charset);\n }\n charset = "";\n } else if (tmp.length) {\n tmp = decodeText(tmp, "binary", "utf8");\n }\n if (res[p] === undefined) {\n res[p] = tmp;\n } else {\n res[p][1] = tmp;\n }\n tmp = "";\n ++p;\n continue;\n } else if (!inquote && (char === " " || char === "\\t")) {\n continue;\n }\n }\n tmp += char;\n }\n if (charset && tmp.length) {\n tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), "binary", charset);\n } else if (tmp) {\n tmp = decodeText(tmp, "binary", "utf8");\n }\n if (res[p] === undefined) {\n if (tmp) {\n res[p] = tmp;\n }\n } else {\n res[p][1] = tmp;\n }\n return res;\n }\n module.exports = parseParams;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/utils/basename.js\nvar require_basename = __commonJS((exports, module) => {\n module.exports = function basename(path) {\n if (typeof path !== "string") {\n return "";\n }\n for (var i = path.length - 1;i >= 0; --i) {\n switch (path.charCodeAt(i)) {\n case 47:\n case 92:\n path = path.slice(i + 1);\n return path === ".." || path === "." ? "" : path;\n }\n }\n return path === ".." || path === "." ? "" : path;\n };\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/types/multipart.js\nvar require_multipart = __commonJS((exports, module) => {\n var { Readable } = __require("node:stream");\n var { inherits } = __require("node:util");\n var Dicer = require_Dicer();\n var parseParams = require_parseParams();\n var decodeText = require_decodeText();\n var basename = require_basename();\n var getLimit = require_getLimit();\n var RE_BOUNDARY = /^boundary$/i;\n var RE_FIELD = /^form-data$/i;\n var RE_CHARSET = /^charset$/i;\n var RE_FILENAME = /^filename$/i;\n var RE_NAME = /^name$/i;\n Multipart.detect = /^multipart\\/form-data/i;\n function Multipart(boy, cfg) {\n let i;\n let len;\n const self2 = this;\n let boundary;\n const limits = cfg.limits;\n const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => contentType === "application/octet-stream" || fileName !== undefined);\n const parsedConType = cfg.parsedConType || [];\n const defCharset = cfg.defCharset || "utf8";\n const preservePath = cfg.preservePath;\n const fileOpts = { highWaterMark: cfg.fileHwm };\n for (i = 0, len = parsedConType.length;i < len; ++i) {\n if (Array.isArray(parsedConType[i]) && RE_BOUNDARY.test(parsedConType[i][0])) {\n boundary = parsedConType[i][1];\n break;\n }\n }\n function checkFinished() {\n if (nends === 0 && finished && !boy._done) {\n finished = false;\n self2.end();\n }\n }\n if (typeof boundary !== "string") {\n throw new Error("Multipart: Boundary not found");\n }\n const fieldSizeLimit = getLimit(limits, "fieldSize", 1 * 1024 * 1024);\n const fileSizeLimit = getLimit(limits, "fileSize", Infinity);\n const filesLimit = getLimit(limits, "files", Infinity);\n const fieldsLimit = getLimit(limits, "fields", Infinity);\n const partsLimit = getLimit(limits, "parts", Infinity);\n const headerPairsLimit = getLimit(limits, "headerPairs", 2000);\n const headerSizeLimit = getLimit(limits, "headerSize", 80 * 1024);\n let nfiles = 0;\n let nfields = 0;\n let nends = 0;\n let curFile;\n let curField;\n let finished = false;\n this._needDrain = false;\n this._pause = false;\n this._cb = undefined;\n this._nparts = 0;\n this._boy = boy;\n const parserCfg = {\n boundary,\n maxHeaderPairs: headerPairsLimit,\n maxHeaderSize: headerSizeLimit,\n partHwm: fileOpts.highWaterMark,\n highWaterMark: cfg.highWaterMark\n };\n this.parser = new Dicer(parserCfg);\n this.parser.on("drain", function() {\n self2._needDrain = false;\n if (self2._cb && !self2._pause) {\n const cb = self2._cb;\n self2._cb = undefined;\n cb();\n }\n }).on("part", function onPart(part) {\n if (++self2._nparts > partsLimit) {\n self2.parser.removeListener("part", onPart);\n self2.parser.on("part", skipPart);\n boy.hitPartsLimit = true;\n boy.emit("partsLimit");\n return skipPart(part);\n }\n if (curField) {\n const field = curField;\n field.emit("end");\n field.removeAllListeners("end");\n }\n part.on("header", function(header) {\n let contype;\n let fieldname;\n let parsed;\n let charset;\n let encoding;\n let filename;\n let nsize = 0;\n if (header["content-type"]) {\n parsed = parseParams(header["content-type"][0]);\n if (parsed[0]) {\n contype = parsed[0].toLowerCase();\n for (i = 0, len = parsed.length;i < len; ++i) {\n if (RE_CHARSET.test(parsed[i][0])) {\n charset = parsed[i][1].toLowerCase();\n break;\n }\n }\n }\n }\n if (contype === undefined) {\n contype = "text/plain";\n }\n if (charset === undefined) {\n charset = defCharset;\n }\n if (header["content-disposition"]) {\n parsed = parseParams(header["content-disposition"][0]);\n if (!RE_FIELD.test(parsed[0])) {\n return skipPart(part);\n }\n for (i = 0, len = parsed.length;i < len; ++i) {\n if (RE_NAME.test(parsed[i][0])) {\n fieldname = parsed[i][1];\n } else if (RE_FILENAME.test(parsed[i][0])) {\n filename = parsed[i][1];\n if (!preservePath) {\n filename = basename(filename);\n }\n }\n }\n } else {\n return skipPart(part);\n }\n if (header["content-transfer-encoding"]) {\n encoding = header["content-transfer-encoding"][0].toLowerCase();\n } else {\n encoding = "7bit";\n }\n let onData, onEnd;\n if (isPartAFile(fieldname, contype, filename)) {\n if (nfiles === filesLimit) {\n if (!boy.hitFilesLimit) {\n boy.hitFilesLimit = true;\n boy.emit("filesLimit");\n }\n return skipPart(part);\n }\n ++nfiles;\n if (boy.listenerCount("file") === 0) {\n self2.parser._ignore();\n return;\n }\n ++nends;\n const file = new FileStream(fileOpts);\n curFile = file;\n file.on("end", function() {\n --nends;\n self2._pause = false;\n checkFinished();\n if (self2._cb && !self2._needDrain) {\n const cb = self2._cb;\n self2._cb = undefined;\n cb();\n }\n });\n file._read = function(n) {\n if (!self2._pause) {\n return;\n }\n self2._pause = false;\n if (self2._cb && !self2._needDrain) {\n const cb = self2._cb;\n self2._cb = undefined;\n cb();\n }\n };\n boy.emit("file", fieldname, file, filename, encoding, contype);\n onData = function(data) {\n if ((nsize += data.length) > fileSizeLimit) {\n const extralen = fileSizeLimit - nsize + data.length;\n if (extralen > 0) {\n file.push(data.slice(0, extralen));\n }\n file.truncated = true;\n file.bytesRead = fileSizeLimit;\n part.removeAllListeners("data");\n file.emit("limit");\n return;\n } else if (!file.push(data)) {\n self2._pause = true;\n }\n file.bytesRead = nsize;\n };\n onEnd = function() {\n curFile = undefined;\n file.push(null);\n };\n } else {\n if (nfields === fieldsLimit) {\n if (!boy.hitFieldsLimit) {\n boy.hitFieldsLimit = true;\n boy.emit("fieldsLimit");\n }\n return skipPart(part);\n }\n ++nfields;\n ++nends;\n let buffer = "";\n let truncated = false;\n curField = part;\n onData = function(data) {\n if ((nsize += data.length) > fieldSizeLimit) {\n const extralen = fieldSizeLimit - (nsize - data.length);\n buffer += data.toString("binary", 0, extralen);\n truncated = true;\n part.removeAllListeners("data");\n } else {\n buffer += data.toString("binary");\n }\n };\n onEnd = function() {\n curField = undefined;\n if (buffer.length) {\n buffer = decodeText(buffer, "binary", charset);\n }\n boy.emit("field", fieldname, buffer, false, truncated, encoding, contype);\n --nends;\n checkFinished();\n };\n }\n part._readableState.sync = false;\n part.on("data", onData);\n part.on("end", onEnd);\n }).on("error", function(err) {\n if (curFile) {\n curFile.emit("error", err);\n }\n });\n }).on("error", function(err) {\n boy.emit("error", err);\n }).on("finish", function() {\n finished = true;\n checkFinished();\n });\n }\n Multipart.prototype.write = function(chunk, cb) {\n const r = this.parser.write(chunk);\n if (r && !this._pause) {\n cb();\n } else {\n this._needDrain = !r;\n this._cb = cb;\n }\n };\n Multipart.prototype.end = function() {\n const self2 = this;\n if (self2.parser.writable) {\n self2.parser.end();\n } else if (!self2._boy._done) {\n process.nextTick(function() {\n self2._boy._done = true;\n self2._boy.emit("finish");\n });\n }\n };\n function skipPart(part) {\n part.resume();\n }\n function FileStream(opts) {\n Readable.call(this, opts);\n this.bytesRead = 0;\n this.truncated = false;\n }\n inherits(FileStream, Readable);\n FileStream.prototype._read = function(n) {};\n module.exports = Multipart;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/utils/Decoder.js\nvar require_Decoder = __commonJS((exports, module) => {\n var RE_PLUS = /\\+/g;\n var HEX = [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ];\n function Decoder() {\n this.buffer = undefined;\n }\n Decoder.prototype.write = function(str) {\n str = str.replace(RE_PLUS, " ");\n let res = "";\n let i = 0;\n let p = 0;\n const len = str.length;\n for (;i < len; ++i) {\n if (this.buffer !== undefined) {\n if (!HEX[str.charCodeAt(i)]) {\n res += "%" + this.buffer;\n this.buffer = undefined;\n --i;\n } else {\n this.buffer += str[i];\n ++p;\n if (this.buffer.length === 2) {\n res += String.fromCharCode(parseInt(this.buffer, 16));\n this.buffer = undefined;\n }\n }\n } else if (str[i] === "%") {\n if (i > p) {\n res += str.substring(p, i);\n p = i;\n }\n this.buffer = "";\n ++p;\n }\n }\n if (p < len && this.buffer === undefined) {\n res += str.substring(p);\n }\n return res;\n };\n Decoder.prototype.reset = function() {\n this.buffer = undefined;\n };\n module.exports = Decoder;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/types/urlencoded.js\nvar require_urlencoded = __commonJS((exports, module) => {\n var Decoder = require_Decoder();\n var decodeText = require_decodeText();\n var getLimit = require_getLimit();\n var RE_CHARSET = /^charset$/i;\n UrlEncoded.detect = /^application\\/x-www-form-urlencoded/i;\n function UrlEncoded(boy, cfg) {\n const limits = cfg.limits;\n const parsedConType = cfg.parsedConType;\n this.boy = boy;\n this.fieldSizeLimit = getLimit(limits, "fieldSize", 1 * 1024 * 1024);\n this.fieldNameSizeLimit = getLimit(limits, "fieldNameSize", 100);\n this.fieldsLimit = getLimit(limits, "fields", Infinity);\n let charset;\n for (var i = 0, len = parsedConType.length;i < len; ++i) {\n if (Array.isArray(parsedConType[i]) && RE_CHARSET.test(parsedConType[i][0])) {\n charset = parsedConType[i][1].toLowerCase();\n break;\n }\n }\n if (charset === undefined) {\n charset = cfg.defCharset || "utf8";\n }\n this.decoder = new Decoder;\n this.charset = charset;\n this._fields = 0;\n this._state = "key";\n this._checkingBytes = true;\n this._bytesKey = 0;\n this._bytesVal = 0;\n this._key = "";\n this._val = "";\n this._keyTrunc = false;\n this._valTrunc = false;\n this._hitLimit = false;\n }\n UrlEncoded.prototype.write = function(data, cb) {\n if (this._fields === this.fieldsLimit) {\n if (!this.boy.hitFieldsLimit) {\n this.boy.hitFieldsLimit = true;\n this.boy.emit("fieldsLimit");\n }\n return cb();\n }\n let idxeq;\n let idxamp;\n let i;\n let p = 0;\n const len = data.length;\n while (p < len) {\n if (this._state === "key") {\n idxeq = idxamp = undefined;\n for (i = p;i < len; ++i) {\n if (!this._checkingBytes) {\n ++p;\n }\n if (data[i] === 61) {\n idxeq = i;\n break;\n } else if (data[i] === 38) {\n idxamp = i;\n break;\n }\n if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) {\n this._hitLimit = true;\n break;\n } else if (this._checkingBytes) {\n ++this._bytesKey;\n }\n }\n if (idxeq !== undefined) {\n if (idxeq > p) {\n this._key += this.decoder.write(data.toString("binary", p, idxeq));\n }\n this._state = "val";\n this._hitLimit = false;\n this._checkingBytes = true;\n this._val = "";\n this._bytesVal = 0;\n this._valTrunc = false;\n this.decoder.reset();\n p = idxeq + 1;\n } else if (idxamp !== undefined) {\n ++this._fields;\n let key;\n const keyTrunc = this._keyTrunc;\n if (idxamp > p) {\n key = this._key += this.decoder.write(data.toString("binary", p, idxamp));\n } else {\n key = this._key;\n }\n this._hitLimit = false;\n this._checkingBytes = true;\n this._key = "";\n this._bytesKey = 0;\n this._keyTrunc = false;\n this.decoder.reset();\n if (key.length) {\n this.boy.emit("field", decodeText(key, "binary", this.charset), "", keyTrunc, false);\n }\n p = idxamp + 1;\n if (this._fields === this.fieldsLimit) {\n return cb();\n }\n } else if (this._hitLimit) {\n if (i > p) {\n this._key += this.decoder.write(data.toString("binary", p, i));\n }\n p = i;\n if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) {\n this._checkingBytes = false;\n this._keyTrunc = true;\n }\n } else {\n if (p < len) {\n this._key += this.decoder.write(data.toString("binary", p));\n }\n p = len;\n }\n } else {\n idxamp = undefined;\n for (i = p;i < len; ++i) {\n if (!this._checkingBytes) {\n ++p;\n }\n if (data[i] === 38) {\n idxamp = i;\n break;\n }\n if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) {\n this._hitLimit = true;\n break;\n } else if (this._checkingBytes) {\n ++this._bytesVal;\n }\n }\n if (idxamp !== undefined) {\n ++this._fields;\n if (idxamp > p) {\n this._val += this.decoder.write(data.toString("binary", p, idxamp));\n }\n this.boy.emit("field", decodeText(this._key, "binary", this.charset), decodeText(this._val, "binary", this.charset), this._keyTrunc, this._valTrunc);\n this._state = "key";\n this._hitLimit = false;\n this._checkingBytes = true;\n this._key = "";\n this._bytesKey = 0;\n this._keyTrunc = false;\n this.decoder.reset();\n p = idxamp + 1;\n if (this._fields === this.fieldsLimit) {\n return cb();\n }\n } else if (this._hitLimit) {\n if (i > p) {\n this._val += this.decoder.write(data.toString("binary", p, i));\n }\n p = i;\n if (this._val === "" && this.fieldSizeLimit === 0 || (this._bytesVal = this._val.length) === this.fieldSizeLimit) {\n this._checkingBytes = false;\n this._valTrunc = true;\n }\n } else {\n if (p < len) {\n this._val += this.decoder.write(data.toString("binary", p));\n }\n p = len;\n }\n }\n }\n cb();\n };\n UrlEncoded.prototype.end = function() {\n if (this.boy._done) {\n return;\n }\n if (this._state === "key" && this._key.length > 0) {\n this.boy.emit("field", decodeText(this._key, "binary", this.charset), "", this._keyTrunc, false);\n } else if (this._state === "val") {\n this.boy.emit("field", decodeText(this._key, "binary", this.charset), decodeText(this._val, "binary", this.charset), this._keyTrunc, this._valTrunc);\n }\n this.boy._done = true;\n this.boy.emit("finish");\n };\n module.exports = UrlEncoded;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/node_modules/@fastify/busboy/lib/main.js\nvar require_main = __commonJS((exports, module) => {\n var WritableStream2 = __require("node:stream").Writable;\n var { inherits } = __require("node:util");\n var Dicer = require_Dicer();\n var MultipartParser = require_multipart();\n var UrlencodedParser = require_urlencoded();\n var parseParams = require_parseParams();\n function Busboy(opts) {\n if (!(this instanceof Busboy)) {\n return new Busboy(opts);\n }\n if (typeof opts !== "object") {\n throw new TypeError("Busboy expected an options-Object.");\n }\n if (typeof opts.headers !== "object") {\n throw new TypeError("Busboy expected an options-Object with headers-attribute.");\n }\n if (typeof opts.headers["content-type"] !== "string") {\n throw new TypeError("Missing Content-Type-header.");\n }\n const {\n headers,\n ...streamOptions\n } = opts;\n this.opts = {\n autoDestroy: false,\n ...streamOptions\n };\n WritableStream2.call(this, this.opts);\n this._done = false;\n this._parser = this.getParserByHeaders(headers);\n this._finished = false;\n }\n inherits(Busboy, WritableStream2);\n Busboy.prototype.emit = function(ev) {\n if (ev === "finish") {\n if (!this._done) {\n this._parser?.end();\n return;\n } else if (this._finished) {\n return;\n }\n this._finished = true;\n }\n WritableStream2.prototype.emit.apply(this, arguments);\n };\n Busboy.prototype.getParserByHeaders = function(headers) {\n const parsed = parseParams(headers["content-type"]);\n const cfg = {\n defCharset: this.opts.defCharset,\n fileHwm: this.opts.fileHwm,\n headers,\n highWaterMark: this.opts.highWaterMark,\n isPartAFile: this.opts.isPartAFile,\n limits: this.opts.limits,\n parsedConType: parsed,\n preservePath: this.opts.preservePath\n };\n if (MultipartParser.detect.test(parsed[0])) {\n return new MultipartParser(this, cfg);\n }\n if (UrlencodedParser.detect.test(parsed[0])) {\n return new UrlencodedParser(this, cfg);\n }\n throw new Error("Unsupported Content-Type.");\n };\n Busboy.prototype._write = function(chunk, encoding, cb) {\n this._parser.write(chunk, cb);\n };\n module.exports = Busboy;\n module.exports.default = Busboy;\n module.exports.Busboy = Busboy;\n module.exports.Dicer = Dicer;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/utils.js\nvar require_utils = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.fakePromise = undefined;\n exports.getHeadersObj = getHeadersObj;\n exports.defaultHeadersSerializer = defaultHeadersSerializer;\n exports.isArrayBufferView = isArrayBufferView;\n exports.isNodeReadable = isNodeReadable;\n exports.isIterable = isIterable;\n exports.shouldRedirect = shouldRedirect;\n exports.pipeThrough = pipeThrough;\n exports.endStream = endStream;\n exports.safeWrite = safeWrite;\n var node_events_1 = __require("node:events");\n function isHeadersInstance(obj) {\n return obj?.forEach != null;\n }\n function getHeadersObj(headers) {\n if (headers == null || !isHeadersInstance(headers)) {\n return headers;\n }\n if (headers.headersInit && !headers._map && !isHeadersInstance(headers.headersInit)) {\n return headers.headersInit;\n }\n return Object.fromEntries(headers.entries());\n }\n function defaultHeadersSerializer(headers, onContentLength) {\n const headerArray = [];\n headers.forEach((value, key) => {\n if (onContentLength && key === "content-length") {\n onContentLength(value);\n }\n headerArray.push(`${key}: ${value}`);\n });\n return headerArray;\n }\n var promise_helpers_1 = require_cjs();\n Object.defineProperty(exports, "fakePromise", { enumerable: true, get: function() {\n return promise_helpers_1.fakePromise;\n } });\n function isArrayBufferView(obj) {\n return obj != null && obj.buffer != null && obj.byteLength != null && obj.byteOffset != null;\n }\n function isNodeReadable(obj) {\n return obj != null && obj.pipe != null;\n }\n function isIterable(value) {\n return value?.[Symbol.iterator] != null;\n }\n function shouldRedirect(status) {\n return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;\n }\n function pipeThrough({ src, dest, signal, onError }) {\n if (onError) {\n dest.once("error", onError);\n }\n src.once("error", (e) => {\n dest.destroy(e);\n });\n dest.once("close", () => {\n if (!src.destroyed) {\n src.destroy();\n }\n });\n if (signal) {\n let cleanup = function() {\n signalRef.deref()?.removeEventListener("abort", onAbort);\n srcRef.deref()?.removeListener("end", cleanup);\n srcRef.deref()?.removeListener("error", cleanup);\n srcRef.deref()?.removeListener("close", cleanup);\n }, onAbort = function() {\n srcRef.deref()?.destroy(new AbortError);\n cleanup();\n };\n const srcRef = new WeakRef(src);\n const signalRef = new WeakRef(signal);\n signal.addEventListener("abort", onAbort, { once: true });\n src.once("end", cleanup);\n src.once("error", cleanup);\n src.once("close", cleanup);\n }\n src.pipe(dest, { end: true });\n }\n function endStream(stream) {\n return stream.end(null, null, null);\n }\n function safeWrite(chunk, stream) {\n const result = stream.write(chunk);\n if (!result) {\n return (0, node_events_1.once)(stream, "drain");\n }\n }\n\n class AbortError extends Error {\n constructor(message = "The operation was aborted", options = undefined) {\n super(message, options);\n this.name = "AbortError";\n }\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/ReadableStream.js\nvar require_ReadableStream = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillReadableStream = undefined;\n var node_buffer_1 = __require("node:buffer");\n var node_events_1 = __require("node:events");\n var node_stream_1 = __require("node:stream");\n var promises_1 = __require("node:stream/promises");\n var promise_helpers_1 = require_cjs();\n var utils_js_1 = require_utils();\n function createController(desiredSize, readable) {\n let chunks = [];\n let _closed = false;\n let flushed = false;\n return {\n desiredSize,\n enqueue(chunk) {\n const buf = typeof chunk === "string" ? node_buffer_1.Buffer.from(chunk) : chunk;\n if (!flushed) {\n chunks.push(buf);\n } else {\n readable.push(buf);\n }\n },\n close() {\n if (chunks.length > 0) {\n this._flush();\n }\n readable.push(null);\n _closed = true;\n },\n error(error) {\n if (chunks.length > 0) {\n this._flush();\n }\n readable.destroy(error);\n },\n get _closed() {\n return _closed;\n },\n _flush() {\n flushed = true;\n if (chunks.length > 0) {\n const concatenated = chunks.length > 1 ? node_buffer_1.Buffer.concat(chunks) : chunks[0];\n readable.push(concatenated);\n chunks = [];\n }\n }\n };\n }\n function isNodeReadable(obj) {\n return obj?.read != null;\n }\n function isReadableStream(obj) {\n return obj?.getReader != null;\n }\n\n class PonyfillReadableStream {\n readable;\n constructor(underlyingSource) {\n if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {\n this.readable = underlyingSource.readable;\n } else if (isNodeReadable(underlyingSource)) {\n this.readable = underlyingSource;\n } else if (isReadableStream(underlyingSource)) {\n this.readable = node_stream_1.Readable.fromWeb(underlyingSource);\n } else {\n let started = false;\n let ongoing = false;\n const handleStart = (desiredSize) => {\n if (!started) {\n const controller = createController(desiredSize, this.readable);\n started = true;\n return (0, promise_helpers_1.handleMaybePromise)(() => underlyingSource?.start?.(controller), () => {\n controller._flush();\n if (controller._closed) {\n return false;\n }\n return true;\n });\n }\n return true;\n };\n const readImpl = (desiredSize) => {\n return (0, promise_helpers_1.handleMaybePromise)(() => handleStart(desiredSize), (shouldContinue) => {\n if (!shouldContinue) {\n return;\n }\n const controller = createController(desiredSize, this.readable);\n return (0, promise_helpers_1.handleMaybePromise)(() => underlyingSource?.pull?.(controller), () => {\n controller._flush();\n ongoing = false;\n });\n });\n };\n this.readable = new node_stream_1.Readable({\n read(desiredSize) {\n if (ongoing) {\n return;\n }\n ongoing = true;\n return readImpl(desiredSize);\n },\n destroy(err, callback) {\n if (underlyingSource?.cancel) {\n try {\n const res$ = underlyingSource.cancel(err);\n if (res$?.then) {\n return res$.then(() => {\n callback(null);\n }, (err2) => {\n callback(err2);\n });\n }\n } catch (err2) {\n callback(err2);\n return;\n }\n }\n callback(null);\n }\n });\n }\n }\n cancel(reason) {\n this.readable.destroy(reason);\n return (0, node_events_1.once)(this.readable, "close");\n }\n locked = false;\n getReader(_options) {\n const iterator = this.readable[Symbol.asyncIterator]();\n this.locked = true;\n const thisReadable = this.readable;\n return {\n read() {\n return iterator.next();\n },\n releaseLock: () => {\n if (iterator.return) {\n const retResult$ = iterator.return();\n if (retResult$.then) {\n retResult$.then(() => {\n this.locked = false;\n });\n return;\n }\n }\n this.locked = false;\n },\n cancel: (reason) => {\n if (iterator.return) {\n const retResult$ = iterator.return(reason);\n if (retResult$.then) {\n return retResult$.then(() => {\n this.locked = false;\n });\n }\n }\n this.locked = false;\n return (0, utils_js_1.fakePromise)();\n },\n get closed() {\n return Promise.race([\n (0, node_events_1.once)(thisReadable, "end"),\n (0, node_events_1.once)(thisReadable, "error").then((err) => Promise.reject(err))\n ]);\n }\n };\n }\n [Symbol.asyncIterator]() {\n const iterator = this.readable[Symbol.asyncIterator]();\n return {\n [Symbol.asyncIterator]() {\n return this;\n },\n next: () => iterator.next(),\n return: () => {\n if (!this.readable.destroyed) {\n this.readable.destroy();\n }\n return iterator.return?.() || (0, utils_js_1.fakePromise)({ done: true, value: undefined });\n },\n throw: (err) => {\n if (!this.readable.destroyed) {\n this.readable.destroy(err);\n }\n return iterator.throw?.(err) || (0, utils_js_1.fakePromise)({ done: true, value: undefined });\n }\n };\n }\n tee() {\n throw new Error("Not implemented");\n }\n async pipeToWriter(writer) {\n try {\n for await (const chunk of this) {\n await writer.write(chunk);\n }\n await writer.close();\n } catch (err) {\n await writer.abort(err);\n }\n }\n pipeTo(destination) {\n if (isPonyfillWritableStream(destination)) {\n return (0, promises_1.pipeline)(this.readable, destination.writable, {\n end: true\n });\n } else {\n const writer = destination.getWriter();\n return this.pipeToWriter(writer);\n }\n }\n pipeThrough({ writable, readable }) {\n this.pipeTo(writable).catch((err) => {\n this.readable.destroy(err);\n });\n if (isPonyfillReadableStream(readable)) {\n readable.readable.once("error", (err) => this.readable.destroy(err));\n readable.readable.once("finish", () => this.readable.push(null));\n readable.readable.once("close", () => this.readable.push(null));\n }\n return readable;\n }\n static [Symbol.hasInstance](instance) {\n return isReadableStream(instance);\n }\n static from(iterable) {\n return new PonyfillReadableStream(node_stream_1.Readable.from(iterable));\n }\n [Symbol.toStringTag] = "ReadableStream";\n }\n exports.PonyfillReadableStream = PonyfillReadableStream;\n function isPonyfillReadableStream(obj) {\n return obj?.readable != null;\n }\n function isPonyfillWritableStream(obj) {\n return obj?.writable != null;\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/Blob.js\nvar require_Blob = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillBlob = undefined;\n exports.hasBufferMethod = hasBufferMethod;\n exports.hasArrayBufferMethod = hasArrayBufferMethod;\n exports.hasBytesMethod = hasBytesMethod;\n exports.hasTextMethod = hasTextMethod;\n exports.hasSizeProperty = hasSizeProperty;\n exports.hasStreamMethod = hasStreamMethod;\n exports.hasBlobSignature = hasBlobSignature;\n exports.isArrayBuffer = isArrayBuffer;\n var node_buffer_1 = __require("node:buffer");\n var ReadableStream_js_1 = require_ReadableStream();\n var utils_js_1 = require_utils();\n function getBlobPartAsBuffer(blobPart) {\n if (typeof blobPart === "string") {\n return node_buffer_1.Buffer.from(blobPart);\n } else if (node_buffer_1.Buffer.isBuffer(blobPart)) {\n return blobPart;\n } else if ((0, utils_js_1.isArrayBufferView)(blobPart)) {\n return node_buffer_1.Buffer.from(blobPart.buffer, blobPart.byteOffset, blobPart.byteLength);\n } else {\n return node_buffer_1.Buffer.from(blobPart);\n }\n }\n function hasBufferMethod(obj) {\n return obj != null && obj.buffer != null && typeof obj.buffer === "function";\n }\n function hasArrayBufferMethod(obj) {\n return obj != null && obj.arrayBuffer != null && typeof obj.arrayBuffer === "function";\n }\n function hasBytesMethod(obj) {\n return obj != null && obj.bytes != null && typeof obj.bytes === "function";\n }\n function hasTextMethod(obj) {\n return obj != null && obj.text != null && typeof obj.text === "function";\n }\n function hasSizeProperty(obj) {\n return obj != null && typeof obj.size === "number";\n }\n function hasStreamMethod(obj) {\n return obj != null && obj.stream != null && typeof obj.stream === "function";\n }\n function hasBlobSignature(obj) {\n return obj != null && obj[Symbol.toStringTag] === "Blob";\n }\n function isArrayBuffer(obj) {\n return obj != null && obj.byteLength != null && obj.slice != null;\n }\n\n class PonyfillBlob {\n blobParts;\n type;\n encoding;\n _size = null;\n constructor(blobParts = [], options) {\n this.blobParts = blobParts;\n this.type = options?.type || "application/octet-stream";\n this.encoding = options?.encoding || "utf8";\n this._size = options?.size || null;\n if (blobParts.length === 1 && hasBlobSignature(blobParts[0])) {\n return blobParts[0];\n }\n }\n _buffer = null;\n buffer() {\n if (this._buffer) {\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (this.blobParts.length === 1) {\n const blobPart = this.blobParts[0];\n if (hasBufferMethod(blobPart)) {\n return blobPart.buffer().then((buf) => {\n this._buffer = buf;\n return this._buffer;\n });\n }\n if (hasBytesMethod(blobPart)) {\n return blobPart.bytes().then((bytes) => {\n this._buffer = node_buffer_1.Buffer.from(bytes);\n return this._buffer;\n });\n }\n if (hasArrayBufferMethod(blobPart)) {\n return blobPart.arrayBuffer().then((arrayBuf) => {\n this._buffer = node_buffer_1.Buffer.from(arrayBuf, undefined, blobPart.size);\n return this._buffer;\n });\n }\n this._buffer = getBlobPartAsBuffer(blobPart);\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n const jobs = [];\n const bufferChunks = this.blobParts.map((blobPart, i) => {\n if (hasBufferMethod(blobPart)) {\n jobs.push(blobPart.buffer().then((buf) => {\n bufferChunks[i] = buf;\n }));\n return;\n } else if (hasArrayBufferMethod(blobPart)) {\n jobs.push(blobPart.arrayBuffer().then((arrayBuf) => {\n bufferChunks[i] = node_buffer_1.Buffer.from(arrayBuf, undefined, blobPart.size);\n }));\n return;\n } else if (hasBytesMethod(blobPart)) {\n jobs.push(blobPart.bytes().then((bytes) => {\n bufferChunks[i] = node_buffer_1.Buffer.from(bytes);\n }));\n return;\n } else {\n return getBlobPartAsBuffer(blobPart);\n }\n });\n if (jobs.length > 0) {\n return Promise.all(jobs).then(() => node_buffer_1.Buffer.concat(bufferChunks, this._size || undefined));\n }\n return (0, utils_js_1.fakePromise)(node_buffer_1.Buffer.concat(bufferChunks, this._size || undefined));\n }\n arrayBuffer() {\n if (this._buffer) {\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (this.blobParts.length === 1) {\n if (isArrayBuffer(this.blobParts[0])) {\n return (0, utils_js_1.fakePromise)(this.blobParts[0]);\n }\n if (hasArrayBufferMethod(this.blobParts[0])) {\n return this.blobParts[0].arrayBuffer();\n }\n }\n return this.buffer();\n }\n bytes() {\n if (this._buffer) {\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (this.blobParts.length === 1) {\n if (node_buffer_1.Buffer.isBuffer(this.blobParts[0])) {\n this._buffer = this.blobParts[0];\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (this.blobParts[0] instanceof Uint8Array) {\n this._buffer = node_buffer_1.Buffer.from(this.blobParts[0]);\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (hasBytesMethod(this.blobParts[0])) {\n return this.blobParts[0].bytes();\n }\n if (hasBufferMethod(this.blobParts[0])) {\n return this.blobParts[0].buffer();\n }\n }\n return this.buffer();\n }\n _text = null;\n text() {\n if (this._text) {\n return (0, utils_js_1.fakePromise)(this._text);\n }\n if (this.blobParts.length === 1) {\n const blobPart = this.blobParts[0];\n if (typeof blobPart === "string") {\n this._text = blobPart;\n return (0, utils_js_1.fakePromise)(this._text);\n }\n if (hasTextMethod(blobPart)) {\n return blobPart.text().then((text) => {\n this._text = text;\n return this._text;\n });\n }\n const buf = getBlobPartAsBuffer(blobPart);\n this._text = buf.toString(this.encoding);\n return (0, utils_js_1.fakePromise)(this._text);\n }\n return this.buffer().then((buf) => {\n this._text = buf.toString(this.encoding);\n return this._text;\n });\n }\n _json = null;\n json() {\n if (this._json) {\n return (0, utils_js_1.fakePromise)(this._json);\n }\n return this.text().then((text) => {\n this._json = JSON.parse(text);\n return this._json;\n });\n }\n _formData = null;\n formData() {\n if (this._formData) {\n return (0, utils_js_1.fakePromise)(this._formData);\n }\n throw new Error("Not implemented");\n }\n get size() {\n if (this._size == null) {\n this._size = 0;\n for (const blobPart of this.blobParts) {\n if (typeof blobPart === "string") {\n this._size += node_buffer_1.Buffer.byteLength(blobPart);\n } else if (hasSizeProperty(blobPart)) {\n this._size += blobPart.size;\n } else if ((0, utils_js_1.isArrayBufferView)(blobPart)) {\n this._size += blobPart.byteLength;\n }\n }\n }\n return this._size;\n }\n stream() {\n if (this.blobParts.length === 1) {\n const blobPart = this.blobParts[0];\n if (hasStreamMethod(blobPart)) {\n return blobPart.stream();\n }\n const buf = getBlobPartAsBuffer(blobPart);\n return new ReadableStream_js_1.PonyfillReadableStream({\n start: (controller) => {\n controller.enqueue(buf);\n controller.close();\n }\n });\n }\n if (this._buffer != null) {\n return new ReadableStream_js_1.PonyfillReadableStream({\n start: (controller) => {\n controller.enqueue(this._buffer);\n controller.close();\n }\n });\n }\n let blobPartIterator;\n return new ReadableStream_js_1.PonyfillReadableStream({\n start: (controller) => {\n if (this.blobParts.length === 0) {\n controller.close();\n return;\n }\n blobPartIterator = this.blobParts[Symbol.iterator]();\n },\n pull: (controller) => {\n const { value: blobPart, done } = blobPartIterator.next();\n if (done) {\n controller.close();\n return;\n }\n if (blobPart) {\n if (hasBufferMethod(blobPart)) {\n return blobPart.buffer().then((buf2) => {\n controller.enqueue(buf2);\n });\n }\n if (hasBytesMethod(blobPart)) {\n return blobPart.bytes().then((bytes) => {\n const buf2 = node_buffer_1.Buffer.from(bytes);\n controller.enqueue(buf2);\n });\n }\n if (hasArrayBufferMethod(blobPart)) {\n return blobPart.arrayBuffer().then((arrayBuffer) => {\n const buf2 = node_buffer_1.Buffer.from(arrayBuffer, undefined, blobPart.size);\n controller.enqueue(buf2);\n });\n }\n const buf = getBlobPartAsBuffer(blobPart);\n controller.enqueue(buf);\n }\n }\n });\n }\n slice() {\n throw new Error("Not implemented");\n }\n }\n exports.PonyfillBlob = PonyfillBlob;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/File.js\nvar require_File = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillFile = undefined;\n var Blob_js_1 = require_Blob();\n\n class PonyfillFile extends Blob_js_1.PonyfillBlob {\n name;\n lastModified;\n constructor(fileBits, name, options) {\n super(fileBits, options);\n this.name = name;\n this.lastModified = options?.lastModified || Date.now();\n }\n webkitRelativePath = "";\n }\n exports.PonyfillFile = PonyfillFile;\n});\n\n// ../../node_modules/tslib/tslib.js\nvar require_tslib = __commonJS((exports, module) => {\n var __extends;\n var __assign;\n var __rest;\n var __decorate;\n var __param;\n var __esDecorate;\n var __runInitializers;\n var __propKey;\n var __setFunctionName;\n var __metadata;\n var __awaiter;\n var __generator;\n var __exportStar;\n var __values;\n var __read;\n var __spread;\n var __spreadArrays;\n var __spreadArray;\n var __await;\n var __asyncGenerator;\n var __asyncDelegator;\n var __asyncValues;\n var __makeTemplateObject;\n var __importStar;\n var __importDefault;\n var __classPrivateFieldGet;\n var __classPrivateFieldSet;\n var __classPrivateFieldIn;\n var __createBinding;\n var __addDisposableResource;\n var __disposeResources;\n var __rewriteRelativeImportExtension;\n (function(factory) {\n var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};\n if (typeof define === "function" && define.amd) {\n define("tslib", ["exports"], function(exports2) {\n factory(createExporter(root, createExporter(exports2)));\n });\n } else if (typeof module === "object" && typeof exports === "object") {\n factory(createExporter(root, createExporter(exports)));\n } else {\n factory(createExporter(root));\n }\n function createExporter(exports2, previous) {\n if (exports2 !== root) {\n if (typeof Object.create === "function") {\n Object.defineProperty(exports2, "__esModule", { value: true });\n } else {\n exports2.__esModule = true;\n }\n }\n return function(id, v) {\n return exports2[id] = previous ? previous(id, v) : v;\n };\n }\n })(function(exporter) {\n var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {\n d.__proto__ = b;\n } || function(d, b) {\n for (var p in b)\n if (Object.prototype.hasOwnProperty.call(b, p))\n d[p] = b[p];\n };\n __extends = function(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);\n };\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length;i < n; i++) {\n s = arguments[i];\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n __rest = function(s, e) {\n var t = {};\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s);i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };\n __decorate = function(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1;i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n __param = function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n };\n __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) {\n if (f !== undefined && typeof f !== "function")\n throw new TypeError("Function expected");\n return f;\n }\n var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";\n var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1;i >= 0; i--) {\n var context = {};\n for (var p in contextIn)\n context[p] = p === "access" ? {} : contextIn[p];\n for (var p in contextIn.access)\n context.access[p] = contextIn.access[p];\n context.addInitializer = function(f) {\n if (done)\n throw new TypeError("Cannot add initializers after decoration has completed");\n extraInitializers.push(accept(f || null));\n };\n var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === "accessor") {\n if (result === undefined)\n continue;\n if (result === null || typeof result !== "object")\n throw new TypeError("Object expected");\n if (_ = accept(result.get))\n descriptor.get = _;\n if (_ = accept(result.set))\n descriptor.set = _;\n if (_ = accept(result.init))\n initializers.unshift(_);\n } else if (_ = accept(result)) {\n if (kind === "field")\n initializers.unshift(_);\n else\n descriptor[key] = _;\n }\n }\n if (target)\n Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n };\n __runInitializers = function(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0;i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : undefined;\n };\n __propKey = function(x) {\n return typeof x === "symbol" ? x : "".concat(x);\n };\n __setFunctionName = function(f, name, prefix) {\n if (typeof name === "symbol")\n name = name.description ? "[".concat(name.description, "]") : "";\n return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });\n };\n __metadata = function(metadataKey, metadataValue) {\n if (typeof Reflect === "object" && typeof Reflect.metadata === "function")\n return Reflect.metadata(metadataKey, metadataValue);\n };\n __awaiter = function(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n __generator = function(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1)\n throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f)\n throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _)\n try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)\n return t;\n if (y = 0, t)\n op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2])\n _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5)\n throw op[1];\n return { value: op[0] ? op[1] : undefined, done: true };\n }\n };\n __exportStar = function(m, o) {\n for (var p in m)\n if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))\n __createBinding(o, m, p);\n };\n __createBinding = Object.create ? function(o, m, k, k2) {\n if (k2 === undefined)\n k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() {\n return m[k];\n } };\n }\n Object.defineProperty(o, k2, desc);\n } : function(o, m, k, k2) {\n if (k2 === undefined)\n k2 = k;\n o[k2] = m[k];\n };\n __values = function(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m)\n return m.call(o);\n if (o && typeof o.length === "number")\n return {\n next: function() {\n if (o && i >= o.length)\n o = undefined;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n };\n __read = function(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m)\n return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === undefined || n-- > 0) && !(r = i.next()).done)\n ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"]))\n m.call(i);\n } finally {\n if (e)\n throw e.error;\n }\n }\n return ar;\n };\n __spread = function() {\n for (var ar = [], i = 0;i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n };\n __spreadArrays = function() {\n for (var s = 0, i = 0, il = arguments.length;i < il; i++)\n s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0;i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length;j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };\n __spreadArray = function(to, from, pack) {\n if (pack || arguments.length === 2)\n for (var i = 0, l = from.length, ar;i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar)\n ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n };\n __await = function(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n };\n __asyncGenerator = function(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator)\n throw new TypeError("Symbol.asyncIterator is not defined.");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {\n return this;\n }, i;\n function awaitReturn(f) {\n return function(v) {\n return Promise.resolve(v).then(f, reject);\n };\n }\n function verb(n, f) {\n if (g[n]) {\n i[n] = function(v) {\n return new Promise(function(a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n if (f)\n i[n] = f(i[n]);\n }\n }\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n function fulfill(value) {\n resume("next", value);\n }\n function reject(value) {\n resume("throw", value);\n }\n function settle(f, v) {\n if (f(v), q.shift(), q.length)\n resume(q[0][0], q[0][1]);\n }\n };\n __asyncDelegator = function(o) {\n var i, p;\n return i = {}, verb("next"), verb("throw", function(e) {\n throw e;\n }), verb("return"), i[Symbol.iterator] = function() {\n return this;\n }, i;\n function verb(n, f) {\n i[n] = o[n] ? function(v) {\n return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;\n } : f;\n }\n };\n __asyncValues = function(o) {\n if (!Symbol.asyncIterator)\n throw new TypeError("Symbol.asyncIterator is not defined.");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {\n return this;\n }, i);\n function verb(n) {\n i[n] = o[n] && function(v) {\n return new Promise(function(resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function(v2) {\n resolve({ value: v2, done: d });\n }, reject);\n }\n };\n __makeTemplateObject = function(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, "raw", { value: raw });\n } else {\n cooked.raw = raw;\n }\n return cooked;\n };\n var __setModuleDefault = Object.create ? function(o, v) {\n Object.defineProperty(o, "default", { enumerable: true, value: v });\n } : function(o, v) {\n o["default"] = v;\n };\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function(o2) {\n var ar = [];\n for (var k in o2)\n if (Object.prototype.hasOwnProperty.call(o2, k))\n ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n __importStar = function(mod) {\n if (mod && mod.__esModule)\n return mod;\n var result = {};\n if (mod != null) {\n for (var k = ownKeys(mod), i = 0;i < k.length; i++)\n if (k[i] !== "default")\n __createBinding(result, mod, k[i]);\n }\n __setModuleDefault(result, mod);\n return result;\n };\n __importDefault = function(mod) {\n return mod && mod.__esModule ? mod : { default: mod };\n };\n __classPrivateFieldGet = function(receiver, state, kind, f) {\n if (kind === "a" && !f)\n throw new TypeError("Private accessor was defined without a getter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))\n throw new TypeError("Cannot read private member from an object whose class did not declare it");\n return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);\n };\n __classPrivateFieldSet = function(receiver, state, value, kind, f) {\n if (kind === "m")\n throw new TypeError("Private method is not writable");\n if (kind === "a" && !f)\n throw new TypeError("Private accessor was defined without a setter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))\n throw new TypeError("Cannot write private member to an object whose class did not declare it");\n return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n };\n __classPrivateFieldIn = function(state, receiver) {\n if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function")\n throw new TypeError("Cannot use \'in\' operator on non-object");\n return typeof state === "function" ? receiver === state : state.has(receiver);\n };\n __addDisposableResource = function(env, value, async) {\n if (value !== null && value !== undefined) {\n if (typeof value !== "object" && typeof value !== "function")\n throw new TypeError("Object expected.");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose)\n throw new TypeError("Symbol.asyncDispose is not defined.");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === undefined) {\n if (!Symbol.dispose)\n throw new TypeError("Symbol.dispose is not defined.");\n dispose = value[Symbol.dispose];\n if (async)\n inner = dispose;\n }\n if (typeof dispose !== "function")\n throw new TypeError("Object not disposable.");\n if (inner)\n dispose = function() {\n try {\n inner.call(this);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n env.stack.push({ value, dispose, async });\n } else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n };\n var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {\n var e = new Error(message);\n return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;\n };\n __disposeResources = function(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1)\n return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async)\n return s |= 2, Promise.resolve(result).then(next, function(e) {\n fail(e);\n return next();\n });\n } else\n s |= 1;\n } catch (e) {\n fail(e);\n }\n }\n if (s === 1)\n return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError)\n throw env.error;\n }\n return next();\n };\n __rewriteRelativeImportExtension = function(path, preserveJsx) {\n if (typeof path === "string" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";\n });\n }\n return path;\n };\n exporter("__extends", __extends);\n exporter("__assign", __assign);\n exporter("__rest", __rest);\n exporter("__decorate", __decorate);\n exporter("__param", __param);\n exporter("__esDecorate", __esDecorate);\n exporter("__runInitializers", __runInitializers);\n exporter("__propKey", __propKey);\n exporter("__setFunctionName", __setFunctionName);\n exporter("__metadata", __metadata);\n exporter("__awaiter", __awaiter);\n exporter("__generator", __generator);\n exporter("__exportStar", __exportStar);\n exporter("__createBinding", __createBinding);\n exporter("__values", __values);\n exporter("__read", __read);\n exporter("__spread", __spread);\n exporter("__spreadArrays", __spreadArrays);\n exporter("__spreadArray", __spreadArray);\n exporter("__await", __await);\n exporter("__asyncGenerator", __asyncGenerator);\n exporter("__asyncDelegator", __asyncDelegator);\n exporter("__asyncValues", __asyncValues);\n exporter("__makeTemplateObject", __makeTemplateObject);\n exporter("__importStar", __importStar);\n exporter("__importDefault", __importDefault);\n exporter("__classPrivateFieldGet", __classPrivateFieldGet);\n exporter("__classPrivateFieldSet", __classPrivateFieldSet);\n exporter("__classPrivateFieldIn", __classPrivateFieldIn);\n exporter("__addDisposableResource", __addDisposableResource);\n exporter("__disposeResources", __disposeResources);\n exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension);\n });\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/cjs/SupressedError.js\nvar require_SupressedError = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillSuppressedError = undefined;\n\n class PonyfillSuppressedError2 extends Error {\n error;\n suppressed;\n constructor(error, suppressed, message) {\n super(message);\n this.error = error;\n this.suppressed = suppressed;\n this.name = "SuppressedError";\n Error.captureStackTrace(this, this.constructor);\n }\n }\n exports.PonyfillSuppressedError = PonyfillSuppressedError2;\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/cjs/symbols.js\nvar require_symbols = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.DisposableSymbols = undefined;\n exports.patchSymbols = patchSymbols;\n exports.DisposableSymbols = {\n get dispose() {\n return Symbol.dispose || Symbol.for("dispose");\n },\n get asyncDispose() {\n return Symbol.asyncDispose || Symbol.for("asyncDispose");\n }\n };\n function patchSymbols() {\n Symbol.dispose ||= Symbol.for("dispose");\n Symbol.asyncDispose ||= Symbol.for("asyncDispose");\n }\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/cjs/utils.js\nvar require_utils2 = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.isSyncDisposable = isSyncDisposable2;\n exports.isAsyncDisposable = isAsyncDisposable2;\n var symbols_js_1 = require_symbols();\n function isSyncDisposable2(obj) {\n return obj?.[symbols_js_1.DisposableSymbols.dispose] != null;\n }\n function isAsyncDisposable2(obj) {\n return obj?.[symbols_js_1.DisposableSymbols.asyncDispose] != null;\n }\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/cjs/AsyncDisposableStack.js\nvar require_AsyncDisposableStack = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillAsyncDisposableStack = undefined;\n var promise_helpers_1 = require_cjs();\n var SupressedError_js_1 = require_SupressedError();\n var symbols_js_1 = require_symbols();\n var utils_js_1 = require_utils2();\n var SuppressedError5 = globalThis.SuppressedError || SupressedError_js_1.PonyfillSuppressedError;\n\n class PonyfillAsyncDisposableStack2 {\n callbacks = [];\n get disposed() {\n return this.callbacks.length === 0;\n }\n use(value) {\n if ((0, utils_js_1.isAsyncDisposable)(value)) {\n this.callbacks.push(() => value[symbols_js_1.DisposableSymbols.asyncDispose]());\n } else if ((0, utils_js_1.isSyncDisposable)(value)) {\n this.callbacks.push(() => value[symbols_js_1.DisposableSymbols.dispose]());\n }\n return value;\n }\n adopt(value, onDisposeAsync) {\n if (onDisposeAsync) {\n this.callbacks.push(() => onDisposeAsync(value));\n }\n return value;\n }\n defer(onDisposeAsync) {\n if (onDisposeAsync) {\n this.callbacks.push(onDisposeAsync);\n }\n }\n move() {\n const stack = new PonyfillAsyncDisposableStack2;\n stack.callbacks = this.callbacks;\n this.callbacks = [];\n return stack;\n }\n disposeAsync() {\n return this[symbols_js_1.DisposableSymbols.asyncDispose]();\n }\n _error;\n _iterateCallbacks() {\n const cb = this.callbacks.pop();\n if (cb) {\n return (0, promise_helpers_1.handleMaybePromise)(cb, () => this._iterateCallbacks(), (error) => {\n this._error = this._error ? new SuppressedError5(error, this._error) : error;\n return this._iterateCallbacks();\n });\n }\n }\n [symbols_js_1.DisposableSymbols.asyncDispose]() {\n const res$ = this._iterateCallbacks();\n if (res$?.then) {\n return res$.then(() => {\n if (this._error) {\n const error = this._error;\n this._error = undefined;\n throw error;\n }\n });\n }\n if (this._error) {\n const error = this._error;\n this._error = undefined;\n throw error;\n }\n return;\n }\n [Symbol.toStringTag] = "AsyncDisposableStack";\n }\n exports.PonyfillAsyncDisposableStack = PonyfillAsyncDisposableStack2;\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/cjs/DisposableStack.js\nvar require_DisposableStack = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillDisposableStack = undefined;\n var SupressedError_js_1 = require_SupressedError();\n var symbols_js_1 = require_symbols();\n var utils_js_1 = require_utils2();\n var SuppressedError5 = globalThis.SuppressedError || SupressedError_js_1.PonyfillSuppressedError;\n\n class PonyfillDisposableStack2 {\n callbacks = [];\n get disposed() {\n return this.callbacks.length === 0;\n }\n use(value) {\n if ((0, utils_js_1.isSyncDisposable)(value)) {\n this.callbacks.push(() => value[symbols_js_1.DisposableSymbols.dispose]());\n }\n return value;\n }\n adopt(value, onDispose) {\n if (onDispose) {\n this.callbacks.push(() => onDispose(value));\n }\n return value;\n }\n defer(onDispose) {\n if (onDispose) {\n this.callbacks.push(onDispose);\n }\n }\n move() {\n const stack = new PonyfillDisposableStack2;\n stack.callbacks = this.callbacks;\n this.callbacks = [];\n return stack;\n }\n dispose() {\n return this[symbols_js_1.DisposableSymbols.dispose]();\n }\n _error;\n _iterateCallbacks() {\n const cb = this.callbacks.pop();\n if (cb) {\n try {\n cb();\n } catch (error) {\n this._error = this._error ? new SuppressedError5(error, this._error) : error;\n }\n return this._iterateCallbacks();\n }\n }\n [symbols_js_1.DisposableSymbols.dispose]() {\n this._iterateCallbacks();\n if (this._error) {\n const error = this._error;\n this._error = undefined;\n throw error;\n }\n }\n [Symbol.toStringTag] = "DisposableStack";\n }\n exports.PonyfillDisposableStack = PonyfillDisposableStack2;\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/cjs/index.js\nvar require_cjs2 = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.SuppressedError = exports.AsyncDisposableStack = exports.DisposableStack = undefined;\n var tslib_1 = require_tslib();\n var AsyncDisposableStack_js_1 = require_AsyncDisposableStack();\n var DisposableStack_js_1 = require_DisposableStack();\n var SupressedError_js_1 = require_SupressedError();\n exports.DisposableStack = globalThis.DisposableStack || DisposableStack_js_1.PonyfillDisposableStack;\n exports.AsyncDisposableStack = globalThis.AsyncDisposableStack || AsyncDisposableStack_js_1.PonyfillAsyncDisposableStack;\n exports.SuppressedError = globalThis.SuppressedError || SupressedError_js_1.PonyfillSuppressedError;\n tslib_1.__exportStar(require_symbols(), exports);\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/IteratorObject.js\nvar require_IteratorObject = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillIteratorObject = undefined;\n var node_util_1 = __require("node:util");\n var disposablestack_1 = require_cjs2();\n var utils_js_1 = require_utils();\n\n class PonyfillIteratorObject {\n iterableIterator;\n [Symbol.toStringTag] = "IteratorObject";\n constructor(iterableIterator, className) {\n this.iterableIterator = iterableIterator;\n this[Symbol.toStringTag] = className;\n }\n *map(callbackfn) {\n let index = 0;\n for (const value of this.iterableIterator) {\n yield callbackfn(value, index++);\n }\n return;\n }\n *filter(callbackfn) {\n let index = 0;\n for (const value of this.iterableIterator) {\n if (callbackfn(value, index++)) {\n yield value;\n }\n }\n return;\n }\n reduce(callbackfn, initialValue) {\n let index = 0;\n let accumulator = initialValue;\n for (const value of this.iterableIterator) {\n accumulator = callbackfn(accumulator, value, index++);\n }\n return accumulator;\n }\n forEach(callbackfn) {\n let index = 0;\n for (const value of this.iterableIterator) {\n callbackfn(value, index++);\n }\n }\n *take(limit) {\n let index = 0;\n for (const value of this.iterableIterator) {\n if (index >= limit) {\n break;\n }\n yield value;\n index++;\n }\n return;\n }\n *drop(count) {\n let index = 0;\n for (const value of this.iterableIterator) {\n if (index >= count) {\n yield value;\n }\n index++;\n }\n return;\n }\n *flatMap(callback) {\n let index = 0;\n for (const value of this.iterableIterator) {\n const iteratorOrIterable = callback(value, index++);\n if ((0, utils_js_1.isIterable)(iteratorOrIterable)) {\n for (const innerValue of iteratorOrIterable) {\n yield innerValue;\n }\n } else {\n for (const innerValue of {\n [Symbol.iterator]: () => iteratorOrIterable\n }) {\n yield innerValue;\n }\n }\n }\n return;\n }\n some(predicate) {\n let index = 0;\n for (const value of this.iterableIterator) {\n if (predicate(value, index++)) {\n return true;\n }\n }\n return false;\n }\n every(predicate) {\n let index = 0;\n for (const value of this.iterableIterator) {\n if (!predicate(value, index++)) {\n return false;\n }\n }\n return true;\n }\n find(predicate) {\n let index = 0;\n for (const value of this.iterableIterator) {\n if (predicate(value, index++)) {\n return value;\n }\n }\n return;\n }\n toArray() {\n return Array.from(this.iterableIterator);\n }\n [disposablestack_1.DisposableSymbols.dispose]() {\n this.iterableIterator.return?.();\n }\n next(...[value]) {\n return this.iterableIterator.next(value);\n }\n [Symbol.iterator]() {\n return this;\n }\n [Symbol.for("nodejs.util.inspect.custom")]() {\n const record = {};\n this.forEach((value, key) => {\n const inspectedValue = (0, node_util_1.inspect)(value);\n record[key] = inspectedValue.includes(",") ? inspectedValue.split(",").map((el) => el.trim()) : inspectedValue;\n });\n return `${this[Symbol.toStringTag]} ${(0, node_util_1.inspect)(record)}`;\n }\n }\n exports.PonyfillIteratorObject = PonyfillIteratorObject;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/FormData.js\nvar require_FormData = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillFormData = undefined;\n exports.getStreamFromFormData = getStreamFromFormData;\n var node_buffer_1 = __require("node:buffer");\n var IteratorObject_js_1 = require_IteratorObject();\n var ReadableStream_js_1 = require_ReadableStream();\n\n class PonyfillFormData {\n map = new Map;\n append(name, value, fileName) {\n let values = this.map.get(name);\n if (!values) {\n values = [];\n this.map.set(name, values);\n }\n const entry = isBlob(value) ? getNormalizedFile(name, value, fileName) : value;\n values.push(entry);\n }\n delete(name) {\n this.map.delete(name);\n }\n get(name) {\n const values = this.map.get(name);\n return values ? values[0] : null;\n }\n getAll(name) {\n return this.map.get(name) || [];\n }\n has(name) {\n return this.map.has(name);\n }\n set(name, value, fileName) {\n const entry = isBlob(value) ? getNormalizedFile(name, value, fileName) : value;\n this.map.set(name, [entry]);\n }\n [Symbol.iterator]() {\n return this._entries();\n }\n *_entries() {\n for (const [key, values] of this.map) {\n for (const value of values) {\n yield [key, value];\n }\n }\n }\n entries() {\n return new IteratorObject_js_1.PonyfillIteratorObject(this._entries(), "FormDataIterator");\n }\n _keys() {\n return this.map.keys();\n }\n keys() {\n return new IteratorObject_js_1.PonyfillIteratorObject(this._keys(), "FormDataIterator");\n }\n *_values() {\n for (const values of this.map.values()) {\n for (const value of values) {\n yield value;\n }\n }\n }\n values() {\n return new IteratorObject_js_1.PonyfillIteratorObject(this._values(), "FormDataIterator");\n }\n forEach(callback) {\n for (const [key, value] of this) {\n callback(value, key, this);\n }\n }\n }\n exports.PonyfillFormData = PonyfillFormData;\n function getStreamFromFormData(formData, boundary = "---") {\n let entriesIterator;\n let sentInitialHeader = false;\n let currentAsyncIterator;\n let hasBefore = false;\n function handleNextEntry(controller) {\n const { done, value } = entriesIterator.next();\n if (done) {\n controller.enqueue(node_buffer_1.Buffer.from(`\\r\n--${boundary}--\\r\n`));\n return controller.close();\n }\n if (hasBefore) {\n controller.enqueue(node_buffer_1.Buffer.from(`\\r\n--${boundary}\\r\n`));\n }\n if (value) {\n const [key, blobOrString] = value;\n if (typeof blobOrString === "string") {\n controller.enqueue(node_buffer_1.Buffer.from(`Content-Disposition: form-data; name="${key}"\\r\n\\r\n`));\n controller.enqueue(node_buffer_1.Buffer.from(blobOrString));\n } else {\n let filenamePart = "";\n if (blobOrString.name) {\n filenamePart = `; filename="${blobOrString.name}"`;\n }\n controller.enqueue(node_buffer_1.Buffer.from(`Content-Disposition: form-data; name="${key}"${filenamePart}\\r\n`));\n controller.enqueue(node_buffer_1.Buffer.from(`Content-Type: ${blobOrString.type || "application/octet-stream"}\\r\n\\r\n`));\n const entryStream = blobOrString.stream();\n currentAsyncIterator = entryStream[Symbol.asyncIterator]();\n }\n hasBefore = true;\n }\n }\n return new ReadableStream_js_1.PonyfillReadableStream({\n start: () => {\n entriesIterator = formData.entries();\n },\n pull: (controller) => {\n if (!sentInitialHeader) {\n sentInitialHeader = true;\n return controller.enqueue(node_buffer_1.Buffer.from(`--${boundary}\\r\n`));\n }\n if (currentAsyncIterator) {\n return currentAsyncIterator.next().then(({ done, value }) => {\n if (done) {\n currentAsyncIterator = undefined;\n }\n if (value) {\n return controller.enqueue(value);\n } else {\n return handleNextEntry(controller);\n }\n });\n }\n return handleNextEntry(controller);\n },\n cancel: (err) => {\n entriesIterator?.return?.(err);\n currentAsyncIterator?.return?.(err);\n }\n });\n }\n function getNormalizedFile(name, blob, fileName) {\n Object.defineProperty(blob, "name", {\n configurable: true,\n enumerable: true,\n value: fileName || blob.name || name\n });\n return blob;\n }\n function isBlob(value) {\n return value?.arrayBuffer != null;\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/Body.js\nvar require_Body = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillBody = undefined;\n var node_buffer_1 = __require("node:buffer");\n var node_stream_1 = __require("node:stream");\n var busboy_1 = require_main();\n var promise_helpers_1 = require_cjs();\n var Blob_js_1 = require_Blob();\n var File_js_1 = require_File();\n var FormData_js_1 = require_FormData();\n var ReadableStream_js_1 = require_ReadableStream();\n var utils_js_1 = require_utils();\n var BodyInitType;\n (function(BodyInitType2) {\n BodyInitType2["ReadableStream"] = "ReadableStream";\n BodyInitType2["Blob"] = "Blob";\n BodyInitType2["FormData"] = "FormData";\n BodyInitType2["String"] = "String";\n BodyInitType2["Readable"] = "Readable";\n BodyInitType2["Buffer"] = "Buffer";\n BodyInitType2["AsyncIterable"] = "AsyncIterable";\n })(BodyInitType || (BodyInitType = {}));\n\n class PonyfillBody {\n bodyInit;\n options;\n bodyUsed = false;\n contentType = null;\n contentLength = null;\n constructor(bodyInit, options = {}) {\n this.bodyInit = bodyInit;\n this.options = options;\n const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit);\n this._bodyFactory = bodyFactory;\n this.contentType = contentType;\n this.contentLength = contentLength;\n this.bodyType = bodyType;\n this._buffer = buffer;\n this._signal = options.signal;\n }\n bodyType;\n _bodyFactory = () => null;\n _generatedBody = null;\n _buffer;\n _signal;\n generateBody() {\n if (this._generatedBody?.readable?.destroyed && this._buffer) {\n this._generatedBody.readable = node_stream_1.Readable.from(this._buffer);\n }\n if (this._generatedBody) {\n return this._generatedBody;\n }\n const body = this._bodyFactory();\n this._generatedBody = body;\n return body;\n }\n handleContentLengthHeader(forceSet = false) {\n const contentTypeInHeaders = this.headers.get("content-type");\n if (!contentTypeInHeaders) {\n if (this.contentType) {\n this.headers.set("content-type", this.contentType);\n }\n } else {\n this.contentType = contentTypeInHeaders;\n }\n const contentLengthInHeaders = this.headers.get("content-length");\n if (forceSet && this.bodyInit == null && !contentLengthInHeaders) {\n this.contentLength = 0;\n this.headers.set("content-length", "0");\n }\n if (!contentLengthInHeaders) {\n if (this.contentLength) {\n this.headers.set("content-length", this.contentLength.toString());\n }\n } else {\n this.contentLength = parseInt(contentLengthInHeaders, 10);\n }\n }\n get body() {\n const _body = this.generateBody();\n if (_body != null) {\n const ponyfillReadableStream = _body;\n const readable = _body.readable;\n return new Proxy(_body.readable, {\n get(_, prop) {\n if (prop in ponyfillReadableStream) {\n const ponyfillReadableStreamProp = ponyfillReadableStream[prop];\n if (typeof ponyfillReadableStreamProp === "function") {\n return ponyfillReadableStreamProp.bind(ponyfillReadableStream);\n }\n return ponyfillReadableStreamProp;\n }\n if (prop in readable) {\n const readableProp = readable[prop];\n if (typeof readableProp === "function") {\n return readableProp.bind(readable);\n }\n return readableProp;\n }\n }\n });\n }\n return null;\n }\n _chunks = null;\n _doCollectChunksFromReadableJob() {\n if (this.bodyType === BodyInitType.AsyncIterable) {\n if (Array.fromAsync) {\n return (0, promise_helpers_1.handleMaybePromise)(() => Array.fromAsync(this.bodyInit), (chunks3) => {\n this._chunks = chunks3;\n return this._chunks;\n });\n }\n const iterator = this.bodyInit[Symbol.asyncIterator]();\n const chunks2 = [];\n const collectValue = () => (0, promise_helpers_1.handleMaybePromise)(() => iterator.next(), ({ value, done }) => {\n if (value) {\n chunks2.push(value);\n }\n if (!done) {\n return collectValue();\n }\n this._chunks = chunks2;\n return this._chunks;\n });\n return collectValue();\n }\n const _body = this.generateBody();\n if (!_body) {\n this._chunks = [];\n return (0, utils_js_1.fakePromise)(this._chunks);\n }\n if (_body.readable.destroyed) {\n return (0, utils_js_1.fakePromise)(this._chunks = []);\n }\n const chunks = [];\n return new Promise((resolve, reject) => {\n _body.readable.on("data", (chunk) => {\n chunks.push(chunk);\n });\n _body.readable.once("error", reject);\n _body.readable.once("end", () => {\n resolve(this._chunks = chunks);\n });\n });\n }\n _collectChunksFromReadable() {\n if (this._chunks) {\n return (0, utils_js_1.fakePromise)(this._chunks);\n }\n this._chunks ||= this._doCollectChunksFromReadableJob();\n return this._chunks;\n }\n _blob = null;\n blob() {\n if (this._blob) {\n return (0, utils_js_1.fakePromise)(this._blob);\n }\n if (this.bodyType === BodyInitType.String) {\n this._text = this.bodyInit;\n this._blob = new Blob_js_1.PonyfillBlob([this._text], {\n type: this.contentType || "text/plain;charset=UTF-8",\n size: this.contentLength\n });\n }\n if (this.bodyType === BodyInitType.Blob) {\n this._blob = this.bodyInit;\n return (0, utils_js_1.fakePromise)(this._blob);\n }\n if (this._buffer) {\n this._blob = new Blob_js_1.PonyfillBlob([this._buffer], {\n type: this.contentType || "",\n size: this.contentLength\n });\n return (0, utils_js_1.fakePromise)(this._blob);\n }\n return (0, utils_js_1.fakePromise)((0, promise_helpers_1.handleMaybePromise)(() => this._collectChunksFromReadable(), (chunks) => {\n this._blob = new Blob_js_1.PonyfillBlob(chunks, {\n type: this.contentType || "",\n size: this.contentLength\n });\n return this._blob;\n }));\n }\n _formData = null;\n formData(opts) {\n if (this._formData) {\n return (0, utils_js_1.fakePromise)(this._formData);\n }\n if (this.bodyType === BodyInitType.FormData) {\n this._formData = this.bodyInit;\n return (0, utils_js_1.fakePromise)(this._formData);\n }\n this._formData = new FormData_js_1.PonyfillFormData;\n const _body = this.generateBody();\n if (_body == null) {\n return (0, utils_js_1.fakePromise)(this._formData);\n }\n const formDataLimits = {\n ...this.options.formDataLimits,\n ...opts?.formDataLimits\n };\n return new Promise((resolve, reject) => {\n const stream = this.body?.readable;\n if (!stream) {\n return reject(new Error("No stream available"));\n }\n let currFile = null;\n const bb = new busboy_1.Busboy({\n headers: {\n "content-length": typeof this.contentLength === "number" ? this.contentLength.toString() : this.contentLength || "",\n "content-type": this.contentType || ""\n },\n limits: formDataLimits,\n defCharset: "utf-8"\n });\n if (this._signal) {\n (0, node_stream_1.addAbortSignal)(this._signal, bb);\n }\n let completed = false;\n const complete = (err) => {\n if (completed)\n return;\n completed = true;\n stream.unpipe(bb);\n bb.destroy();\n if (currFile) {\n currFile.destroy();\n currFile = null;\n }\n if (err) {\n reject(err);\n } else {\n resolve(this._formData);\n }\n };\n stream.on("error", complete);\n bb.on("field", (name, value, fieldnameTruncated, valueTruncated) => {\n if (fieldnameTruncated) {\n return complete(new Error(`Field name size exceeded: ${formDataLimits?.fieldNameSize} bytes`));\n }\n if (valueTruncated) {\n return complete(new Error(`Field value size exceeded: ${formDataLimits?.fieldSize} bytes`));\n }\n this._formData.set(name, value);\n });\n bb.on("file", (name, fileStream, filename, _transferEncoding, mimeType) => {\n currFile = fileStream;\n const chunks = [];\n fileStream.on("data", (chunk) => {\n chunks.push(chunk);\n });\n fileStream.on("error", complete);\n fileStream.on("limit", () => {\n complete(new Error(`File size limit exceeded: ${formDataLimits?.fileSize} bytes`));\n });\n fileStream.on("close", () => {\n if (fileStream.truncated) {\n complete(new Error(`File size limit exceeded: ${formDataLimits?.fileSize} bytes`));\n }\n currFile = null;\n const file = new File_js_1.PonyfillFile(chunks, filename, { type: mimeType });\n this._formData.set(name, file);\n });\n });\n bb.on("fieldsLimit", () => {\n complete(new Error(`Fields limit exceeded: ${formDataLimits?.fields}`));\n });\n bb.on("filesLimit", () => {\n complete(new Error(`Files limit exceeded: ${formDataLimits?.files}`));\n });\n bb.on("partsLimit", () => {\n complete(new Error(`Parts limit exceeded: ${formDataLimits?.parts}`));\n });\n bb.on("end", complete);\n bb.on("finish", complete);\n bb.on("close", complete);\n bb.on("error", complete);\n stream.pipe(bb);\n });\n }\n buffer() {\n if (this._buffer) {\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (this._text) {\n this._buffer = node_buffer_1.Buffer.from(this._text, "utf-8");\n return (0, utils_js_1.fakePromise)(this._buffer);\n }\n if (this.bodyType === BodyInitType.String) {\n return this.text().then((text) => {\n this._text = text;\n this._buffer = node_buffer_1.Buffer.from(text, "utf-8");\n return this._buffer;\n });\n }\n if (this.bodyType === BodyInitType.Blob) {\n if ((0, Blob_js_1.hasBufferMethod)(this.bodyInit)) {\n return this.bodyInit.buffer().then((buf) => {\n this._buffer = buf;\n return this._buffer;\n });\n }\n if ((0, Blob_js_1.hasBytesMethod)(this.bodyInit)) {\n return this.bodyInit.bytes().then((bytes) => {\n this._buffer = node_buffer_1.Buffer.from(bytes);\n return this._buffer;\n });\n }\n if ((0, Blob_js_1.hasArrayBufferMethod)(this.bodyInit)) {\n return this.bodyInit.arrayBuffer().then((buf) => {\n this._buffer = node_buffer_1.Buffer.from(buf, undefined, buf.byteLength);\n return this._buffer;\n });\n }\n }\n return (0, utils_js_1.fakePromise)((0, promise_helpers_1.handleMaybePromise)(() => this._collectChunksFromReadable(), (chunks) => {\n if (chunks.length === 1) {\n this._buffer = chunks[0];\n return this._buffer;\n }\n this._buffer = node_buffer_1.Buffer.concat(chunks);\n return this._buffer;\n }));\n }\n bytes() {\n return this.buffer();\n }\n arrayBuffer() {\n return this.buffer();\n }\n _json = null;\n json() {\n if (this._json) {\n return (0, utils_js_1.fakePromise)(this._json);\n }\n return this.text().then((text) => {\n try {\n this._json = JSON.parse(text);\n } catch (e) {\n if (e instanceof SyntaxError) {\n e.message += `, "${text}" is not valid JSON`;\n }\n throw e;\n }\n return this._json;\n });\n }\n _text = null;\n text() {\n if (this._text) {\n return (0, utils_js_1.fakePromise)(this._text);\n }\n if (this.bodyType === BodyInitType.String) {\n this._text = this.bodyInit;\n return (0, utils_js_1.fakePromise)(this._text);\n }\n return this.buffer().then((buffer) => {\n this._text = buffer.toString("utf-8");\n return this._text;\n });\n }\n }\n exports.PonyfillBody = PonyfillBody;\n function processBodyInit(bodyInit) {\n if (bodyInit == null) {\n return {\n bodyFactory: () => null,\n contentType: null,\n contentLength: null\n };\n }\n if (typeof bodyInit === "string") {\n const contentLength = node_buffer_1.Buffer.byteLength(bodyInit);\n return {\n bodyType: BodyInitType.String,\n contentType: "text/plain;charset=UTF-8",\n contentLength,\n bodyFactory() {\n const readable = node_stream_1.Readable.from(node_buffer_1.Buffer.from(bodyInit, "utf-8"));\n return new ReadableStream_js_1.PonyfillReadableStream(readable);\n }\n };\n }\n if (node_buffer_1.Buffer.isBuffer(bodyInit)) {\n const buffer = bodyInit;\n return {\n bodyType: BodyInitType.Buffer,\n contentType: null,\n contentLength: bodyInit.length,\n buffer: bodyInit,\n bodyFactory() {\n const readable = node_stream_1.Readable.from(buffer);\n const body = new ReadableStream_js_1.PonyfillReadableStream(readable);\n return body;\n }\n };\n }\n if ((0, utils_js_1.isArrayBufferView)(bodyInit)) {\n const buffer = node_buffer_1.Buffer.from(bodyInit.buffer, bodyInit.byteOffset, bodyInit.byteLength);\n return {\n bodyType: BodyInitType.Buffer,\n contentLength: bodyInit.byteLength,\n contentType: null,\n buffer,\n bodyFactory() {\n const readable = node_stream_1.Readable.from(buffer);\n const body = new ReadableStream_js_1.PonyfillReadableStream(readable);\n return body;\n }\n };\n }\n if (bodyInit instanceof ReadableStream_js_1.PonyfillReadableStream && bodyInit.readable != null) {\n const readableStream = bodyInit;\n return {\n bodyType: BodyInitType.ReadableStream,\n bodyFactory: () => readableStream,\n contentType: null,\n contentLength: null\n };\n }\n if (isBlob(bodyInit)) {\n const blob = bodyInit;\n return {\n bodyType: BodyInitType.Blob,\n contentType: bodyInit.type,\n contentLength: bodyInit.size,\n bodyFactory() {\n return blob.stream();\n }\n };\n }\n if (bodyInit instanceof ArrayBuffer) {\n const contentLength = bodyInit.byteLength;\n const buffer = node_buffer_1.Buffer.from(bodyInit, undefined, bodyInit.byteLength);\n return {\n bodyType: BodyInitType.Buffer,\n contentType: null,\n contentLength,\n buffer,\n bodyFactory() {\n const readable = node_stream_1.Readable.from(buffer);\n const body = new ReadableStream_js_1.PonyfillReadableStream(readable);\n return body;\n }\n };\n }\n if (bodyInit instanceof node_stream_1.Readable) {\n return {\n bodyType: BodyInitType.Readable,\n contentType: null,\n contentLength: null,\n bodyFactory() {\n const body = new ReadableStream_js_1.PonyfillReadableStream(bodyInit);\n return body;\n }\n };\n }\n if (isURLSearchParams(bodyInit)) {\n const contentType = "application/x-www-form-urlencoded;charset=UTF-8";\n return {\n bodyType: BodyInitType.String,\n contentType,\n contentLength: null,\n bodyFactory() {\n const body = new ReadableStream_js_1.PonyfillReadableStream(node_stream_1.Readable.from(bodyInit.toString()));\n return body;\n }\n };\n }\n if (isFormData(bodyInit)) {\n const boundary = Math.random().toString(36).substr(2);\n const contentType = `multipart/form-data; boundary=${boundary}`;\n return {\n bodyType: BodyInitType.FormData,\n contentType,\n contentLength: null,\n bodyFactory() {\n return (0, FormData_js_1.getStreamFromFormData)(bodyInit, boundary);\n }\n };\n }\n if (isReadableStream(bodyInit)) {\n return {\n contentType: null,\n contentLength: null,\n bodyFactory() {\n return new ReadableStream_js_1.PonyfillReadableStream(bodyInit);\n }\n };\n }\n if (bodyInit[Symbol.iterator] || bodyInit[Symbol.asyncIterator]) {\n return {\n contentType: null,\n contentLength: null,\n bodyType: BodyInitType.AsyncIterable,\n bodyFactory() {\n const readable = node_stream_1.Readable.from(bodyInit);\n return new ReadableStream_js_1.PonyfillReadableStream(readable);\n }\n };\n }\n throw new Error("Unknown body type");\n }\n function isFormData(value) {\n return value?.forEach != null;\n }\n function isBlob(value) {\n return value?.stream != null && typeof value.stream === "function";\n }\n function isURLSearchParams(value) {\n return value?.sort != null;\n }\n function isReadableStream(value) {\n return value?.getReader != null;\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/Headers.js\nvar require_Headers = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillHeaders = undefined;\n exports.isHeadersLike = isHeadersLike;\n var node_util_1 = __require("node:util");\n var IteratorObject_js_1 = require_IteratorObject();\n function isHeadersLike(headers) {\n return headers?.get && headers?.forEach;\n }\n\n class PonyfillHeaders {\n headersInit;\n _map;\n objectNormalizedKeysOfHeadersInit = [];\n objectOriginalKeysOfHeadersInit = [];\n _setCookies;\n constructor(headersInit) {\n this.headersInit = headersInit;\n }\n _get(key) {\n const normalized = key.toLowerCase();\n if (normalized === "set-cookie" && this._setCookies?.length) {\n return this._setCookies.join(", ");\n }\n if (this._map) {\n return this._map.get(normalized) || null;\n }\n if (this.headersInit == null) {\n return null;\n }\n if (Array.isArray(this.headersInit)) {\n const found = this.headersInit.filter(([headerKey]) => headerKey.toLowerCase() === normalized);\n if (found.length === 0) {\n return null;\n }\n if (found.length === 1) {\n return found[0][1];\n }\n return found.map(([, value]) => value).join(", ");\n } else if (isHeadersLike(this.headersInit)) {\n return this.headersInit.get(normalized);\n } else {\n const initValue = this.headersInit[key] || this.headersInit[normalized];\n if (initValue != null) {\n return initValue;\n }\n if (!this.objectNormalizedKeysOfHeadersInit.length) {\n Object.keys(this.headersInit).forEach((k) => {\n this.objectOriginalKeysOfHeadersInit.push(k);\n this.objectNormalizedKeysOfHeadersInit.push(k.toLowerCase());\n });\n }\n const index = this.objectNormalizedKeysOfHeadersInit.indexOf(normalized);\n if (index === -1) {\n return null;\n }\n const originalKey = this.objectOriginalKeysOfHeadersInit[index];\n return this.headersInit[originalKey];\n }\n }\n getMap() {\n if (!this._map) {\n this._setCookies ||= [];\n if (this.headersInit != null) {\n if (Array.isArray(this.headersInit)) {\n this._map = new Map;\n for (const [key, value] of this.headersInit) {\n const normalizedKey = key.toLowerCase();\n if (normalizedKey === "set-cookie") {\n this._setCookies.push(value);\n continue;\n }\n this._map.set(normalizedKey, value);\n }\n } else if (isHeadersLike(this.headersInit)) {\n this._map = new Map;\n this.headersInit.forEach((value, key) => {\n if (key === "set-cookie") {\n this._setCookies ||= [];\n this._setCookies.push(value);\n return;\n }\n this._map.set(key, value);\n });\n } else {\n this._map = new Map;\n for (const initKey in this.headersInit) {\n const initValue = this.headersInit[initKey];\n if (initValue != null) {\n const normalizedKey = initKey.toLowerCase();\n if (normalizedKey === "set-cookie") {\n this._setCookies ||= [];\n this._setCookies.push(initValue);\n continue;\n }\n this._map.set(normalizedKey, initValue);\n }\n }\n }\n } else {\n this._map = new Map;\n }\n }\n return this._map;\n }\n append(name, value) {\n const key = name.toLowerCase();\n if (key === "set-cookie") {\n this._setCookies ||= [];\n this._setCookies.push(value);\n return;\n }\n const existingValue = this.getMap().get(key);\n const finalValue = existingValue ? `${existingValue}, ${value}` : value;\n this.getMap().set(key, finalValue);\n }\n get(name) {\n const value = this._get(name);\n if (value == null) {\n return null;\n }\n return value.toString();\n }\n has(name) {\n const key = name.toLowerCase();\n if (key === "set-cookie") {\n return !!this._setCookies?.length;\n }\n return !!this._get(name);\n }\n set(name, value) {\n const key = name.toLowerCase();\n if (key === "set-cookie") {\n this._setCookies = [value];\n return;\n }\n if (!this._map && this.headersInit != null) {\n if (Array.isArray(this.headersInit)) {\n const found = this.headersInit.find(([headerKey]) => headerKey.toLowerCase() === key);\n if (found) {\n found[1] = value;\n } else {\n this.headersInit.push([key, value]);\n }\n return;\n } else if (isHeadersLike(this.headersInit)) {\n this.headersInit.set(key, value);\n return;\n } else {\n this.headersInit[key] = value;\n return;\n }\n }\n this.getMap().set(key, value);\n }\n delete(name) {\n const key = name.toLowerCase();\n if (key === "set-cookie") {\n this._setCookies = [];\n return;\n }\n this.getMap().delete(key);\n }\n forEach(callback) {\n this._setCookies?.forEach((setCookie) => {\n callback(setCookie, "set-cookie", this);\n });\n if (!this._map) {\n if (this.headersInit) {\n if (Array.isArray(this.headersInit)) {\n this.headersInit.forEach(([key, value]) => {\n callback(value, key, this);\n });\n return;\n }\n if (isHeadersLike(this.headersInit)) {\n this.headersInit.forEach(callback);\n return;\n }\n Object.entries(this.headersInit).forEach(([key, value]) => {\n if (value != null) {\n callback(value, key, this);\n }\n });\n }\n return;\n }\n this.getMap().forEach((value, key) => {\n callback(value, key, this);\n });\n }\n *_keys() {\n if (this._setCookies?.length) {\n yield "set-cookie";\n }\n if (!this._map) {\n if (this.headersInit) {\n if (Array.isArray(this.headersInit)) {\n yield* this.headersInit.map(([key]) => key)[Symbol.iterator]();\n return;\n }\n if (isHeadersLike(this.headersInit)) {\n yield* this.headersInit.keys();\n return;\n }\n yield* Object.keys(this.headersInit)[Symbol.iterator]();\n return;\n }\n }\n yield* this.getMap().keys();\n }\n keys() {\n return new IteratorObject_js_1.PonyfillIteratorObject(this._keys(), "HeadersIterator");\n }\n *_values() {\n if (this._setCookies?.length) {\n yield* this._setCookies;\n }\n if (!this._map) {\n if (this.headersInit) {\n if (Array.isArray(this.headersInit)) {\n yield* this.headersInit.map(([, value]) => value)[Symbol.iterator]();\n return;\n }\n if (isHeadersLike(this.headersInit)) {\n yield* this.headersInit.values();\n return;\n }\n yield* Object.values(this.headersInit)[Symbol.iterator]();\n return;\n }\n }\n yield* this.getMap().values();\n }\n values() {\n return new IteratorObject_js_1.PonyfillIteratorObject(this._values(), "HeadersIterator");\n }\n *_entries() {\n if (this._setCookies?.length) {\n yield* this._setCookies.map((cookie) => ["set-cookie", cookie]);\n }\n if (!this._map) {\n if (this.headersInit) {\n if (Array.isArray(this.headersInit)) {\n yield* this.headersInit;\n return;\n }\n if (isHeadersLike(this.headersInit)) {\n yield* this.headersInit.entries();\n return;\n }\n yield* Object.entries(this.headersInit);\n return;\n }\n }\n yield* this.getMap().entries();\n }\n entries() {\n return new IteratorObject_js_1.PonyfillIteratorObject(this._entries(), "HeadersIterator");\n }\n getSetCookie() {\n if (!this._setCookies) {\n this.getMap();\n }\n return this._setCookies;\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n [Symbol.for("nodejs.util.inspect.custom")]() {\n const record = {};\n this.forEach((value, key) => {\n if (key === "set-cookie") {\n record["set-cookie"] = this._setCookies || [];\n } else {\n record[key] = value?.includes(",") ? value.split(",").map((el) => el.trim()) : value;\n }\n });\n return `Headers ${(0, node_util_1.inspect)(record)}`;\n }\n }\n exports.PonyfillHeaders = PonyfillHeaders;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/Response.js\nvar require_Response = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillResponse = undefined;\n var node_http_1 = __require("node:http");\n var Body_js_1 = require_Body();\n var Headers_js_1 = require_Headers();\n var JSON_CONTENT_TYPE = "application/json; charset=utf-8";\n\n class PonyfillResponse extends Body_js_1.PonyfillBody {\n headers;\n constructor(body, init) {\n super(body || null, init);\n this.headers = init?.headers && (0, Headers_js_1.isHeadersLike)(init.headers) ? init.headers : new Headers_js_1.PonyfillHeaders(init?.headers);\n this.status = init?.status || 200;\n this.statusText = init?.statusText || node_http_1.STATUS_CODES[this.status] || "OK";\n this.url = init?.url || "";\n this.redirected = init?.redirected || false;\n this.type = init?.type || "default";\n this.handleContentLengthHeader();\n }\n get ok() {\n return this.status >= 200 && this.status < 300;\n }\n status;\n statusText;\n url;\n redirected;\n type;\n clone() {\n return this;\n }\n static error() {\n return new PonyfillResponse(null, {\n status: 500,\n statusText: "Internal Server Error"\n });\n }\n static redirect(url, status = 302) {\n if (status < 300 || status > 399) {\n throw new RangeError("Invalid status code");\n }\n return new PonyfillResponse(null, {\n headers: {\n location: url\n },\n status\n });\n }\n static json(data, init) {\n const bodyInit = JSON.stringify(data);\n if (!init) {\n init = {\n headers: {\n "content-type": JSON_CONTENT_TYPE,\n "content-length": Buffer.byteLength(bodyInit).toString()\n }\n };\n } else if (!init.headers) {\n init.headers = {\n "content-type": JSON_CONTENT_TYPE,\n "content-length": Buffer.byteLength(bodyInit).toString()\n };\n } else if ((0, Headers_js_1.isHeadersLike)(init.headers)) {\n if (!init.headers.has("content-type")) {\n init.headers.set("content-type", JSON_CONTENT_TYPE);\n }\n if (!init.headers.has("content-length")) {\n init.headers.set("content-length", Buffer.byteLength(bodyInit).toString());\n }\n } else if (Array.isArray(init.headers)) {\n let contentTypeExists = false;\n let contentLengthExists = false;\n for (const [key] of init.headers) {\n if (contentLengthExists && contentTypeExists) {\n break;\n }\n if (!contentTypeExists && key.toLowerCase() === "content-type") {\n contentTypeExists = true;\n } else if (!contentLengthExists && key.toLowerCase() === "content-length") {\n contentLengthExists = true;\n }\n }\n if (!contentTypeExists) {\n init.headers.push(["content-type", JSON_CONTENT_TYPE]);\n }\n if (!contentLengthExists) {\n init.headers.push(["content-length", Buffer.byteLength(bodyInit).toString()]);\n }\n } else if (typeof init.headers === "object") {\n if (init.headers?.["content-type"] == null) {\n init.headers["content-type"] = JSON_CONTENT_TYPE;\n }\n if (init.headers?.["content-length"] == null) {\n init.headers["content-length"] = Buffer.byteLength(bodyInit).toString();\n }\n }\n return new PonyfillResponse(bodyInit, init);\n }\n [Symbol.toStringTag] = "Response";\n }\n exports.PonyfillResponse = PonyfillResponse;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/fetchCurl.js\nvar require_fetchCurl = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.fetchCurl = fetchCurl;\n var node_stream_1 = __require("node:stream");\n var node_tls_1 = __require("node:tls");\n var promise_helpers_1 = require_cjs();\n var Response_js_1 = require_Response();\n var utils_js_1 = require_utils();\n function fetchCurl(fetchRequest) {\n const { Curl, CurlFeature, CurlPause, CurlProgressFunc } = globalThis["libcurl"];\n const curlHandle = new Curl;\n curlHandle.enable(CurlFeature.NoDataParsing);\n curlHandle.setOpt("URL", fetchRequest.url);\n if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === "0") {\n curlHandle.setOpt("SSL_VERIFYPEER", false);\n }\n if (process.env.NODE_EXTRA_CA_CERTS) {\n curlHandle.setOpt("CAINFO", process.env.NODE_EXTRA_CA_CERTS);\n } else {\n curlHandle.setOpt("CAINFO_BLOB", node_tls_1.rootCertificates.join(`\n`));\n }\n curlHandle.enable(CurlFeature.StreamResponse);\n let signal;\n if (fetchRequest._signal === null) {\n signal = undefined;\n } else if (fetchRequest._signal) {\n signal = fetchRequest._signal;\n }\n curlHandle.setStreamProgressCallback(function() {\n return signal?.aborted ? process.env.DEBUG ? CurlProgressFunc.Continue : 1 : 0;\n });\n if (fetchRequest["bodyType"] === "String") {\n curlHandle.setOpt("POSTFIELDS", fetchRequest["bodyInit"]);\n } else {\n const nodeReadable = fetchRequest.body != null ? (0, utils_js_1.isNodeReadable)(fetchRequest.body) ? fetchRequest.body : node_stream_1.Readable.from(fetchRequest.body) : null;\n if (nodeReadable) {\n curlHandle.setOpt("UPLOAD", true);\n curlHandle.setUploadStream(nodeReadable);\n }\n }\n if (process.env.DEBUG) {\n curlHandle.setOpt("VERBOSE", true);\n }\n curlHandle.setOpt("TRANSFER_ENCODING", false);\n curlHandle.setOpt("HTTP_TRANSFER_DECODING", true);\n curlHandle.setOpt("FOLLOWLOCATION", fetchRequest.redirect === "follow");\n curlHandle.setOpt("MAXREDIRS", 20);\n curlHandle.setOpt("ACCEPT_ENCODING", "");\n curlHandle.setOpt("CUSTOMREQUEST", fetchRequest.method);\n const headersSerializer = fetchRequest.headersSerializer || utils_js_1.defaultHeadersSerializer;\n let size;\n const curlHeaders = headersSerializer(fetchRequest.headers, (value) => {\n size = Number(value);\n });\n if (size != null) {\n curlHandle.setOpt("INFILESIZE", size);\n }\n curlHandle.setOpt("HTTPHEADER", curlHeaders);\n curlHandle.enable(CurlFeature.NoHeaderParsing);\n const deferredPromise = (0, promise_helpers_1.createDeferredPromise)();\n let streamResolved;\n function onAbort() {\n if (curlHandle.isOpen) {\n try {\n curlHandle.pause(CurlPause.Recv);\n } catch (e) {\n deferredPromise.reject(e);\n }\n }\n }\n signal?.addEventListener("abort", onAbort, { once: true });\n curlHandle.once("end", function endListener() {\n try {\n curlHandle.close();\n } catch (e) {\n deferredPromise.reject(e);\n }\n signal?.removeEventListener("abort", onAbort);\n });\n curlHandle.once("error", function errorListener(error) {\n if (streamResolved && !streamResolved.closed && !streamResolved.destroyed) {\n streamResolved.destroy(error);\n } else {\n if (error.message === "Operation was aborted by an application callback") {\n error.message = "The operation was aborted.";\n }\n deferredPromise.reject(error);\n }\n try {\n curlHandle.close();\n } catch (e) {\n deferredPromise.reject(e);\n }\n });\n curlHandle.once("stream", function streamListener(stream, status, headersBuf) {\n const outputStream = stream.pipe(new node_stream_1.PassThrough, {\n end: true\n });\n const headersFlat = headersBuf.toString("utf8").split(/\\r?\\n|\\r/g).filter((headerFilter) => {\n if (headerFilter && !headerFilter.startsWith("HTTP/")) {\n if (fetchRequest.redirect === "error" && headerFilter.toLowerCase().includes("location") && (0, utils_js_1.shouldRedirect)(status)) {\n if (!stream.destroyed) {\n stream.resume();\n }\n outputStream.destroy();\n deferredPromise.reject(new Error("redirect is not allowed"));\n }\n return true;\n }\n return false;\n });\n const headersInit = headersFlat.map((headerFlat) => headerFlat.split(/:\\s(.+)/).slice(0, 2));\n const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream, {\n status,\n headers: headersInit,\n url: curlHandle.getInfo(Curl.info.REDIRECT_URL)?.toString() || fetchRequest.url,\n redirected: Number(curlHandle.getInfo(Curl.info.REDIRECT_COUNT)) > 0\n });\n deferredPromise.resolve(ponyfillResponse);\n streamResolved = outputStream;\n });\n setImmediate(() => {\n curlHandle.perform();\n });\n return deferredPromise.promise;\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/URL.js\nvar require_URL = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillURL = undefined;\n var tslib_1 = require_tslib();\n var node_buffer_1 = tslib_1.__importDefault(__require("node:buffer"));\n var node_crypto_1 = __require("node:crypto");\n var NativeURL = globalThis.URL;\n\n class URL2 extends NativeURL {\n static blobRegistry = new Map;\n static createObjectURL(blob) {\n const blobUrl = `blob:whatwgnode:${(0, node_crypto_1.randomUUID)()}`;\n this.blobRegistry.set(blobUrl, blob);\n return blobUrl;\n }\n static revokeObjectURL(url) {\n if (!this.blobRegistry.has(url)) {\n NativeURL.revokeObjectURL(url);\n } else {\n this.blobRegistry.delete(url);\n }\n }\n static getBlobFromURL(url) {\n return this.blobRegistry.get(url) || node_buffer_1.default?.resolveObjectURL?.(url);\n }\n }\n exports.PonyfillURL = URL2;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/Request.js\nvar require_Request = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillRequest = undefined;\n var node_http_1 = __require("node:http");\n var node_https_1 = __require("node:https");\n var Body_js_1 = require_Body();\n var Headers_js_1 = require_Headers();\n var URL_js_1 = require_URL();\n function isRequest(input) {\n return input[Symbol.toStringTag] === "Request";\n }\n function isURL(obj) {\n return obj?.href != null;\n }\n\n class PonyfillRequest extends Body_js_1.PonyfillBody {\n constructor(input, options) {\n let _url;\n let _parsedUrl;\n let bodyInit = null;\n let requestInit;\n if (typeof input === "string") {\n _url = input;\n } else if (isURL(input)) {\n _parsedUrl = input;\n } else if (isRequest(input)) {\n if (input._parsedUrl) {\n _parsedUrl = input._parsedUrl;\n } else if (input._url) {\n _url = input._url;\n } else {\n _url = input.url;\n }\n bodyInit = input.body;\n requestInit = input;\n }\n if (options != null) {\n bodyInit = options.body || null;\n requestInit = options;\n }\n super(bodyInit, requestInit);\n this._url = _url;\n this._parsedUrl = _parsedUrl;\n this.cache = requestInit?.cache || "default";\n this.credentials = requestInit?.credentials || "same-origin";\n this.headers = requestInit?.headers && (0, Headers_js_1.isHeadersLike)(requestInit.headers) ? requestInit.headers : new Headers_js_1.PonyfillHeaders(requestInit?.headers);\n this.integrity = requestInit?.integrity || "";\n this.keepalive = requestInit?.keepalive != null ? requestInit?.keepalive : false;\n this.method = requestInit?.method?.toUpperCase() || "GET";\n this.mode = requestInit?.mode || "cors";\n this.redirect = requestInit?.redirect || "follow";\n this.referrer = requestInit?.referrer || "about:client";\n this.referrerPolicy = requestInit?.referrerPolicy || "no-referrer";\n this.headersSerializer = requestInit?.headersSerializer;\n this.duplex = requestInit?.duplex || "half";\n this.destination = "document";\n this.priority = "auto";\n if (this.method !== "GET" && this.method !== "HEAD") {\n this.handleContentLengthHeader(true);\n }\n if (requestInit?.agent != null) {\n const protocol = _parsedUrl?.protocol || _url || this.url;\n if (requestInit.agent === false) {\n this.agent = false;\n } else if (protocol.startsWith("http:") && requestInit.agent instanceof node_http_1.Agent) {\n this.agent = requestInit.agent;\n } else if (protocol.startsWith("https:") && requestInit.agent instanceof node_https_1.Agent) {\n this.agent = requestInit.agent;\n }\n }\n }\n headersSerializer;\n cache;\n credentials;\n destination;\n headers;\n integrity;\n keepalive;\n method;\n mode;\n priority;\n redirect;\n referrer;\n referrerPolicy;\n _url;\n get signal() {\n this._signal ||= new AbortController().signal;\n return this._signal;\n }\n get url() {\n if (this._url == null) {\n if (this._parsedUrl) {\n this._url = this._parsedUrl.toString();\n } else {\n throw new TypeError("Invalid URL");\n }\n }\n return this._url;\n }\n _parsedUrl;\n get parsedUrl() {\n if (this._parsedUrl == null) {\n if (this._url != null) {\n this._parsedUrl = new URL_js_1.PonyfillURL(this._url, "http://localhost");\n } else {\n throw new TypeError("Invalid URL");\n }\n }\n return this._parsedUrl;\n }\n duplex;\n agent;\n clone() {\n return this;\n }\n [Symbol.toStringTag] = "Request";\n }\n exports.PonyfillRequest = PonyfillRequest;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/fetchNodeHttp.js\nvar require_fetchNodeHttp = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.fetchNodeHttp = fetchNodeHttp;\n var node_http_1 = __require("node:http");\n var node_https_1 = __require("node:https");\n var node_stream_1 = __require("node:stream");\n var node_zlib_1 = __require("node:zlib");\n var promise_helpers_1 = require_cjs();\n var Request_js_1 = require_Request();\n var Response_js_1 = require_Response();\n var URL_js_1 = require_URL();\n var utils_js_1 = require_utils();\n function getRequestFnForProtocol(url) {\n if (url.startsWith("http:")) {\n return node_http_1.request;\n } else if (url.startsWith("https:")) {\n return node_https_1.request;\n }\n throw new Error(`Unsupported protocol: ${url.split(":")[0] || url}`);\n }\n function fetchNodeHttp(fetchRequest) {\n return new Promise((resolve, reject) => {\n try {\n const requestFn = getRequestFnForProtocol(fetchRequest.parsedUrl?.protocol || fetchRequest.url);\n const headersSerializer = fetchRequest.headersSerializer || utils_js_1.getHeadersObj;\n const nodeHeaders = headersSerializer(fetchRequest.headers);\n nodeHeaders["accept-encoding"] ||= "gzip, deflate, br";\n nodeHeaders["user-agent"] ||= "node";\n let signal;\n if (fetchRequest._signal == null) {\n signal = undefined;\n } else if (fetchRequest._signal) {\n signal = fetchRequest._signal;\n }\n let nodeRequest;\n if (fetchRequest.parsedUrl) {\n nodeRequest = requestFn(fetchRequest.parsedUrl, {\n method: fetchRequest.method,\n headers: nodeHeaders,\n signal,\n agent: fetchRequest.agent\n });\n } else {\n nodeRequest = requestFn(fetchRequest.url, {\n method: fetchRequest.method,\n headers: nodeHeaders,\n signal,\n agent: fetchRequest.agent\n });\n }\n nodeRequest.once("error", reject);\n nodeRequest.once("response", (nodeResponse) => {\n let outputStream;\n const contentEncoding = nodeResponse.headers["content-encoding"];\n switch (contentEncoding) {\n case "x-gzip":\n case "gzip":\n outputStream = (0, node_zlib_1.createGunzip)();\n break;\n case "x-deflate":\n case "deflate":\n outputStream = (0, node_zlib_1.createInflate)();\n break;\n case "x-deflate-raw":\n case "deflate-raw":\n outputStream = (0, node_zlib_1.createInflateRaw)();\n break;\n case "br":\n outputStream = (0, node_zlib_1.createBrotliDecompress)();\n break;\n }\n if (nodeResponse.headers.location && (0, utils_js_1.shouldRedirect)(nodeResponse.statusCode)) {\n if (fetchRequest.redirect === "error") {\n const redirectError = new Error("Redirects are not allowed");\n reject(redirectError);\n nodeResponse.resume();\n return;\n }\n if (fetchRequest.redirect === "follow") {\n const redirectedUrl = new URL_js_1.PonyfillURL(nodeResponse.headers.location, fetchRequest.parsedUrl || fetchRequest.url);\n const redirectResponse$ = fetchNodeHttp(new Request_js_1.PonyfillRequest(redirectedUrl, fetchRequest));\n resolve(redirectResponse$.then((redirectResponse) => {\n redirectResponse.redirected = true;\n return redirectResponse;\n }));\n nodeResponse.resume();\n return;\n }\n }\n outputStream ||= new node_stream_1.PassThrough;\n (0, utils_js_1.pipeThrough)({\n src: nodeResponse,\n dest: outputStream,\n signal,\n onError: (e) => {\n if (!nodeResponse.destroyed) {\n nodeResponse.destroy(e);\n }\n if (!outputStream.destroyed) {\n outputStream.destroy(e);\n }\n reject(e);\n }\n });\n const statusCode = nodeResponse.statusCode || 200;\n let statusText = nodeResponse.statusMessage || node_http_1.STATUS_CODES[statusCode];\n if (statusText == null) {\n statusText = "";\n }\n const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream || nodeResponse, {\n status: statusCode,\n statusText,\n headers: nodeResponse.headers,\n url: fetchRequest.url,\n signal\n });\n resolve(ponyfillResponse);\n });\n if (fetchRequest["_buffer"] != null) {\n (0, promise_helpers_1.handleMaybePromise)(() => (0, utils_js_1.safeWrite)(fetchRequest["_buffer"], nodeRequest), () => (0, utils_js_1.endStream)(nodeRequest), reject);\n } else {\n const nodeReadable = fetchRequest.body != null ? (0, utils_js_1.isNodeReadable)(fetchRequest.body) ? fetchRequest.body : node_stream_1.Readable.from(fetchRequest.body) : null;\n if (nodeReadable) {\n nodeReadable.pipe(nodeRequest);\n } else {\n (0, utils_js_1.endStream)(nodeRequest);\n }\n }\n } catch (e) {\n reject(e);\n }\n });\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/fetch.js\nvar require_fetch = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.fetchPonyfill = fetchPonyfill;\n var node_buffer_1 = __require("node:buffer");\n var node_fs_1 = __require("node:fs");\n var node_url_1 = __require("node:url");\n var fetchCurl_js_1 = require_fetchCurl();\n var fetchNodeHttp_js_1 = require_fetchNodeHttp();\n var Request_js_1 = require_Request();\n var Response_js_1 = require_Response();\n var URL_js_1 = require_URL();\n var utils_js_1 = require_utils();\n var BASE64_SUFFIX = ";base64";\n async function getResponseForFile(url) {\n const path = (0, node_url_1.fileURLToPath)(url);\n try {\n await node_fs_1.promises.access(path, node_fs_1.promises.constants.R_OK);\n const stats = await node_fs_1.promises.stat(path, {\n bigint: true\n });\n const readable = (0, node_fs_1.createReadStream)(path);\n return new Response_js_1.PonyfillResponse(readable, {\n status: 200,\n statusText: "OK",\n headers: {\n "content-type": "application/octet-stream",\n "last-modified": stats.mtime.toUTCString()\n }\n });\n } catch (err) {\n if (err.code === "ENOENT") {\n return new Response_js_1.PonyfillResponse(null, {\n status: 404,\n statusText: "Not Found"\n });\n } else if (err.code === "EACCES") {\n return new Response_js_1.PonyfillResponse(null, {\n status: 403,\n statusText: "Forbidden"\n });\n }\n throw err;\n }\n }\n function getResponseForDataUri(url) {\n const [mimeType = "text/plain", ...datas] = url.substring(5).split(",");\n const data = decodeURIComponent(datas.join(","));\n if (mimeType.endsWith(BASE64_SUFFIX)) {\n const buffer = node_buffer_1.Buffer.from(data, "base64url");\n const realMimeType = mimeType.slice(0, -BASE64_SUFFIX.length);\n return new Response_js_1.PonyfillResponse(buffer, {\n status: 200,\n statusText: "OK",\n headers: {\n "content-type": realMimeType\n }\n });\n }\n return new Response_js_1.PonyfillResponse(data, {\n status: 200,\n statusText: "OK",\n headers: {\n "content-type": mimeType\n }\n });\n }\n function getResponseForBlob(url) {\n const blob = URL_js_1.PonyfillURL.getBlobFromURL(url);\n if (!blob) {\n throw new TypeError("Invalid Blob URL");\n }\n return new Response_js_1.PonyfillResponse(blob, {\n status: 200,\n headers: {\n "content-type": blob.type,\n "content-length": blob.size.toString()\n }\n });\n }\n function isURL(obj) {\n return obj != null && obj.href != null;\n }\n function fetchPonyfill(info, init) {\n if (typeof info === "string" || isURL(info)) {\n const ponyfillRequest = new Request_js_1.PonyfillRequest(info, init);\n return fetchPonyfill(ponyfillRequest);\n }\n const fetchRequest = info;\n if (fetchRequest.url.startsWith("data:")) {\n const response = getResponseForDataUri(fetchRequest.url);\n return (0, utils_js_1.fakePromise)(response);\n }\n if (fetchRequest.url.startsWith("file:")) {\n const response = getResponseForFile(fetchRequest.url);\n return response;\n }\n if (fetchRequest.url.startsWith("blob:")) {\n const response = getResponseForBlob(fetchRequest.url);\n return (0, utils_js_1.fakePromise)(response);\n }\n if (globalThis.libcurl && !fetchRequest.agent) {\n return (0, fetchCurl_js_1.fetchCurl)(fetchRequest);\n }\n return (0, fetchNodeHttp_js_1.fetchNodeHttp)(fetchRequest);\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/TextEncoderDecoder.js\nvar require_TextEncoderDecoder = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillTextDecoder = exports.PonyfillTextEncoder = undefined;\n exports.PonyfillBtoa = PonyfillBtoa;\n var node_buffer_1 = __require("node:buffer");\n var utils_js_1 = require_utils();\n\n class PonyfillTextEncoder {\n encoding;\n constructor(encoding = "utf-8") {\n this.encoding = encoding;\n }\n encode(input) {\n return node_buffer_1.Buffer.from(input, this.encoding);\n }\n encodeInto(source, destination) {\n const buffer = this.encode(source);\n const copied = buffer.copy(destination);\n return {\n read: copied,\n written: copied\n };\n }\n }\n exports.PonyfillTextEncoder = PonyfillTextEncoder;\n\n class PonyfillTextDecoder {\n encoding;\n fatal = false;\n ignoreBOM = false;\n constructor(encoding = "utf-8", options) {\n this.encoding = encoding;\n if (options) {\n this.fatal = options.fatal || false;\n this.ignoreBOM = options.ignoreBOM || false;\n }\n }\n decode(input) {\n if (node_buffer_1.Buffer.isBuffer(input)) {\n return input.toString(this.encoding);\n }\n if ((0, utils_js_1.isArrayBufferView)(input)) {\n return node_buffer_1.Buffer.from(input.buffer, input.byteOffset, input.byteLength).toString(this.encoding);\n }\n return node_buffer_1.Buffer.from(input).toString(this.encoding);\n }\n }\n exports.PonyfillTextDecoder = PonyfillTextDecoder;\n function PonyfillBtoa(input) {\n return node_buffer_1.Buffer.from(input, "binary").toString("base64");\n }\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/URLSearchParams.js\nvar require_URLSearchParams = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillURLSearchParams = undefined;\n exports.PonyfillURLSearchParams = globalThis.URLSearchParams;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/WritableStream.js\nvar require_WritableStream = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillWritableStream = undefined;\n var node_events_1 = __require("node:events");\n var node_stream_1 = __require("node:stream");\n var promise_helpers_1 = require_cjs();\n var utils_js_1 = require_utils();\n\n class PonyfillWritableStream {\n writable;\n constructor(underlyingSink) {\n if (underlyingSink instanceof node_stream_1.Writable) {\n this.writable = underlyingSink;\n } else if (underlyingSink) {\n const writable = new node_stream_1.Writable({\n write(chunk, _encoding, callback) {\n try {\n const result = underlyingSink.write?.(chunk, controller);\n if (result instanceof Promise) {\n result.then(() => {\n callback();\n }, (err) => {\n callback(err);\n });\n } else {\n callback();\n }\n } catch (err) {\n callback(err);\n }\n },\n final(callback) {\n const result = underlyingSink.close?.();\n if (result instanceof Promise) {\n result.then(() => {\n callback();\n }, (err) => {\n callback(err);\n });\n } else {\n callback();\n }\n }\n });\n this.writable = writable;\n const abortCtrl = new AbortController;\n const controller = {\n signal: abortCtrl.signal,\n error(e) {\n writable.destroy(e);\n }\n };\n writable.once("error", (err) => abortCtrl.abort(err));\n writable.once("close", () => abortCtrl.abort());\n } else {\n this.writable = new node_stream_1.Writable;\n }\n }\n getWriter() {\n const writable = this.writable;\n return {\n get closed() {\n return (0, node_events_1.once)(writable, "close");\n },\n get desiredSize() {\n return writable.writableLength;\n },\n get ready() {\n return (0, node_events_1.once)(writable, "drain");\n },\n releaseLock() {},\n write(chunk) {\n const promise = (0, utils_js_1.fakePromise)();\n if (chunk == null) {\n return promise;\n }\n return promise.then(() => (0, utils_js_1.safeWrite)(chunk, writable));\n },\n close() {\n if (!writable.errored && writable.closed) {\n return (0, utils_js_1.fakePromise)();\n }\n if (writable.errored) {\n return (0, promise_helpers_1.fakeRejectPromise)(writable.errored);\n }\n return (0, utils_js_1.fakePromise)().then(() => (0, utils_js_1.endStream)(writable));\n },\n abort(reason) {\n writable.destroy(reason);\n return (0, node_events_1.once)(writable, "close");\n }\n };\n }\n close() {\n if (!this.writable.errored && this.writable.closed) {\n return (0, utils_js_1.fakePromise)();\n }\n if (this.writable.errored) {\n return (0, promise_helpers_1.fakeRejectPromise)(this.writable.errored);\n }\n return (0, utils_js_1.fakePromise)().then(() => (0, utils_js_1.endStream)(this.writable));\n }\n abort(reason) {\n this.writable.destroy(reason);\n return (0, node_events_1.once)(this.writable, "close");\n }\n locked = false;\n }\n exports.PonyfillWritableStream = PonyfillWritableStream;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/TransformStream.js\nvar require_TransformStream = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillTransformStream = undefined;\n var node_stream_1 = __require("node:stream");\n var ReadableStream_js_1 = require_ReadableStream();\n var utils_js_1 = require_utils();\n var WritableStream_js_1 = require_WritableStream();\n\n class PonyfillTransformStream {\n transform;\n writable;\n readable;\n constructor(transformer) {\n if (transformer instanceof node_stream_1.Transform) {\n this.transform = transformer;\n } else if (transformer) {\n const controller = {\n enqueue(chunk) {\n transform.push(chunk);\n },\n error(reason) {\n transform.destroy(reason);\n },\n terminate() {\n (0, utils_js_1.endStream)(transform);\n },\n get desiredSize() {\n return transform.writableLength;\n }\n };\n const transform = new node_stream_1.Transform({\n read() {},\n write(chunk, _encoding, callback) {\n try {\n const result = transformer.transform?.(chunk, controller);\n if (result instanceof Promise) {\n result.then(() => {\n callback();\n }, (err) => {\n callback(err);\n });\n } else {\n callback();\n }\n } catch (err) {\n callback(err);\n }\n },\n final(callback) {\n try {\n const result = transformer.flush?.(controller);\n if (result instanceof Promise) {\n result.then(() => {\n callback();\n }, (err) => {\n callback(err);\n });\n } else {\n callback();\n }\n } catch (err) {\n callback(err);\n }\n }\n });\n this.transform = transform;\n } else {\n this.transform = new node_stream_1.Transform;\n }\n this.writable = new WritableStream_js_1.PonyfillWritableStream(this.transform);\n this.readable = new ReadableStream_js_1.PonyfillReadableStream(this.transform);\n }\n }\n exports.PonyfillTransformStream = PonyfillTransformStream;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/CompressionStream.js\nvar require_CompressionStream = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillCompressionStream = undefined;\n var node_zlib_1 = __require("node:zlib");\n var TransformStream_js_1 = require_TransformStream();\n\n class PonyfillCompressionStream extends TransformStream_js_1.PonyfillTransformStream {\n static supportedFormats = globalThis.process?.version?.startsWith("v2") ? ["gzip", "deflate", "br"] : ["gzip", "deflate", "deflate-raw", "br"];\n constructor(compressionFormat) {\n switch (compressionFormat) {\n case "x-gzip":\n case "gzip":\n super((0, node_zlib_1.createGzip)());\n break;\n case "x-deflate":\n case "deflate":\n super((0, node_zlib_1.createDeflate)());\n break;\n case "deflate-raw":\n super((0, node_zlib_1.createDeflateRaw)());\n break;\n case "br":\n super((0, node_zlib_1.createBrotliCompress)());\n break;\n default:\n throw new Error(`Unsupported compression format: ${compressionFormat}`);\n }\n }\n }\n exports.PonyfillCompressionStream = PonyfillCompressionStream;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/DecompressionStream.js\nvar require_DecompressionStream = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillDecompressionStream = undefined;\n var node_zlib_1 = __require("node:zlib");\n var TransformStream_js_1 = require_TransformStream();\n\n class PonyfillDecompressionStream extends TransformStream_js_1.PonyfillTransformStream {\n static supportedFormats = globalThis.process?.version?.startsWith("v2") ? ["gzip", "deflate", "br"] : ["gzip", "deflate", "deflate-raw", "br"];\n constructor(compressionFormat) {\n switch (compressionFormat) {\n case "x-gzip":\n case "gzip":\n super((0, node_zlib_1.createGunzip)());\n break;\n case "x-deflate":\n case "deflate":\n super((0, node_zlib_1.createInflate)());\n break;\n case "deflate-raw":\n super((0, node_zlib_1.createInflateRaw)());\n break;\n case "br":\n super((0, node_zlib_1.createBrotliDecompress)());\n break;\n default:\n throw new TypeError(`Unsupported compression format: \'${compressionFormat}\'`);\n }\n }\n }\n exports.PonyfillDecompressionStream = PonyfillDecompressionStream;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/TextEncoderDecoderStream.js\nvar require_TextEncoderDecoderStream = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.PonyfillTextEncoderStream = exports.PonyfillTextDecoderStream = undefined;\n var TextEncoderDecoder_js_1 = require_TextEncoderDecoder();\n var TransformStream_js_1 = require_TransformStream();\n\n class PonyfillTextDecoderStream extends TransformStream_js_1.PonyfillTransformStream {\n textDecoder;\n constructor(encoding, options) {\n super({\n transform: (chunk, controller) => controller.enqueue(this.textDecoder.decode(chunk, { stream: true }))\n });\n this.textDecoder = new TextEncoderDecoder_js_1.PonyfillTextDecoder(encoding, options);\n }\n get encoding() {\n return this.textDecoder.encoding;\n }\n get fatal() {\n return this.textDecoder.fatal;\n }\n get ignoreBOM() {\n return this.textDecoder.ignoreBOM;\n }\n }\n exports.PonyfillTextDecoderStream = PonyfillTextDecoderStream;\n\n class PonyfillTextEncoderStream extends TransformStream_js_1.PonyfillTransformStream {\n textEncoder;\n constructor(encoding) {\n super({\n transform: (chunk, controller) => controller.enqueue(this.textEncoder.encode(chunk))\n });\n this.textEncoder = new TextEncoderDecoder_js_1.PonyfillTextEncoder(encoding);\n }\n get encoding() {\n return this.textEncoder.encoding;\n }\n encode(input) {\n return this.textEncoder.encode(input);\n }\n }\n exports.PonyfillTextEncoderStream = PonyfillTextEncoderStream;\n});\n\n// ../../node_modules/@whatwg-node/node-fetch/cjs/index.js\nvar require_cjs3 = __commonJS((exports) => {\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.TextEncoderStream = exports.TextDecoderStream = exports.IteratorObject = exports.DecompressionStream = exports.CompressionStream = exports.TransformStream = exports.WritableStream = exports.URLSearchParams = exports.URL = exports.btoa = exports.TextDecoder = exports.TextEncoder = exports.Blob = exports.FormData = exports.File = exports.ReadableStream = exports.Response = exports.Request = exports.Body = exports.Headers = exports.fetch = undefined;\n var fetch_js_1 = require_fetch();\n Object.defineProperty(exports, "fetch", { enumerable: true, get: function() {\n return fetch_js_1.fetchPonyfill;\n } });\n var Headers_js_1 = require_Headers();\n Object.defineProperty(exports, "Headers", { enumerable: true, get: function() {\n return Headers_js_1.PonyfillHeaders;\n } });\n var Body_js_1 = require_Body();\n Object.defineProperty(exports, "Body", { enumerable: true, get: function() {\n return Body_js_1.PonyfillBody;\n } });\n var Request_js_1 = require_Request();\n Object.defineProperty(exports, "Request", { enumerable: true, get: function() {\n return Request_js_1.PonyfillRequest;\n } });\n var Response_js_1 = require_Response();\n Object.defineProperty(exports, "Response", { enumerable: true, get: function() {\n return Response_js_1.PonyfillResponse;\n } });\n var ReadableStream_js_1 = require_ReadableStream();\n Object.defineProperty(exports, "ReadableStream", { enumerable: true, get: function() {\n return ReadableStream_js_1.PonyfillReadableStream;\n } });\n var File_js_1 = require_File();\n Object.defineProperty(exports, "File", { enumerable: true, get: function() {\n return File_js_1.PonyfillFile;\n } });\n var FormData_js_1 = require_FormData();\n Object.defineProperty(exports, "FormData", { enumerable: true, get: function() {\n return FormData_js_1.PonyfillFormData;\n } });\n var Blob_js_1 = require_Blob();\n Object.defineProperty(exports, "Blob", { enumerable: true, get: function() {\n return Blob_js_1.PonyfillBlob;\n } });\n var TextEncoderDecoder_js_1 = require_TextEncoderDecoder();\n Object.defineProperty(exports, "TextEncoder", { enumerable: true, get: function() {\n return TextEncoderDecoder_js_1.PonyfillTextEncoder;\n } });\n Object.defineProperty(exports, "TextDecoder", { enumerable: true, get: function() {\n return TextEncoderDecoder_js_1.PonyfillTextDecoder;\n } });\n Object.defineProperty(exports, "btoa", { enumerable: true, get: function() {\n return TextEncoderDecoder_js_1.PonyfillBtoa;\n } });\n var URL_js_1 = require_URL();\n Object.defineProperty(exports, "URL", { enumerable: true, get: function() {\n return URL_js_1.PonyfillURL;\n } });\n var URLSearchParams_js_1 = require_URLSearchParams();\n Object.defineProperty(exports, "URLSearchParams", { enumerable: true, get: function() {\n return URLSearchParams_js_1.PonyfillURLSearchParams;\n } });\n var WritableStream_js_1 = require_WritableStream();\n Object.defineProperty(exports, "WritableStream", { enumerable: true, get: function() {\n return WritableStream_js_1.PonyfillWritableStream;\n } });\n var TransformStream_js_1 = require_TransformStream();\n Object.defineProperty(exports, "TransformStream", { enumerable: true, get: function() {\n return TransformStream_js_1.PonyfillTransformStream;\n } });\n var CompressionStream_js_1 = require_CompressionStream();\n Object.defineProperty(exports, "CompressionStream", { enumerable: true, get: function() {\n return CompressionStream_js_1.PonyfillCompressionStream;\n } });\n var DecompressionStream_js_1 = require_DecompressionStream();\n Object.defineProperty(exports, "DecompressionStream", { enumerable: true, get: function() {\n return DecompressionStream_js_1.PonyfillDecompressionStream;\n } });\n var IteratorObject_js_1 = require_IteratorObject();\n Object.defineProperty(exports, "IteratorObject", { enumerable: true, get: function() {\n return IteratorObject_js_1.PonyfillIteratorObject;\n } });\n var TextEncoderDecoderStream_js_1 = require_TextEncoderDecoderStream();\n Object.defineProperty(exports, "TextDecoderStream", { enumerable: true, get: function() {\n return TextEncoderDecoderStream_js_1.PonyfillTextDecoderStream;\n } });\n Object.defineProperty(exports, "TextEncoderStream", { enumerable: true, get: function() {\n return TextEncoderDecoderStream_js_1.PonyfillTextEncoderStream;\n } });\n});\n\n// ../../node_modules/@whatwg-node/fetch/dist/create-node-ponyfill.js\nvar require_create_node_ponyfill = __commonJS((exports, module) => {\n var shouldSkipPonyfill = require_shouldSkipPonyfill();\n var newNodeFetch;\n module.exports = function createNodePonyfill(opts = {}) {\n const ponyfills = {};\n ponyfills.URLPattern = globalThis.URLPattern;\n if (!ponyfills.URLPattern) {\n const urlPatternModule = require_urlpattern_polyfill();\n ponyfills.URLPattern = urlPatternModule.URLPattern;\n }\n if (opts.skipPonyfill || shouldSkipPonyfill()) {\n return {\n fetch: globalThis.fetch,\n Headers: globalThis.Headers,\n Request: globalThis.Request,\n Response: globalThis.Response,\n FormData: globalThis.FormData,\n ReadableStream: globalThis.ReadableStream,\n WritableStream: globalThis.WritableStream,\n TransformStream: globalThis.TransformStream,\n CompressionStream: globalThis.CompressionStream,\n DecompressionStream: globalThis.DecompressionStream,\n TextDecoderStream: globalThis.TextDecoderStream,\n TextEncoderStream: globalThis.TextEncoderStream,\n Blob: globalThis.Blob,\n File: globalThis.File,\n crypto: globalThis.crypto,\n btoa: globalThis.btoa,\n TextEncoder: globalThis.TextEncoder,\n TextDecoder: globalThis.TextDecoder,\n URLPattern: ponyfills.URLPattern,\n URL: globalThis.URL,\n URLSearchParams: globalThis.URLSearchParams\n };\n }\n newNodeFetch ||= require_cjs3();\n ponyfills.fetch = newNodeFetch.fetch;\n ponyfills.Request = newNodeFetch.Request;\n ponyfills.Response = newNodeFetch.Response;\n ponyfills.Headers = newNodeFetch.Headers;\n ponyfills.FormData = newNodeFetch.FormData;\n ponyfills.ReadableStream = newNodeFetch.ReadableStream;\n ponyfills.URL = newNodeFetch.URL;\n ponyfills.URLSearchParams = newNodeFetch.URLSearchParams;\n ponyfills.WritableStream = newNodeFetch.WritableStream;\n ponyfills.TransformStream = newNodeFetch.TransformStream;\n ponyfills.CompressionStream = newNodeFetch.CompressionStream;\n ponyfills.DecompressionStream = newNodeFetch.DecompressionStream;\n ponyfills.TextDecoderStream = newNodeFetch.TextDecoderStream;\n ponyfills.TextEncoderStream = newNodeFetch.TextEncoderStream;\n ponyfills.Blob = newNodeFetch.Blob;\n ponyfills.File = newNodeFetch.File;\n ponyfills.crypto = globalThis.crypto;\n ponyfills.btoa = newNodeFetch.btoa;\n ponyfills.TextEncoder = newNodeFetch.TextEncoder;\n ponyfills.TextDecoder = newNodeFetch.TextDecoder;\n if (opts.formDataLimits) {\n ponyfills.Body = class Body extends newNodeFetch.Body {\n constructor(body, userOpts) {\n super(body, {\n formDataLimits: opts.formDataLimits,\n ...userOpts\n });\n }\n };\n ponyfills.Request = class Request2 extends newNodeFetch.Request {\n constructor(input, userOpts) {\n super(input, {\n formDataLimits: opts.formDataLimits,\n ...userOpts\n });\n }\n };\n ponyfills.Response = class Response2 extends newNodeFetch.Response {\n constructor(body, userOpts) {\n super(body, {\n formDataLimits: opts.formDataLimits,\n ...userOpts\n });\n }\n };\n }\n if (!ponyfills.crypto) {\n const cryptoModule = __require("crypto");\n ponyfills.crypto = cryptoModule.webcrypto;\n }\n return ponyfills;\n };\n});\n\n// src/types.ts\nvar BlinkInvocationTokenHeader = "x-blink-invocation-token";\nvar InternalAPIServerURLEnvironmentVariable = "INTERNAL_BLINK_API_SERVER_URL";\nvar InternalAPIServerListenPortEnvironmentVariable = "INTERNAL_BLINK_API_SERVER_LISTEN_PORT";\n\n// src/lambda/wrapper-lambda.ts\nimport { resolve } from "node:path";\nimport { Writable } from "node:stream";\n\n// src/server.ts\nimport { createServer, Server } from "node:http";\n\n// ../../node_modules/@whatwg-node/promise-helpers/esm/index.js\nvar kFakePromise = Symbol.for("@whatwg-node/promise-helpers/FakePromise");\nfunction isPromise(value) {\n return value?.then != null;\n}\nfunction isActualPromise(value) {\n const maybePromise = value;\n return maybePromise && maybePromise.then && maybePromise.catch && maybePromise.finally;\n}\nfunction handleMaybePromise(inputFactory, outputSuccessFactory, outputErrorFactory, finallyFactory) {\n let result$ = fakePromise().then(inputFactory).then(outputSuccessFactory, outputErrorFactory);\n if (finallyFactory) {\n result$ = result$.finally(finallyFactory);\n }\n return unfakePromise(result$);\n}\nfunction fakePromise(value) {\n if (value && isActualPromise(value)) {\n return value;\n }\n if (isPromise(value)) {\n return {\n then: (resolve, reject) => fakePromise(value.then(resolve, reject)),\n catch: (reject) => fakePromise(value.then((res) => res, reject)),\n finally: (cb) => fakePromise(cb ? promiseLikeFinally(value, cb) : value),\n [Symbol.toStringTag]: "Promise"\n };\n }\n return {\n then(resolve) {\n if (resolve) {\n try {\n return fakePromise(resolve(value));\n } catch (err) {\n return fakeRejectPromise(err);\n }\n }\n return this;\n },\n catch() {\n return this;\n },\n finally(cb) {\n if (cb) {\n try {\n return fakePromise(cb()).then(() => value, () => value);\n } catch (err) {\n return fakeRejectPromise(err);\n }\n }\n return this;\n },\n [Symbol.toStringTag]: "Promise",\n __fakePromiseValue: value,\n [kFakePromise]: "resolved"\n };\n}\nfunction createDeferredPromise() {\n if (Promise.withResolvers) {\n return Promise.withResolvers();\n }\n let resolveFn;\n let rejectFn;\n const promise = new Promise(function deferredPromiseExecutor(resolve, reject) {\n resolveFn = resolve;\n rejectFn = reject;\n });\n return {\n promise,\n get resolve() {\n return resolveFn;\n },\n get reject() {\n return rejectFn;\n }\n };\n}\nfunction iterateAsync(iterable, callback, results) {\n if (iterable?.length === 0) {\n return;\n }\n const iterator = iterable[Symbol.iterator]();\n let index = 0;\n function iterate() {\n const { done: endOfIterator, value } = iterator.next();\n if (endOfIterator) {\n return;\n }\n let endedEarly = false;\n function endEarly() {\n endedEarly = true;\n }\n return handleMaybePromise(function handleCallback() {\n return callback(value, endEarly, index++);\n }, function handleCallbackResult(result) {\n if (result) {\n results?.push(result);\n }\n if (endedEarly) {\n return;\n }\n return iterate();\n });\n }\n return iterate();\n}\nfunction fakeRejectPromise(error) {\n return {\n then(_resolve, reject) {\n if (reject) {\n try {\n return fakePromise(reject(error));\n } catch (err) {\n return fakeRejectPromise(err);\n }\n }\n return this;\n },\n catch(reject) {\n if (reject) {\n try {\n return fakePromise(reject(error));\n } catch (err) {\n return fakeRejectPromise(err);\n }\n }\n return this;\n },\n finally(cb) {\n if (cb) {\n try {\n cb();\n } catch (err) {\n return fakeRejectPromise(err);\n }\n }\n return this;\n },\n __fakeRejectError: error,\n [Symbol.toStringTag]: "Promise",\n [kFakePromise]: "rejected"\n };\n}\nfunction isFakePromise(value) {\n return value?.[kFakePromise] === "resolved";\n}\nfunction isFakeRejectPromise(value) {\n return value?.[kFakePromise] === "rejected";\n}\nfunction promiseLikeFinally(value, onFinally) {\n if ("finally" in value) {\n return value.finally(onFinally);\n }\n return value.then((res) => {\n const finallyRes = onFinally();\n return isPromise(finallyRes) ? finallyRes.then(() => res) : res;\n }, (err) => {\n const finallyRes = onFinally();\n if (isPromise(finallyRes)) {\n return finallyRes.then(() => {\n throw err;\n });\n } else {\n throw err;\n }\n });\n}\nfunction unfakePromise(promise) {\n if (isFakePromise(promise)) {\n return promise.__fakePromiseValue;\n }\n if (isFakeRejectPromise(promise)) {\n throw promise.__fakeRejectError;\n }\n return promise;\n}\n\n// ../../node_modules/@envelop/instrumentation/esm/instrumentation.js\nfunction chain(first, next) {\n const merged = { ...next, ...first };\n for (const key of Object.keys(merged)) {\n if (key in first && key in next) {\n merged[key] = (payload, wrapped) => first[key](payload, () => next[key](payload, wrapped));\n }\n }\n return merged;\n}\nvar getInstrumented = (payload) => ({\n fn(instrument, wrapped) {\n if (!instrument) {\n return wrapped;\n }\n return (...args) => {\n let result;\n instrument(payload, () => {\n result = wrapped(...args);\n });\n return result;\n };\n },\n asyncFn(instrument, wrapped) {\n if (!instrument) {\n return wrapped;\n }\n return (...args) => {\n let result;\n return handleMaybePromise(() => instrument(payload, () => {\n result = wrapped(...args);\n return isPromise(result) ? result.then(() => {\n return;\n }) : undefined;\n }), () => {\n return result;\n });\n };\n }\n});\n\n// ../../node_modules/@whatwg-node/disposablestack/esm/SupressedError.js\nclass PonyfillSuppressedError extends Error {\n error;\n suppressed;\n constructor(error, suppressed, message) {\n super(message);\n this.error = error;\n this.suppressed = suppressed;\n this.name = "SuppressedError";\n Error.captureStackTrace(this, this.constructor);\n }\n}\n\n// ../../node_modules/@whatwg-node/disposablestack/esm/symbols.js\nvar DisposableSymbols = {\n get dispose() {\n return Symbol.dispose || Symbol.for("dispose");\n },\n get asyncDispose() {\n return Symbol.asyncDispose || Symbol.for("asyncDispose");\n }\n};\n\n// ../../node_modules/@whatwg-node/disposablestack/esm/utils.js\nfunction isSyncDisposable(obj) {\n return obj?.[DisposableSymbols.dispose] != null;\n}\nfunction isAsyncDisposable(obj) {\n return obj?.[DisposableSymbols.asyncDispose] != null;\n}\n\n// ../../node_modules/@whatwg-node/disposablestack/esm/AsyncDisposableStack.js\nvar SuppressedError2 = globalThis.SuppressedError || PonyfillSuppressedError;\n\nclass PonyfillAsyncDisposableStack {\n callbacks = [];\n get disposed() {\n return this.callbacks.length === 0;\n }\n use(value) {\n if (isAsyncDisposable(value)) {\n this.callbacks.push(() => value[DisposableSymbols.asyncDispose]());\n } else if (isSyncDisposable(value)) {\n this.callbacks.push(() => value[DisposableSymbols.dispose]());\n }\n return value;\n }\n adopt(value, onDisposeAsync) {\n if (onDisposeAsync) {\n this.callbacks.push(() => onDisposeAsync(value));\n }\n return value;\n }\n defer(onDisposeAsync) {\n if (onDisposeAsync) {\n this.callbacks.push(onDisposeAsync);\n }\n }\n move() {\n const stack = new PonyfillAsyncDisposableStack;\n stack.callbacks = this.callbacks;\n this.callbacks = [];\n return stack;\n }\n disposeAsync() {\n return this[DisposableSymbols.asyncDispose]();\n }\n _error;\n _iterateCallbacks() {\n const cb = this.callbacks.pop();\n if (cb) {\n return handleMaybePromise(cb, () => this._iterateCallbacks(), (error) => {\n this._error = this._error ? new SuppressedError2(error, this._error) : error;\n return this._iterateCallbacks();\n });\n }\n }\n [DisposableSymbols.asyncDispose]() {\n const res$ = this._iterateCallbacks();\n if (res$?.then) {\n return res$.then(() => {\n if (this._error) {\n const error = this._error;\n this._error = undefined;\n throw error;\n }\n });\n }\n if (this._error) {\n const error = this._error;\n this._error = undefined;\n throw error;\n }\n return;\n }\n [Symbol.toStringTag] = "AsyncDisposableStack";\n}\n\n// ../../node_modules/@whatwg-node/disposablestack/esm/DisposableStack.js\nvar SuppressedError3 = globalThis.SuppressedError || PonyfillSuppressedError;\n\nclass PonyfillDisposableStack {\n callbacks = [];\n get disposed() {\n return this.callbacks.length === 0;\n }\n use(value) {\n if (isSyncDisposable(value)) {\n this.callbacks.push(() => value[DisposableSymbols.dispose]());\n }\n return value;\n }\n adopt(value, onDispose) {\n if (onDispose) {\n this.callbacks.push(() => onDispose(value));\n }\n return value;\n }\n defer(onDispose) {\n if (onDispose) {\n this.callbacks.push(onDispose);\n }\n }\n move() {\n const stack = new PonyfillDisposableStack;\n stack.callbacks = this.callbacks;\n this.callbacks = [];\n return stack;\n }\n dispose() {\n return this[DisposableSymbols.dispose]();\n }\n _error;\n _iterateCallbacks() {\n const cb = this.callbacks.pop();\n if (cb) {\n try {\n cb();\n } catch (error) {\n this._error = this._error ? new SuppressedError3(error, this._error) : error;\n }\n return this._iterateCallbacks();\n }\n }\n [DisposableSymbols.dispose]() {\n this._iterateCallbacks();\n if (this._error) {\n const error = this._error;\n this._error = undefined;\n throw error;\n }\n }\n [Symbol.toStringTag] = "DisposableStack";\n}\n\n// ../../node_modules/@whatwg-node/disposablestack/esm/index.js\nvar DisposableStack = globalThis.DisposableStack || PonyfillDisposableStack;\nvar AsyncDisposableStack = globalThis.AsyncDisposableStack || PonyfillAsyncDisposableStack;\nvar SuppressedError4 = globalThis.SuppressedError || PonyfillSuppressedError;\n\n// ../../node_modules/@whatwg-node/fetch/dist/node-ponyfill.js\nvar exports_node_ponyfill = {};\n__export(exports_node_ponyfill, {\n fetch: () => $fetch,\n crypto: () => $crypto,\n createFetch: () => $createFetch,\n btoa: () => $btoa,\n WritableStream: () => $WritableStream,\n URLSearchParams: () => $URLSearchParams,\n URLPattern: () => $URLPattern,\n URL: () => $URL,\n TransformStream: () => $TransformStream,\n TextEncoderStream: () => $TextEncoderStream,\n TextEncoder: () => $TextEncoder,\n TextDecoderStream: () => $TextDecoderStream,\n TextDecoder: () => $TextDecoder,\n Response: () => $Response,\n Request: () => $Request,\n ReadableStream: () => $ReadableStream,\n Headers: () => $Headers,\n FormData: () => $FormData,\n File: () => $File,\n DecompressionStream: () => $DecompressionStream,\n CompressionStream: () => $CompressionStream,\n Blob: () => $Blob\n});\nvar createNodePonyfill = require_create_node_ponyfill();\nvar shouldSkipPonyfill = require_shouldSkipPonyfill();\nvar ponyfills = createNodePonyfill();\nif (!shouldSkipPonyfill()) {\n try {\n const nodelibcurlName = "node-libcurl";\n globalThis.libcurl = globalThis.libcurl || __require(nodelibcurlName);\n } catch (e) {}\n}\nvar $fetch = ponyfills.fetch;\nvar $Headers = ponyfills.Headers;\nvar $Request = ponyfills.Request;\nvar $Response = ponyfills.Response;\nvar $FormData = ponyfills.FormData;\nvar $ReadableStream = ponyfills.ReadableStream;\nvar $WritableStream = ponyfills.WritableStream;\nvar $TransformStream = ponyfills.TransformStream;\nvar $CompressionStream = ponyfills.CompressionStream;\nvar $DecompressionStream = ponyfills.DecompressionStream;\nvar $TextDecoderStream = ponyfills.TextDecoderStream;\nvar $TextEncoderStream = ponyfills.TextEncoderStream;\nvar $Blob = ponyfills.Blob;\nvar $File = ponyfills.File;\nvar $crypto = ponyfills.crypto;\nvar $btoa = ponyfills.btoa;\nvar $TextEncoder = ponyfills.TextEncoder;\nvar $TextDecoder = ponyfills.TextDecoder;\nvar $URLPattern = ponyfills.URLPattern;\nvar $URL = ponyfills.URL;\nvar $URLSearchParams = ponyfills.URLSearchParams;\nvar $createFetch = createNodePonyfill;\n// ../../node_modules/@whatwg-node/server/esm/utils.js\nfunction isAsyncIterable(body) {\n return body != null && typeof body === "object" && typeof body[Symbol.asyncIterator] === "function";\n}\nfunction getPort(nodeRequest) {\n if (nodeRequest.socket?.localPort) {\n return nodeRequest.socket?.localPort;\n }\n const hostInHeader = nodeRequest.headers?.[":authority"] || nodeRequest.headers?.host;\n const portInHeader = hostInHeader?.split(":")?.[1];\n if (portInHeader) {\n return portInHeader;\n }\n return 80;\n}\nfunction getHostnameWithPort(nodeRequest) {\n if (nodeRequest.headers?.[":authority"]) {\n return nodeRequest.headers?.[":authority"];\n }\n if (nodeRequest.headers?.host) {\n return nodeRequest.headers?.host;\n }\n const port = getPort(nodeRequest);\n if (nodeRequest.hostname) {\n return nodeRequest.hostname + ":" + port;\n }\n const localIp = nodeRequest.socket?.localAddress;\n if (localIp && !localIp?.includes("::") && !localIp?.includes("ffff")) {\n return `${localIp}:${port}`;\n }\n return "localhost";\n}\nfunction buildFullUrl(nodeRequest) {\n const hostnameWithPort = getHostnameWithPort(nodeRequest);\n const protocol = nodeRequest.protocol || (nodeRequest.socket?.encrypted ? "https" : "http");\n const endpoint = nodeRequest.originalUrl || nodeRequest.url || "/graphql";\n return `${protocol}://${hostnameWithPort}${endpoint}`;\n}\nfunction isRequestBody(body) {\n const stringTag = body[Symbol.toStringTag];\n if (typeof body === "string" || stringTag === "Uint8Array" || stringTag === "Blob" || stringTag === "FormData" || stringTag === "URLSearchParams" || isAsyncIterable(body)) {\n return true;\n }\n return false;\n}\nfunction normalizeNodeRequest(nodeRequest, fetchAPI, nodeResponse, __useCustomAbortCtrl) {\n const rawRequest = nodeRequest.raw || nodeRequest.req || nodeRequest;\n let fullUrl = buildFullUrl(rawRequest);\n if (nodeRequest.query) {\n const url = new fetchAPI.URL(fullUrl);\n for (const key in nodeRequest.query) {\n url.searchParams.set(key, nodeRequest.query[key]);\n }\n fullUrl = url.toString();\n }\n let normalizedHeaders = nodeRequest.headers;\n if (nodeRequest.headers?.[":method"]) {\n normalizedHeaders = {};\n for (const key in nodeRequest.headers) {\n if (!key.startsWith(":")) {\n normalizedHeaders[key] = nodeRequest.headers[key];\n }\n }\n }\n const controller = __useCustomAbortCtrl ? createCustomAbortControllerSignal() : new AbortController;\n if (nodeResponse?.once) {\n const closeEventListener = () => {\n if (!controller.signal.aborted) {\n Object.defineProperty(rawRequest, "aborted", { value: true });\n controller.abort(nodeResponse.errored ?? undefined);\n }\n };\n nodeResponse.once("error", closeEventListener);\n nodeResponse.once("close", closeEventListener);\n nodeResponse.once("finish", () => {\n nodeResponse.removeListener("close", closeEventListener);\n });\n }\n if (nodeRequest.method === "GET" || nodeRequest.method === "HEAD") {\n return new fetchAPI.Request(fullUrl, {\n method: nodeRequest.method,\n headers: normalizedHeaders,\n signal: controller.signal\n });\n }\n const maybeParsedBody = nodeRequest.body;\n if (maybeParsedBody != null && Object.keys(maybeParsedBody).length > 0) {\n if (isRequestBody(maybeParsedBody)) {\n return new fetchAPI.Request(fullUrl, {\n method: nodeRequest.method || "GET",\n headers: normalizedHeaders,\n body: maybeParsedBody,\n signal: controller.signal\n });\n }\n const request = new fetchAPI.Request(fullUrl, {\n method: nodeRequest.method || "GET",\n headers: normalizedHeaders,\n signal: controller.signal\n });\n if (!request.headers.get("content-type")?.includes("json")) {\n request.headers.set("content-type", "application/json; charset=utf-8");\n }\n return new Proxy(request, {\n get: (target, prop, receiver) => {\n switch (prop) {\n case "json":\n return () => fakePromise(maybeParsedBody);\n case "text":\n return () => fakePromise(JSON.stringify(maybeParsedBody));\n default:\n if (globalThis.Bun) {\n return Reflect.get(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n }\n });\n }\n return new fetchAPI.Request(fullUrl, {\n method: nodeRequest.method,\n headers: normalizedHeaders,\n signal: controller.signal,\n body: rawRequest,\n duplex: "half"\n });\n}\nfunction isReadable(stream) {\n return stream.read != null;\n}\nfunction isNodeRequest(request) {\n return isReadable(request);\n}\nfunction isServerResponse(stream) {\n return stream != null && stream.setHeader != null && stream.end != null && stream.once != null && stream.write != null;\n}\nfunction isReadableStream(stream) {\n return stream != null && stream.getReader != null;\n}\nfunction isFetchEvent(event) {\n return event != null && event.request != null && event.respondWith != null;\n}\nfunction configureSocket(rawRequest) {\n rawRequest?.socket?.setTimeout?.(0);\n rawRequest?.socket?.setNoDelay?.(true);\n rawRequest?.socket?.setKeepAlive?.(true);\n}\nfunction endResponse(serverResponse) {\n serverResponse.end(null, null, null);\n}\nfunction sendAsyncIterable(serverResponse, asyncIterable) {\n let closed = false;\n const closeEventListener = () => {\n closed = true;\n };\n serverResponse.once("error", closeEventListener);\n serverResponse.once("close", closeEventListener);\n serverResponse.once("finish", () => {\n serverResponse.removeListener("close", closeEventListener);\n serverResponse.removeListener("error", closeEventListener);\n });\n const iterator = asyncIterable[Symbol.asyncIterator]();\n const pump = () => iterator.next().then(({ done, value }) => {\n if (closed || done) {\n return;\n }\n return handleMaybePromise(() => safeWrite(value, serverResponse), () => closed ? endResponse(serverResponse) : pump());\n });\n return pump();\n}\nfunction safeWrite(chunk, serverResponse) {\n const result = serverResponse.write(chunk);\n if (!result) {\n return new Promise((resolve) => serverResponse.once("drain", resolve));\n }\n}\nfunction sendNodeResponse(fetchResponse, serverResponse, nodeRequest, __useSingleWriteHead) {\n if (serverResponse.closed || serverResponse.destroyed || serverResponse.writableEnded) {\n return;\n }\n if (!fetchResponse) {\n serverResponse.statusCode = 404;\n endResponse(serverResponse);\n return;\n }\n if (__useSingleWriteHead && fetchResponse.headers?.headersInit && !Array.isArray(fetchResponse.headers.headersInit) && !fetchResponse.headers.headersInit.get && !fetchResponse.headers._map && !fetchResponse.headers._setCookies?.length) {\n serverResponse.writeHead(fetchResponse.status, fetchResponse.statusText, fetchResponse.headers.headersInit);\n } else {\n if (serverResponse.setHeaders) {\n serverResponse.setHeaders(fetchResponse.headers);\n } else {\n let setCookiesSet = false;\n fetchResponse.headers.forEach((value, key) => {\n if (key === "set-cookie") {\n if (setCookiesSet) {\n return;\n }\n setCookiesSet = true;\n const setCookies = fetchResponse.headers.getSetCookie?.();\n if (setCookies) {\n serverResponse.setHeader("set-cookie", setCookies);\n return;\n }\n }\n serverResponse.setHeader(key, value);\n });\n }\n serverResponse.writeHead(fetchResponse.status, fetchResponse.statusText);\n }\n if (fetchResponse["bodyType"] === "String") {\n return handleMaybePromise(() => safeWrite(fetchResponse.bodyInit, serverResponse), () => endResponse(serverResponse));\n }\n const bufOfRes = fetchResponse._buffer;\n if (bufOfRes) {\n return handleMaybePromise(() => safeWrite(bufOfRes, serverResponse), () => endResponse(serverResponse));\n }\n const fetchBody = fetchResponse.body;\n if (fetchBody == null) {\n endResponse(serverResponse);\n return;\n }\n if (fetchBody[Symbol.toStringTag] === "Uint8Array") {\n return handleMaybePromise(() => safeWrite(fetchBody, serverResponse), () => endResponse(serverResponse));\n }\n configureSocket(nodeRequest);\n if (isReadable(fetchBody)) {\n serverResponse.once("close", () => {\n fetchBody.destroy();\n });\n fetchBody.pipe(serverResponse, {\n end: true\n });\n return;\n }\n if (isReadableStream(fetchBody)) {\n return sendReadableStream(nodeRequest, serverResponse, fetchBody);\n }\n if (isAsyncIterable(fetchBody)) {\n return sendAsyncIterable(serverResponse, fetchBody);\n }\n}\nfunction sendReadableStream(nodeRequest, serverResponse, readableStream) {\n const reader = readableStream.getReader();\n nodeRequest?.once?.("error", (err) => {\n reader.cancel(err);\n });\n function pump() {\n return reader.read().then(({ done, value }) => done ? endResponse(serverResponse) : handleMaybePromise(() => safeWrite(value, serverResponse), pump));\n }\n return pump();\n}\nfunction isRequestInit(val) {\n return val != null && typeof val === "object" && (("body" in val) || ("cache" in val) || ("credentials" in val) || ("headers" in val) || ("integrity" in val) || ("keepalive" in val) || ("method" in val) || ("mode" in val) || ("redirect" in val) || ("referrer" in val) || ("referrerPolicy" in val) || ("signal" in val) || ("window" in val));\n}\nfunction completeAssign(...args) {\n const [target, ...sources] = args.filter((arg) => arg != null && typeof arg === "object");\n sources.forEach((source) => {\n const descriptors = Object.getOwnPropertyNames(source).reduce((descriptors2, key) => {\n const descriptor = Object.getOwnPropertyDescriptor(source, key);\n if (descriptor) {\n descriptors2[key] = Object.getOwnPropertyDescriptor(source, key);\n }\n return descriptors2;\n }, {});\n Object.getOwnPropertySymbols(source).forEach((sym) => {\n const descriptor = Object.getOwnPropertyDescriptor(source, sym);\n if (descriptor?.enumerable) {\n descriptors[sym] = descriptor;\n }\n });\n Object.defineProperties(target, descriptors);\n });\n return target;\n}\nfunction handleErrorFromRequestHandler(error, ResponseCtor) {\n return new ResponseCtor(error.stack || error.message || error.toString(), {\n status: error.status || 500\n });\n}\nfunction isolateObject(originalCtx, waitUntilFn) {\n if (originalCtx == null) {\n if (waitUntilFn == null) {\n return {};\n }\n return {\n waitUntil: waitUntilFn\n };\n }\n return completeAssign(Object.create(originalCtx), {\n waitUntil: waitUntilFn\n }, originalCtx);\n}\nfunction handleAbortSignalAndPromiseResponse(response$, abortSignal) {\n if (abortSignal?.aborted) {\n throw abortSignal.reason;\n }\n if (isPromise(response$) && abortSignal) {\n let abortSignalFetchErrorHandler = function() {\n deferred$.reject(abortSignal.reason);\n };\n const deferred$ = createDeferredPromise();\n abortSignal.addEventListener("abort", abortSignalFetchErrorHandler, { once: true });\n response$.then(function fetchSuccessHandler(res) {\n deferred$.resolve(res);\n }).catch(function fetchErrorHandler(err) {\n deferred$.reject(err);\n }).finally(() => {\n abortSignal.removeEventListener("abort", abortSignalFetchErrorHandler);\n });\n return deferred$.promise;\n }\n return response$;\n}\nvar decompressedResponseMap = new WeakMap;\nvar supportedEncodingsByFetchAPI = new WeakMap;\nvar terminateEvents = ["SIGINT", "exit", "SIGTERM"];\nvar disposableStacks = new Set;\nvar eventListenerRegistered = false;\nfunction ensureEventListenerForDisposableStacks() {\n if (eventListenerRegistered) {\n return;\n }\n eventListenerRegistered = true;\n for (const event of terminateEvents) {\n globalThis.process.once(event, function terminateHandler() {\n return Promise.allSettled([...disposableStacks].map((stack) => !stack.disposed && stack.disposeAsync()));\n });\n }\n}\nfunction ensureDisposableStackRegisteredForTerminateEvents(disposableStack) {\n if (globalThis.process) {\n ensureEventListenerForDisposableStacks();\n if (!disposableStacks.has(disposableStack)) {\n disposableStacks.add(disposableStack);\n disposableStack.defer(() => {\n disposableStacks.delete(disposableStack);\n });\n }\n }\n}\n\nclass CustomAbortControllerSignal extends EventTarget {\n aborted = false;\n _onabort = null;\n _reason;\n constructor() {\n super();\n const nodeEvents = globalThis.process?.getBuiltinModule?.("node:events");\n if (nodeEvents?.kMaxEventTargetListeners) {\n this[nodeEvents.kMaxEventTargetListeners] = 0;\n }\n }\n throwIfAborted() {\n if (this._nativeCtrl?.signal?.throwIfAborted) {\n return this._nativeCtrl.signal.throwIfAborted();\n }\n if (this.aborted) {\n throw this._reason;\n }\n }\n _nativeCtrl;\n ensureNativeCtrl() {\n if (!this._nativeCtrl) {\n const isAborted = this.aborted;\n this._nativeCtrl = new AbortController;\n if (isAborted) {\n this._nativeCtrl.abort(this._reason);\n }\n }\n return this._nativeCtrl;\n }\n abort(reason) {\n if (this._nativeCtrl?.abort) {\n return this._nativeCtrl?.abort(reason);\n }\n this._reason = reason || new DOMException("This operation was aborted", "AbortError");\n this.aborted = true;\n this.dispatchEvent(new Event("abort"));\n }\n get signal() {\n if (this._nativeCtrl?.signal) {\n return this._nativeCtrl.signal;\n }\n return this;\n }\n get reason() {\n if (this._nativeCtrl?.signal) {\n return this._nativeCtrl.signal.reason;\n }\n return this._reason;\n }\n get onabort() {\n if (this._onabort) {\n return this._onabort;\n }\n return this._onabort;\n }\n set onabort(value) {\n if (this._nativeCtrl?.signal) {\n this._nativeCtrl.signal.onabort = value;\n return;\n }\n if (this._onabort) {\n this.removeEventListener("abort", this._onabort);\n }\n this._onabort = value;\n if (value) {\n this.addEventListener("abort", value);\n }\n }\n}\nfunction createCustomAbortControllerSignal() {\n if (globalThis.Bun || globalThis.Deno) {\n return new AbortController;\n }\n return new Proxy(new CustomAbortControllerSignal, {\n get(target, prop, receiver) {\n if (prop.toString().includes("kDependantSignals")) {\n const nativeCtrl = target.ensureNativeCtrl();\n return Reflect.get(nativeCtrl.signal, prop, nativeCtrl.signal);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, value, receiver) {\n if (prop.toString().includes("kDependantSignals")) {\n const nativeCtrl = target.ensureNativeCtrl();\n return Reflect.set(nativeCtrl.signal, prop, value, nativeCtrl.signal);\n }\n return Reflect.set(target, prop, value, receiver);\n },\n getPrototypeOf() {\n return AbortSignal.prototype;\n }\n });\n}\n\n// ../../node_modules/@whatwg-node/server/esm/uwebsockets.js\nfunction isUWSResponse(res) {\n return !!res.onData;\n}\nfunction getRequestFromUWSRequest({ req, res, fetchAPI, controller }) {\n const method = req.getMethod();\n let duplex;\n const chunks = [];\n const pushFns = [\n (chunk) => {\n chunks.push(chunk);\n }\n ];\n const push = (chunk) => {\n for (const pushFn of pushFns) {\n pushFn(chunk);\n }\n };\n let stopped = false;\n const stopFns = [\n () => {\n stopped = true;\n }\n ];\n const stop = () => {\n for (const stopFn of stopFns) {\n stopFn();\n }\n };\n res.onData(function(ab, isLast) {\n push(Buffer.from(Buffer.from(ab, 0, ab.byteLength)));\n if (isLast) {\n stop();\n }\n });\n let getReadableStream;\n if (method !== "get" && method !== "head") {\n duplex = "half";\n controller.signal.addEventListener("abort", () => {\n stop();\n }, { once: true });\n let readableStream;\n getReadableStream = () => {\n if (!readableStream) {\n readableStream = new fetchAPI.ReadableStream({\n start(streamCtrl) {\n for (const chunk of chunks) {\n streamCtrl.enqueue(chunk);\n }\n if (stopped) {\n streamCtrl.close();\n return;\n }\n pushFns.push((chunk) => {\n streamCtrl.enqueue(chunk);\n });\n stopFns.push(() => {\n if (controller.signal.reason) {\n streamCtrl.error(controller.signal.reason);\n return;\n }\n if (streamCtrl.desiredSize) {\n streamCtrl.close();\n }\n });\n }\n });\n }\n return readableStream;\n };\n }\n const headers = new fetchAPI.Headers;\n req.forEach((key, value) => {\n headers.append(key, value);\n });\n let url = `http://localhost${req.getUrl()}`;\n const query = req.getQuery();\n if (query) {\n url += `?${query}`;\n }\n let buffer;\n function getBody() {\n if (!getReadableStream) {\n return null;\n }\n if (stopped) {\n return getBufferFromChunks();\n }\n return getReadableStream();\n }\n const request = new fetchAPI.Request(url, {\n method,\n headers,\n get body() {\n return getBody();\n },\n signal: controller.signal,\n duplex\n });\n function getBufferFromChunks() {\n if (!buffer) {\n buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);\n }\n return buffer;\n }\n function collectBuffer() {\n if (stopped) {\n return fakePromise(getBufferFromChunks());\n }\n return new Promise((resolve, reject) => {\n try {\n stopFns.push(() => {\n resolve(getBufferFromChunks());\n });\n } catch (e) {\n reject(e);\n }\n });\n }\n Object.defineProperties(request, {\n body: {\n get() {\n return getBody();\n },\n configurable: true,\n enumerable: true\n },\n json: {\n value() {\n return collectBuffer().then((b) => b.toString("utf8")).then((t) => JSON.parse(t));\n },\n configurable: true,\n enumerable: true\n },\n text: {\n value() {\n return collectBuffer().then((b) => b.toString("utf8"));\n },\n configurable: true,\n enumerable: true\n },\n arrayBuffer: {\n value() {\n return collectBuffer();\n },\n configurable: true,\n enumerable: true\n }\n });\n return request;\n}\nfunction createWritableFromUWS(uwsResponse, fetchAPI) {\n return new fetchAPI.WritableStream({\n write(chunk) {\n uwsResponse.cork(() => {\n uwsResponse.write(chunk);\n });\n },\n close() {\n uwsResponse.cork(() => {\n uwsResponse.end();\n });\n }\n });\n}\nfunction sendResponseToUwsOpts(uwsResponse, fetchResponse, controller, fetchAPI) {\n if (!fetchResponse) {\n uwsResponse.writeStatus("404 Not Found");\n uwsResponse.end();\n return;\n }\n const bufferOfRes = fetchResponse._buffer;\n const strBody = fetchResponse["bodyType"] === "String" ? fetchResponse.bodyInit : undefined;\n if (controller.signal.aborted) {\n return;\n }\n uwsResponse.cork(() => {\n uwsResponse.writeStatus(`${fetchResponse.status} ${fetchResponse.statusText}`);\n for (const [key, value] of fetchResponse.headers) {\n if (key !== "content-length") {\n if (key === "set-cookie") {\n const setCookies = fetchResponse.headers.getSetCookie?.();\n if (setCookies) {\n for (const setCookie of setCookies) {\n uwsResponse.writeHeader(key, setCookie);\n }\n continue;\n }\n }\n uwsResponse.writeHeader(key, value);\n }\n }\n if (strBody) {\n uwsResponse.end(strBody);\n } else if (bufferOfRes) {\n uwsResponse.end(bufferOfRes);\n } else if (!fetchResponse.body) {\n uwsResponse.end();\n }\n });\n if (strBody || bufferOfRes || !fetchResponse.body) {\n return;\n }\n controller.signal.addEventListener("abort", () => {\n if (!fetchResponse.body?.locked) {\n fetchResponse.body?.cancel(controller.signal.reason);\n }\n }, { once: true });\n return fetchResponse.body.pipeTo(createWritableFromUWS(uwsResponse, fetchAPI), {\n signal: controller.signal\n }).catch((err) => {\n if (controller.signal.aborted) {\n return;\n }\n throw err;\n });\n}\n\n// ../../node_modules/@whatwg-node/server/esm/createServerAdapter.js\nfunction isRequestAccessible(serverContext) {\n try {\n return !!serverContext?.request;\n } catch {\n return false;\n }\n}\nvar EMPTY_OBJECT = {};\nfunction createServerAdapter(serverAdapterBaseObject, options) {\n const useSingleWriteHead = options?.__useSingleWriteHead == null ? true : options.__useSingleWriteHead;\n const fetchAPI = {\n ...exports_node_ponyfill,\n ...options?.fetchAPI\n };\n const useCustomAbortCtrl = options?.__useCustomAbortCtrl == null ? fetchAPI.Request !== globalThis.Request : options.__useCustomAbortCtrl;\n const givenHandleRequest = typeof serverAdapterBaseObject === "function" ? serverAdapterBaseObject : serverAdapterBaseObject.handle;\n const onRequestHooks = [];\n const onResponseHooks = [];\n let instrumentation;\n const waitUntilPromises = new Set;\n let _disposableStack;\n function ensureDisposableStack() {\n if (!_disposableStack) {\n _disposableStack = new AsyncDisposableStack;\n if (options?.disposeOnProcessTerminate) {\n ensureDisposableStackRegisteredForTerminateEvents(_disposableStack);\n }\n _disposableStack.defer(() => {\n if (waitUntilPromises.size > 0) {\n return Promise.allSettled(waitUntilPromises).then(() => {\n waitUntilPromises.clear();\n }, () => {\n waitUntilPromises.clear();\n });\n }\n });\n }\n return _disposableStack;\n }\n function waitUntil(maybePromise) {\n if (isPromise(maybePromise)) {\n ensureDisposableStack();\n waitUntilPromises.add(maybePromise);\n maybePromise.then(() => {\n waitUntilPromises.delete(maybePromise);\n }, (err) => {\n console.error(`Unexpected error while waiting: ${err.message || err}`);\n waitUntilPromises.delete(maybePromise);\n });\n }\n }\n if (options?.plugins != null) {\n for (const plugin of options.plugins) {\n if (plugin.instrumentation) {\n instrumentation = instrumentation ? chain(instrumentation, plugin.instrumentation) : plugin.instrumentation;\n }\n if (plugin.onRequest) {\n onRequestHooks.push(plugin.onRequest);\n }\n if (plugin.onResponse) {\n onResponseHooks.push(plugin.onResponse);\n }\n const disposeFn = plugin[DisposableSymbols.dispose];\n if (disposeFn) {\n ensureDisposableStack().defer(disposeFn);\n }\n const asyncDisposeFn = plugin[DisposableSymbols.asyncDispose];\n if (asyncDisposeFn) {\n ensureDisposableStack().defer(asyncDisposeFn);\n }\n if (plugin.onDispose) {\n ensureDisposableStack().defer(plugin.onDispose);\n }\n }\n }\n let handleRequest = onRequestHooks.length > 0 || onResponseHooks.length > 0 ? function handleRequest(request, serverContext) {\n let requestHandler = givenHandleRequest;\n let response;\n if (onRequestHooks.length === 0) {\n return handleEarlyResponse();\n }\n let url = request["parsedUrl"] || new Proxy(EMPTY_OBJECT, {\n get(_target, prop, _receiver) {\n url = new fetchAPI.URL(request.url, "http://localhost");\n return Reflect.get(url, prop, url);\n }\n });\n function handleResponse(response2) {\n if (onResponseHooks.length === 0) {\n return response2;\n }\n return handleMaybePromise(() => iterateAsync(onResponseHooks, (onResponseHook) => onResponseHook({\n request,\n response: response2,\n serverContext,\n setResponse(newResponse) {\n response2 = newResponse;\n },\n fetchAPI\n })), () => response2);\n }\n function handleEarlyResponse() {\n if (!response) {\n return handleMaybePromise(() => requestHandler(request, serverContext), handleResponse);\n }\n return handleResponse(response);\n }\n return handleMaybePromise(() => iterateAsync(onRequestHooks, (onRequestHook, stopEarly) => onRequestHook({\n request,\n setRequest(newRequest) {\n request = newRequest;\n },\n serverContext,\n fetchAPI,\n url,\n requestHandler,\n setRequestHandler(newRequestHandler) {\n requestHandler = newRequestHandler;\n },\n endResponse(newResponse) {\n response = newResponse;\n if (newResponse) {\n stopEarly();\n }\n }\n })), handleEarlyResponse);\n } : givenHandleRequest;\n if (instrumentation?.request) {\n const originalRequestHandler = handleRequest;\n handleRequest = (request, initialContext) => {\n return getInstrumented({ request }).asyncFn(instrumentation.request, originalRequestHandler)(request, initialContext);\n };\n }\n function handleNodeRequest(nodeRequest, ...ctx) {\n const serverContext = ctx.length > 1 ? completeAssign(...ctx) : ctx[0] || {};\n if (!serverContext.waitUntil) {\n serverContext.waitUntil = waitUntil;\n }\n const request = normalizeNodeRequest(nodeRequest, fetchAPI, undefined, useCustomAbortCtrl);\n return handleRequest(request, serverContext);\n }\n function handleNodeRequestAndResponse(nodeRequest, nodeResponseOrContainer, ...ctx) {\n const nodeResponse = nodeResponseOrContainer.raw || nodeResponseOrContainer;\n const serverContext = ctx.length > 1 ? completeAssign(...ctx) : ctx[0] || {};\n if (!serverContext.waitUntil) {\n serverContext.waitUntil = waitUntil;\n }\n const request = normalizeNodeRequest(nodeRequest, fetchAPI, nodeResponse, useCustomAbortCtrl);\n return handleRequest(request, serverContext);\n }\n function requestListener(nodeRequest, nodeResponse, ...ctx) {\n const defaultServerContext = {\n req: nodeRequest,\n res: nodeResponse,\n waitUntil\n };\n return unfakePromise(fakePromise().then(() => handleNodeRequestAndResponse(nodeRequest, nodeResponse, defaultServerContext, ...ctx)).catch((err) => handleErrorFromRequestHandler(err, fetchAPI.Response)).then((response) => sendNodeResponse(response, nodeResponse, nodeRequest, useSingleWriteHead)).catch((err) => console.error(`Unexpected error while handling request: ${err.message || err}`)));\n }\n function handleUWS(res, req, ...ctx) {\n const defaultServerContext = {\n res,\n req,\n waitUntil\n };\n const filteredCtxParts = ctx.filter((partCtx) => partCtx != null);\n const serverContext = filteredCtxParts.length > 0 ? completeAssign(defaultServerContext, ...ctx) : defaultServerContext;\n const controller = useCustomAbortCtrl ? createCustomAbortControllerSignal() : new AbortController;\n const originalResEnd = res.end.bind(res);\n let resEnded = false;\n res.end = function(data) {\n resEnded = true;\n return originalResEnd(data);\n };\n const originalOnAborted = res.onAborted.bind(res);\n originalOnAborted(function() {\n controller.abort();\n });\n res.onAborted = function(cb) {\n controller.signal.addEventListener("abort", cb, { once: true });\n };\n const request = getRequestFromUWSRequest({\n req,\n res,\n fetchAPI,\n controller\n });\n return handleMaybePromise(() => handleMaybePromise(() => handleRequest(request, serverContext), (response) => response, (err) => handleErrorFromRequestHandler(err, fetchAPI.Response)), (response) => {\n if (!controller.signal.aborted && !resEnded) {\n return handleMaybePromise(() => sendResponseToUwsOpts(res, response, controller, fetchAPI), (r) => r, (err) => {\n console.error(`Unexpected error while handling request: ${err.message || err}`);\n });\n }\n });\n }\n function handleEvent(event, ...ctx) {\n if (!event.respondWith || !event.request) {\n throw new TypeError(`Expected FetchEvent, got ${event}`);\n }\n const filteredCtxParts = ctx.filter((partCtx) => partCtx != null);\n const serverContext = filteredCtxParts.length > 0 ? completeAssign({}, event, ...filteredCtxParts) : isolateObject(event);\n const response$ = handleRequest(event.request, serverContext);\n event.respondWith(response$);\n }\n function handleRequestWithWaitUntil(request, ...ctx) {\n const filteredCtxParts = ctx.filter((partCtx) => partCtx != null);\n const serverContext = filteredCtxParts.length > 1 ? completeAssign({}, ...filteredCtxParts) : isolateObject(filteredCtxParts[0], filteredCtxParts[0] == null || filteredCtxParts[0].waitUntil == null ? waitUntil : undefined);\n return handleRequest(request, serverContext);\n }\n const fetchFn = (input, ...maybeCtx) => {\n if (typeof input === "string" || "href" in input) {\n const [initOrCtx, ...restOfCtx] = maybeCtx;\n if (isRequestInit(initOrCtx)) {\n const request2 = new fetchAPI.Request(input, initOrCtx);\n const res$2 = handleRequestWithWaitUntil(request2, ...restOfCtx);\n const signal = initOrCtx.signal;\n if (signal) {\n return handleAbortSignalAndPromiseResponse(res$2, signal);\n }\n return res$2;\n }\n const request = new fetchAPI.Request(input);\n return handleRequestWithWaitUntil(request, ...maybeCtx);\n }\n const res$ = handleRequestWithWaitUntil(input, ...maybeCtx);\n return handleAbortSignalAndPromiseResponse(res$, input.signal);\n };\n const genericRequestHandler = (input, ...maybeCtx) => {\n const [initOrCtxOrRes, ...restOfCtx] = maybeCtx;\n if (isNodeRequest(input)) {\n if (!isServerResponse(initOrCtxOrRes)) {\n throw new TypeError(`Expected ServerResponse, got ${initOrCtxOrRes}`);\n }\n return requestListener(input, initOrCtxOrRes, ...restOfCtx);\n }\n if (isUWSResponse(input)) {\n return handleUWS(input, initOrCtxOrRes, ...restOfCtx);\n }\n if (isServerResponse(initOrCtxOrRes)) {\n throw new TypeError("Got Node response without Node request");\n }\n if (isRequestAccessible(input)) {\n if (isFetchEvent(input)) {\n return handleEvent(input, ...maybeCtx);\n }\n return handleRequestWithWaitUntil(input.request, input, ...maybeCtx);\n }\n return fetchFn(input, ...maybeCtx);\n };\n const adapterObj = {\n handleRequest: handleRequestWithWaitUntil,\n fetch: fetchFn,\n handleNodeRequest,\n handleNodeRequestAndResponse,\n requestListener,\n handleEvent,\n handleUWS,\n handle: genericRequestHandler,\n get disposableStack() {\n return ensureDisposableStack();\n },\n [DisposableSymbols.asyncDispose]() {\n if (_disposableStack && !_disposableStack.disposed) {\n return _disposableStack.disposeAsync();\n }\n return fakePromise();\n },\n dispose() {\n if (_disposableStack && !_disposableStack.disposed) {\n return _disposableStack.disposeAsync();\n }\n return fakePromise();\n },\n waitUntil\n };\n const serverAdapter = new Proxy(genericRequestHandler, {\n has: (_, prop) => {\n return prop in adapterObj || prop in genericRequestHandler || serverAdapterBaseObject && prop in serverAdapterBaseObject;\n },\n get: (_, prop) => {\n if (globalThis.Deno || prop === Symbol.asyncDispose || prop === Symbol.dispose) {\n const adapterProp2 = Reflect.get(adapterObj, prop, adapterObj);\n if (adapterProp2) {\n return adapterProp2;\n }\n }\n const adapterProp = adapterObj[prop];\n if (adapterProp) {\n if (adapterProp.bind) {\n return adapterProp.bind(adapterObj);\n }\n return adapterProp;\n }\n const handleProp = genericRequestHandler[prop];\n if (handleProp) {\n if (handleProp.bind) {\n return handleProp.bind(genericRequestHandler);\n }\n return handleProp;\n }\n if (serverAdapterBaseObject) {\n const serverAdapterBaseObjectProp = serverAdapterBaseObject[prop];\n if (serverAdapterBaseObjectProp) {\n if (serverAdapterBaseObjectProp.bind) {\n return function(...args) {\n const returnedVal = serverAdapterBaseObject[prop](...args);\n if (returnedVal === serverAdapterBaseObject) {\n return serverAdapter;\n }\n return returnedVal;\n };\n }\n return serverAdapterBaseObjectProp;\n }\n }\n },\n apply(_, __, args) {\n return genericRequestHandler(...args);\n }\n });\n return serverAdapter;\n}\n\n// ../api/src/routes/agents/me/me.client.ts\nclass AgentInvocationClient {\n baseURL;\n authToken;\n constructor(options) {\n this.baseURL = options?.baseURL ?? "https://blink.so";\n this.authToken = options?.authToken;\n }\n async deleteStorage(key) {\n const resp = await this.request("DELETE", `/api/agents/me/storage/${encodeURIComponent(key)}`);\n await this.assertResponseStatus(resp, 204);\n }\n async setStorage(key, value, options) {\n const searchParams = new URLSearchParams;\n if (options?.ttl) {\n searchParams.set("ttl", options.ttl.toString());\n }\n const resp = await this.request("PUT", `/api/agents/me/storage/${encodeURIComponent(key)}?${searchParams.toString()}`, value);\n await this.assertResponseStatus(resp, 204);\n }\n async getStorage(key) {\n const resp = await this.request("GET", `/api/agents/me/storage/${encodeURIComponent(key)}`);\n if (resp.status === 404) {\n return;\n }\n await this.assertResponseStatus(resp, 200);\n return await resp.text();\n }\n async listStorage(prefix, options) {\n const resp = await this.request("GET", `/api/agents/me/storage`, JSON.stringify({ prefix, limit: options?.limit, cursor: options?.cursor }));\n await this.assertResponseStatus(resp, 200);\n return await resp.json();\n }\n async upsertChat(key) {\n const resp = await this.request("PUT", `/api/agents/me/chats/${encodeURIComponent(key)}`);\n if (resp.status !== 200 && resp.status !== 204) {\n await this.assertResponseStatus(resp, 200);\n }\n return await resp.json();\n }\n async sendMessages(key, request) {\n const resp = await this.request("POST", `/api/agents/me/chats/${encodeURIComponent(key)}/messages`, JSON.stringify(request));\n await this.assertResponseStatus(resp, 204);\n }\n async getChat(id) {\n const resp = await this.request("GET", `/api/agents/me/chats/${encodeURIComponent(id)}`);\n if (resp.status === 404) {\n return;\n }\n await this.assertResponseStatus(resp, 200);\n return await resp.json();\n }\n async deleteChat(id) {\n const resp = await this.request("DELETE", `/api/agents/me/chats/${encodeURIComponent(id)}`);\n await this.assertResponseStatus(resp, 204);\n }\n async startChat(id) {\n const resp = await this.request("POST", `/api/agents/me/chats/${encodeURIComponent(id)}/start`);\n await this.assertResponseStatus(resp, 204);\n }\n async stopChat(id) {\n const resp = await this.request("POST", `/api/agents/me/chats/${encodeURIComponent(id)}/stop`);\n await this.assertResponseStatus(resp, 204);\n }\n async getMessages(id) {\n const resp = await this.request("GET", `/api/agents/me/chats/${encodeURIComponent(id)}/messages`);\n await this.assertResponseStatus(resp, 200);\n return await resp.json();\n }\n async deleteMessages(id, messageIds) {\n const resp = await this.request("POST", `/api/agents/me/chats/${encodeURIComponent(id)}/messages/delete`, JSON.stringify({ message_ids: messageIds }));\n await this.assertResponseStatus(resp, 204);\n }\n async proxyOtlpTraces(request) {\n if (!this.authToken) {\n const contentType = request.headers.get("content-type")?.toLowerCase() || "";\n if (contentType.includes("application/x-protobuf")) {\n return new Response(new Uint8Array(0), {\n status: 200,\n headers: { "Content-Type": "application/x-protobuf" }\n });\n }\n return new Response(JSON.stringify({}), {\n status: 200,\n headers: { "Content-Type": "application/json" }\n });\n }\n const hopByHopHeaders = new Set([\n "transfer-encoding",\n "content-length",\n "host",\n "connection",\n "keep-alive",\n "proxy-authenticate",\n "proxy-authorization",\n "te",\n "trailer",\n "upgrade"\n ]);\n const headers = {};\n request.headers.forEach((value, key) => {\n if (hopByHopHeaders.has(key.toLowerCase())) {\n return;\n }\n headers[key] = value;\n });\n return this.request(request.method, `/api/otlp/v1/traces`, request.body ?? undefined, { headers });\n }\n async assertResponseStatus(resp, status) {\n if (resp.status === status) {\n return;\n }\n const body = await resp.text();\n try {\n const parsed = JSON.parse(body);\n if (parsed.error) {\n throw new Error(parsed.error);\n }\n throw new Error(body);\n } catch (err) {\n throw new Error(`Expected status ${status}, got ${resp.status}: ${body}`);\n }\n }\n request(method, path, body, options) {\n const url = new URL(path, this.baseURL);\n const headers = new Headers;\n if (this.authToken) {\n headers.set("Authorization", `Bearer ${this.authToken}`);\n }\n if (typeof body === "string") {\n headers.set("Content-Type", "application/json");\n }\n if (options?.headers) {\n for (const [key, value] of Object.entries(options.headers)) {\n headers.set(key, value);\n }\n }\n let signal;\n if (options?.timeout) {\n signal = AbortSignal.timeout(options.timeout);\n }\n return fetch(url.toString(), {\n method,\n headers,\n body,\n signal,\n duplex: body ? "half" : undefined\n });\n }\n}\n\n// ../../node_modules/blink/dist/browser/cookie-C6gQJ2Nm.js\nvar e = (e2) => {\n let t = e2.split(`/`);\n return t[0] === `` && t.shift(), t;\n};\nvar t = (t2) => {\n let { groups: i, path: a } = n(t2), o = e(a);\n return r(o, i);\n};\nvar n = (e2) => {\n let t2 = [];\n return e2 = e2.replace(/\\{[^}]+\\}/g, (e3, n2) => {\n let r = `@${n2}`;\n return t2.push([r, e3]), r;\n }), { groups: t2, path: e2 };\n};\nvar r = (e2, t2) => {\n for (let n2 = t2.length - 1;n2 >= 0; n2--) {\n let [r2] = t2[n2];\n for (let i = e2.length - 1;i >= 0; i--)\n if (e2[i].includes(r2)) {\n e2[i] = e2[i].replace(r2, t2[n2][1]);\n break;\n }\n }\n return e2;\n};\nvar i = {};\nvar a = (e2, t2) => {\n if (e2 === `*`)\n return `*`;\n let n2 = e2.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n if (n2) {\n let r2 = `${e2}#${t2}`;\n return i[r2] || (n2[2] ? i[r2] = t2 && t2[0] !== `:` && t2[0] !== `*` ? [r2, n2[1], RegExp(`^${n2[2]}(?=/${t2})`)] : [e2, n2[1], RegExp(`^${n2[2]}$`)] : i[r2] = [e2, n2[1], true]), i[r2];\n }\n return null;\n};\nvar o = (e2, t2) => {\n try {\n return t2(e2);\n } catch {\n return e2.replace(/(?:%[0-9A-Fa-f]{2})+/g, (e3) => {\n try {\n return t2(e3);\n } catch {\n return e3;\n }\n });\n }\n};\nvar s = (e2) => o(e2, decodeURI);\nvar c = (e2) => {\n let t2 = e2.url, n2 = t2.indexOf(`/`, t2.indexOf(`:`) + 4), r2 = n2;\n for (;r2 < t2.length; r2++) {\n let e3 = t2.charCodeAt(r2);\n if (e3 === 37) {\n let e4 = t2.indexOf(`?`, r2), i2 = t2.slice(n2, e4 === -1 ? undefined : e4);\n return s(i2.includes(`%25`) ? i2.replace(/%25/g, `%2525`) : i2);\n } else if (e3 === 63)\n break;\n }\n return t2.slice(n2, r2);\n};\nvar l = (e2) => {\n let t2 = c(e2);\n return t2.length > 1 && t2.at(-1) === `/` ? t2.slice(0, -1) : t2;\n};\nvar u = (e2, t2, ...n2) => (n2.length && (t2 = u(t2, ...n2)), `${e2?.[0] === `/` ? `` : `/`}${e2}${t2 === `/` ? `` : `${e2?.at(-1) === `/` ? `` : `/`}${t2?.[0] === `/` ? t2.slice(1) : t2}`}`);\nvar d = (e2) => {\n if (e2.charCodeAt(e2.length - 1) !== 63 || !e2.includes(`:`))\n return null;\n let t2 = e2.split(`/`), n2 = [], r2 = ``;\n return t2.forEach((e3) => {\n if (e3 !== `` && !/\\:/.test(e3))\n r2 += `/` + e3;\n else if (/\\:/.test(e3))\n if (/\\?/.test(e3)) {\n n2.length === 0 && r2 === `` ? n2.push(`/`) : n2.push(r2);\n let t3 = e3.replace(`?`, ``);\n r2 += `/` + t3, n2.push(r2);\n } else\n r2 += `/` + e3;\n }), n2.filter((e3, t3, n3) => n3.indexOf(e3) === t3);\n};\nvar f = (e2) => /[%+]/.test(e2) ? (e2.indexOf(`+`) !== -1 && (e2 = e2.replace(/\\+/g, ` `)), e2.indexOf(`%`) === -1 ? e2 : o(e2, g)) : e2;\nvar p = (e2, t2, n2) => {\n let r2;\n if (!n2 && t2 && !/[%+]/.test(t2)) {\n let n3 = e2.indexOf(`?${t2}`, 8);\n for (n3 === -1 && (n3 = e2.indexOf(`&${t2}`, 8));n3 !== -1; ) {\n let r3 = e2.charCodeAt(n3 + t2.length + 1);\n if (r3 === 61) {\n let r4 = n3 + t2.length + 2, i3 = e2.indexOf(`&`, r4);\n return f(e2.slice(r4, i3 === -1 ? undefined : i3));\n } else if (r3 == 38 || isNaN(r3))\n return ``;\n n3 = e2.indexOf(`&${t2}`, n3 + 1);\n }\n if (r2 = /[%+]/.test(e2), !r2)\n return;\n }\n let i2 = {};\n r2 ??= /[%+]/.test(e2);\n let a2 = e2.indexOf(`?`, 8);\n for (;a2 !== -1; ) {\n let t3 = e2.indexOf(`&`, a2 + 1), o2 = e2.indexOf(`=`, a2);\n o2 > t3 && t3 !== -1 && (o2 = -1);\n let s2 = e2.slice(a2 + 1, o2 === -1 ? t3 === -1 ? undefined : t3 : o2);\n if (r2 && (s2 = f(s2)), a2 = t3, s2 === ``)\n continue;\n let c2;\n o2 === -1 ? c2 = `` : (c2 = e2.slice(o2 + 1, t3 === -1 ? undefined : t3), r2 && (c2 = f(c2))), n2 ? (i2[s2] && Array.isArray(i2[s2]) || (i2[s2] = []), i2[s2].push(c2)) : i2[s2] ??= c2;\n }\n return t2 ? i2[t2] : i2;\n};\nvar m = p;\nvar h = (e2, t2) => p(e2, t2, true);\nvar g = decodeURIComponent;\nvar _ = /^[\\w!#$%&\'*.^`|~+-]+$/;\nvar v = /^[ !#-:<-[\\]-~]*$/;\nvar y = (e2, t2) => {\n if (t2 && e2.indexOf(t2) === -1)\n return {};\n let n2 = e2.trim().split(`;`), r2 = {};\n for (let e3 of n2) {\n e3 = e3.trim();\n let n3 = e3.indexOf(`=`);\n if (n3 === -1)\n continue;\n let i2 = e3.substring(0, n3).trim();\n if (t2 && t2 !== i2 || !_.test(i2))\n continue;\n let a2 = e3.substring(n3 + 1).trim();\n if (a2.startsWith(`"`) && a2.endsWith(`"`) && (a2 = a2.slice(1, -1)), v.test(a2) && (r2[i2] = a2.indexOf(`%`) === -1 ? a2 : o(a2, g), t2))\n break;\n }\n return r2;\n};\n\n// ../../node_modules/blink/dist/browser/control/index.js\nvar f2 = (e2, t2, n2) => (r2, i2) => {\n let a2 = -1;\n return o2(0);\n async function o2(s2) {\n if (s2 <= a2)\n throw Error(`next() called multiple times`);\n a2 = s2;\n let c2, l2 = false, u2;\n if (e2[s2] ? (u2 = e2[s2][0][0], r2.req.routeIndex = s2) : u2 = s2 === e2.length && i2 || undefined, u2)\n try {\n c2 = await u2(r2, () => o2(s2 + 1));\n } catch (e3) {\n if (e3 instanceof Error && t2)\n r2.error = e3, c2 = await t2(e3, r2), l2 = true;\n else\n throw e3;\n }\n else\n r2.finalized === false && n2 && (c2 = await n2(r2));\n return c2 && (r2.finalized === false || l2) && (r2.res = c2), r2;\n }\n};\nvar p2 = Symbol();\nvar m2 = async (e2, t2 = Object.create(null)) => {\n let { all: n2 = false, dot: r2 = false } = t2, i2 = (e2 instanceof y2 ? e2.raw.headers : e2.headers).get(`Content-Type`);\n return i2?.startsWith(`multipart/form-data`) || i2?.startsWith(`application/x-www-form-urlencoded`) ? h2(e2, { all: n2, dot: r2 }) : {};\n};\nasync function h2(e2, t2) {\n let n2 = await e2.formData();\n return n2 ? g2(n2, t2) : {};\n}\nfunction g2(e2, t2) {\n let n2 = Object.create(null);\n return e2.forEach((e3, r2) => {\n t2.all || r2.endsWith(`[]`) ? ee(n2, r2, e3) : n2[r2] = e3;\n }), t2.dot && Object.entries(n2).forEach(([e3, t3]) => {\n e3.includes(`.`) && (_2(n2, e3, t3), delete n2[e3]);\n }), n2;\n}\nvar ee = (e2, t2, n2) => {\n e2[t2] === undefined ? t2.endsWith(`[]`) ? e2[t2] = [n2] : e2[t2] = n2 : Array.isArray(e2[t2]) ? e2[t2].push(n2) : e2[t2] = [e2[t2], n2];\n};\nvar _2 = (e2, t2, n2) => {\n let r2 = e2, i2 = t2.split(`.`);\n i2.forEach((e3, t3) => {\n t3 === i2.length - 1 ? r2[e3] = n2 : ((!r2[e3] || typeof r2[e3] != `object` || Array.isArray(r2[e3]) || r2[e3] instanceof File) && (r2[e3] = Object.create(null)), r2 = r2[e3]);\n });\n};\nvar v2 = (e2) => o(e2, g);\nvar y2 = class {\n raw;\n #validatedData;\n #matchResult;\n routeIndex = 0;\n path;\n bodyCache = {};\n constructor(e2, t2 = `/`, n2 = [[]]) {\n this.raw = e2, this.path = t2, this.#matchResult = n2, this.#validatedData = {};\n }\n param(e2) {\n return e2 ? this.#getDecodedParam(e2) : this.#getAllDecodedParams();\n }\n #getDecodedParam(e2) {\n let t2 = this.#matchResult[0][this.routeIndex][1][e2], n2 = this.#getParamValue(t2);\n return n2 && /\\%/.test(n2) ? v2(n2) : n2;\n }\n #getAllDecodedParams() {\n let e2 = {}, t2 = Object.keys(this.#matchResult[0][this.routeIndex][1]);\n for (let n2 of t2) {\n let t3 = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][n2]);\n t3 !== undefined && (e2[n2] = /\\%/.test(t3) ? v2(t3) : t3);\n }\n return e2;\n }\n #getParamValue(e2) {\n return this.#matchResult[1] ? this.#matchResult[1][e2] : e2;\n }\n query(e2) {\n return m(this.url, e2);\n }\n queries(e2) {\n return h(this.url, e2);\n }\n header(e2) {\n if (e2)\n return this.raw.headers.get(e2) ?? undefined;\n let t2 = {};\n return this.raw.headers.forEach((e3, n2) => {\n t2[n2] = e3;\n }), t2;\n }\n async parseBody(e2) {\n return this.bodyCache.parsedBody ??= await m2(this, e2);\n }\n #cachedBody = (e2) => {\n let { bodyCache: t2, raw: n2 } = this, r2 = t2[e2];\n if (r2)\n return r2;\n let i2 = Object.keys(t2)[0];\n return i2 ? t2[i2].then((t3) => (i2 === `json` && (t3 = JSON.stringify(t3)), new Response(t3)[e2]())) : t2[e2] = n2[e2]();\n };\n json() {\n return this.#cachedBody(`text`).then((e2) => JSON.parse(e2));\n }\n text() {\n return this.#cachedBody(`text`);\n }\n arrayBuffer() {\n return this.#cachedBody(`arrayBuffer`);\n }\n blob() {\n return this.#cachedBody(`blob`);\n }\n formData() {\n return this.#cachedBody(`formData`);\n }\n addValidatedData(e2, t2) {\n this.#validatedData[e2] = t2;\n }\n valid(e2) {\n return this.#validatedData[e2];\n }\n get url() {\n return this.raw.url;\n }\n get method() {\n return this.raw.method;\n }\n get [p2]() {\n return this.#matchResult;\n }\n get matchedRoutes() {\n return this.#matchResult[0].map(([[, e2]]) => e2);\n }\n get routePath() {\n return this.#matchResult[0].map(([[, e2]]) => e2)[this.routeIndex].path;\n }\n};\nvar te = { Stringify: 1, BeforeStream: 2, Stream: 3 };\nvar ne = (e2, t2) => {\n let n2 = new String(e2);\n return n2.isEscaped = true, n2.callbacks = t2, n2;\n};\nvar b = async (e2, t2, n2, r2, i2) => {\n typeof e2 == `object` && !(e2 instanceof String) && (e2 instanceof Promise || (e2 = e2.toString()), e2 instanceof Promise && (e2 = await e2));\n let a2 = e2.callbacks;\n if (!a2?.length)\n return Promise.resolve(e2);\n i2 ? i2[0] += e2 : i2 = [e2];\n let o2 = Promise.all(a2.map((e3) => e3({ phase: t2, buffer: i2, context: r2 }))).then((e3) => Promise.all(e3.filter(Boolean).map((e4) => b(e4, t2, false, r2, i2))).then(() => i2[0]));\n return n2 ? ne(await o2, a2) : o2;\n};\nvar x = `text/plain; charset=UTF-8`;\nvar S = (e2, t2) => ({ "Content-Type": e2, ...t2 });\nvar re = class {\n #rawRequest;\n #req;\n env = {};\n #var;\n finalized = false;\n error;\n #status;\n #executionCtx;\n #res;\n #layout;\n #renderer;\n #notFoundHandler;\n #preparedHeaders;\n #matchResult;\n #path;\n constructor(e2, t2) {\n this.#rawRequest = e2, t2 && (this.#executionCtx = t2.executionCtx, this.env = t2.env, this.#notFoundHandler = t2.notFoundHandler, this.#path = t2.path, this.#matchResult = t2.matchResult);\n }\n get req() {\n return this.#req ??= new y2(this.#rawRequest, this.#path, this.#matchResult), this.#req;\n }\n get event() {\n if (this.#executionCtx && `respondWith` in this.#executionCtx)\n return this.#executionCtx;\n throw Error(`This context has no FetchEvent`);\n }\n get executionCtx() {\n if (this.#executionCtx)\n return this.#executionCtx;\n throw Error(`This context has no ExecutionContext`);\n }\n get res() {\n return this.#res ||= new Response(null, { headers: this.#preparedHeaders ??= new Headers });\n }\n set res(e2) {\n if (this.#res && e2) {\n e2 = new Response(e2.body, e2);\n for (let [t2, n2] of this.#res.headers.entries())\n if (t2 !== `content-type`)\n if (t2 === `set-cookie`) {\n let t3 = this.#res.headers.getSetCookie();\n e2.headers.delete(`set-cookie`);\n for (let n3 of t3)\n e2.headers.append(`set-cookie`, n3);\n } else\n e2.headers.set(t2, n2);\n }\n this.#res = e2, this.finalized = true;\n }\n render = (...e2) => (this.#renderer ??= (e3) => this.html(e3), this.#renderer(...e2));\n setLayout = (e2) => this.#layout = e2;\n getLayout = () => this.#layout;\n setRenderer = (e2) => {\n this.#renderer = e2;\n };\n header = (e2, t2, n2) => {\n this.finalized && (this.#res = new Response(this.#res.body, this.#res));\n let r2 = this.#res ? this.#res.headers : this.#preparedHeaders ??= new Headers;\n t2 === undefined ? r2.delete(e2) : n2?.append ? r2.append(e2, t2) : r2.set(e2, t2);\n };\n status = (e2) => {\n this.#status = e2;\n };\n set = (e2, t2) => {\n this.#var ??= new Map, this.#var.set(e2, t2);\n };\n get = (e2) => this.#var ? this.#var.get(e2) : undefined;\n get var() {\n return this.#var ? Object.fromEntries(this.#var) : {};\n }\n #newResponse(e2, t2, n2) {\n let r2 = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders ?? new Headers;\n if (typeof t2 == `object` && `headers` in t2) {\n let e3 = t2.headers instanceof Headers ? t2.headers : new Headers(t2.headers);\n for (let [t3, n3] of e3)\n t3.toLowerCase() === `set-cookie` ? r2.append(t3, n3) : r2.set(t3, n3);\n }\n if (n2)\n for (let [e3, t3] of Object.entries(n2))\n if (typeof t3 == `string`)\n r2.set(e3, t3);\n else {\n r2.delete(e3);\n for (let n3 of t3)\n r2.append(e3, n3);\n }\n let i2 = typeof t2 == `number` ? t2 : t2?.status ?? this.#status;\n return new Response(e2, { status: i2, headers: r2 });\n }\n newResponse = (...e2) => this.#newResponse(...e2);\n body = (e2, t2, n2) => this.#newResponse(e2, t2, n2);\n text = (e2, t2, n2) => !this.#preparedHeaders && !this.#status && !t2 && !n2 && !this.finalized ? new Response(e2) : this.#newResponse(e2, t2, S(x, n2));\n json = (e2, t2, n2) => this.#newResponse(JSON.stringify(e2), t2, S(`application/json`, n2));\n html = (e2, t2, n2) => {\n let r2 = (e3) => this.#newResponse(e3, t2, S(`text/html; charset=UTF-8`, n2));\n return typeof e2 == `object` ? b(e2, te.Stringify, false, {}).then(r2) : r2(e2);\n };\n redirect = (e2, t2) => {\n let n2 = String(e2);\n return this.header(`Location`, /[^\\x00-\\xFF]/.test(n2) ? encodeURI(n2) : n2), this.newResponse(null, t2 ?? 302);\n };\n notFound = () => (this.#notFoundHandler ??= () => new Response, this.#notFoundHandler(this));\n};\nvar C = `ALL`;\nvar ie = `all`;\nvar ae = [`get`, `post`, `put`, `delete`, `options`, `patch`];\nvar w = `Can not add a route since the matcher is already built.`;\nvar T = class extends Error {\n};\nvar E = `__COMPOSED_HANDLER`;\nvar D = (e2) => e2.text(`404 Not Found`, 404);\nvar O = (e2, t2) => {\n if (`getResponse` in e2) {\n let n2 = e2.getResponse();\n return t2.newResponse(n2.body, n2);\n }\n return console.error(e2), t2.text(`Internal Server Error`, 500);\n};\nvar k = class {\n get;\n post;\n put;\n delete;\n options;\n patch;\n all;\n on;\n use;\n router;\n getPath;\n _basePath = `/`;\n #path = `/`;\n routes = [];\n constructor(e2 = {}) {\n [...ae, ie].forEach((e3) => {\n this[e3] = (t3, ...n2) => (typeof t3 == `string` ? this.#path = t3 : this.#addRoute(e3, this.#path, t3), n2.forEach((t4) => {\n this.#addRoute(e3, this.#path, t4);\n }), this);\n }), this.on = (e3, t3, ...n2) => {\n for (let r2 of [t3].flat()) {\n this.#path = r2;\n for (let t4 of [e3].flat())\n n2.map((e4) => {\n this.#addRoute(t4.toUpperCase(), this.#path, e4);\n });\n }\n return this;\n }, this.use = (e3, ...t3) => (typeof e3 == `string` ? this.#path = e3 : (this.#path = `*`, t3.unshift(e3)), t3.forEach((e4) => {\n this.#addRoute(C, this.#path, e4);\n }), this);\n let { strict: t2, ...i2 } = e2;\n Object.assign(this, i2), this.getPath = t2 ?? true ? e2.getPath ?? c : l;\n }\n #clone() {\n let e2 = new k({ router: this.router, getPath: this.getPath });\n return e2.errorHandler = this.errorHandler, e2.#notFoundHandler = this.#notFoundHandler, e2.routes = this.routes, e2;\n }\n #notFoundHandler = D;\n errorHandler = O;\n route(e2, t2) {\n let n2 = this.basePath(e2);\n return t2.routes.map((e3) => {\n let r2;\n t2.errorHandler === O ? r2 = e3.handler : (r2 = async (n3, r3) => (await f2([], t2.errorHandler)(n3, () => e3.handler(n3, r3))).res, r2[E] = e3.handler), n2.#addRoute(e3.method, e3.path, r2);\n }), this;\n }\n basePath(e2) {\n let t2 = this.#clone();\n return t2._basePath = u(this._basePath, e2), t2;\n }\n onError = (e2) => (this.errorHandler = e2, this);\n notFound = (e2) => (this.#notFoundHandler = e2, this);\n mount(e2, t2, n2) {\n let r2, i2;\n n2 && (typeof n2 == `function` ? i2 = n2 : (i2 = n2.optionHandler, r2 = n2.replaceRequest === false ? (e3) => e3 : n2.replaceRequest));\n let a2 = i2 ? (e3) => {\n let t3 = i2(e3);\n return Array.isArray(t3) ? t3 : [t3];\n } : (e3) => {\n let t3;\n try {\n t3 = e3.executionCtx;\n } catch {}\n return [e3.env, t3];\n };\n return r2 ||= (() => {\n let t3 = u(this._basePath, e2), n3 = t3 === `/` ? 0 : t3.length;\n return (e3) => {\n let t4 = new URL(e3.url);\n return t4.pathname = t4.pathname.slice(n3) || `/`, new Request(t4, e3);\n };\n })(), this.#addRoute(C, u(e2, `*`), async (e3, n3) => {\n let i3 = await t2(r2(e3.req.raw), ...a2(e3));\n if (i3)\n return i3;\n await n3();\n }), this;\n }\n #addRoute(e2, t2, n2) {\n e2 = e2.toUpperCase(), t2 = u(this._basePath, t2);\n let r2 = { basePath: this._basePath, path: t2, method: e2, handler: n2 };\n this.router.add(e2, t2, [n2, r2]), this.routes.push(r2);\n }\n #handleError(e2, t2) {\n if (e2 instanceof Error)\n return this.errorHandler(e2, t2);\n throw e2;\n }\n #dispatch(e2, t2, n2, r2) {\n if (r2 === `HEAD`)\n return (async () => new Response(null, await this.#dispatch(e2, t2, n2, `GET`)))();\n let i2 = this.getPath(e2, { env: n2 }), a2 = this.router.match(r2, i2), o2 = new re(e2, { path: i2, matchResult: a2, env: n2, executionCtx: t2, notFoundHandler: this.#notFoundHandler });\n if (a2[0].length === 1) {\n let e3;\n try {\n e3 = a2[0][0][0][0](o2, async () => {\n o2.res = await this.#notFoundHandler(o2);\n });\n } catch (e4) {\n return this.#handleError(e4, o2);\n }\n return e3 instanceof Promise ? e3.then((e4) => e4 || (o2.finalized ? o2.res : this.#notFoundHandler(o2))).catch((e4) => this.#handleError(e4, o2)) : e3 ?? this.#notFoundHandler(o2);\n }\n let s2 = f2(a2[0], this.errorHandler, this.#notFoundHandler);\n return (async () => {\n try {\n let e3 = await s2(o2);\n if (!e3.finalized)\n throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");\n return e3.res;\n } catch (e3) {\n return this.#handleError(e3, o2);\n }\n })();\n }\n fetch = (e2, ...t2) => this.#dispatch(e2, t2[1], t2[0], e2.method);\n request = (e2, t2, n2, r2) => e2 instanceof Request ? this.fetch(t2 ? new Request(e2, t2) : e2, n2, r2) : (e2 = e2.toString(), this.fetch(new Request(/^https?:\\/\\//.test(e2) ? e2 : `http://localhost${u(`/`, e2)}`, t2), n2, r2));\n fire = () => {\n addEventListener(`fetch`, (e2) => {\n e2.respondWith(this.#dispatch(e2.request, e2, undefined, e2.request.method));\n });\n };\n};\nvar A = `[^/]+`;\nvar j = `.*`;\nvar M = `(?:|/.*)`;\nvar N = Symbol();\nvar oe = new Set(`.\\\\+*[^]$()`);\nfunction se(e2, t2) {\n return e2.length === 1 ? t2.length === 1 ? e2 < t2 ? -1 : 1 : -1 : t2.length === 1 || e2 === j || e2 === M ? 1 : t2 === j || t2 === M ? -1 : e2 === A ? 1 : t2 === A ? -1 : e2.length === t2.length ? e2 < t2 ? -1 : 1 : t2.length - e2.length;\n}\nvar P = class {\n #index;\n #varIndex;\n #children = Object.create(null);\n insert(e2, t2, n2, r2, i2) {\n if (e2.length === 0) {\n if (this.#index !== undefined)\n throw N;\n if (i2)\n return;\n this.#index = t2;\n return;\n }\n let [a2, ...o2] = e2, s2 = a2 === `*` ? o2.length === 0 ? [``, ``, j] : [``, ``, A] : a2 === `/*` ? [``, ``, M] : a2.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/), c2;\n if (s2) {\n let e3 = s2[1], t3 = s2[2] || A;\n if (e3 && s2[2] && (t3 === `.*` || (t3 = t3.replace(/^\\((?!\\?:)(?=[^)]+\\)$)/, `(?:`), /\\((?!\\?:)/.test(t3))))\n throw N;\n if (c2 = this.#children[t3], !c2) {\n if (Object.keys(this.#children).some((e4) => e4 !== j && e4 !== M))\n throw N;\n if (i2)\n return;\n c2 = this.#children[t3] = new P, e3 !== `` && (c2.#varIndex = r2.varIndex++);\n }\n !i2 && e3 !== `` && n2.push([e3, c2.#varIndex]);\n } else if (c2 = this.#children[a2], !c2) {\n if (Object.keys(this.#children).some((e3) => e3.length > 1 && e3 !== j && e3 !== M))\n throw N;\n if (i2)\n return;\n c2 = this.#children[a2] = new P;\n }\n c2.insert(o2, t2, n2, r2, i2);\n }\n buildRegExpStr() {\n let e2 = Object.keys(this.#children).sort(se).map((e3) => {\n let t2 = this.#children[e3];\n return (typeof t2.#varIndex == `number` ? `(${e3})@${t2.#varIndex}` : oe.has(e3) ? `\\\\${e3}` : e3) + t2.buildRegExpStr();\n });\n return typeof this.#index == `number` && e2.unshift(`#${this.#index}`), e2.length === 0 ? `` : e2.length === 1 ? e2[0] : `(?:` + e2.join(`|`) + `)`;\n }\n};\nvar ce = class {\n #context = { varIndex: 0 };\n #root = new P;\n insert(e2, t2, n2) {\n let r2 = [], i2 = [];\n for (let t3 = 0;; ) {\n let n3 = false;\n if (e2 = e2.replace(/\\{[^}]+\\}/g, (e3) => {\n let r3 = `@\\\\${t3}`;\n return i2[t3] = [r3, e3], t3++, n3 = true, r3;\n }), !n3)\n break;\n }\n let a2 = e2.match(/(?::[^\\/]+)|(?:\\/\\*$)|./g) || [];\n for (let e3 = i2.length - 1;e3 >= 0; e3--) {\n let [t3] = i2[e3];\n for (let n3 = a2.length - 1;n3 >= 0; n3--)\n if (a2[n3].indexOf(t3) !== -1) {\n a2[n3] = a2[n3].replace(t3, i2[e3][1]);\n break;\n }\n }\n return this.#root.insert(a2, t2, r2, this.#context, n2), r2;\n }\n buildRegExp() {\n let e2 = this.#root.buildRegExpStr();\n if (e2 === ``)\n return [/^$/, [], []];\n let t2 = 0, n2 = [], r2 = [];\n return e2 = e2.replace(/#(\\d+)|@(\\d+)|\\.\\*\\$/g, (e3, i2, a2) => i2 === undefined ? (a2 === undefined || (r2[Number(a2)] = ++t2), ``) : (n2[++t2] = Number(i2), `$()`)), [RegExp(`^${e2}`), n2, r2];\n }\n};\nvar F = [];\nvar I = [/^$/, [], Object.create(null)];\nvar L = Object.create(null);\nfunction R(e2) {\n return L[e2] ??= RegExp(e2 === `*` ? `` : `^${e2.replace(/\\/\\*$|([.\\\\+*[^\\]$()])/g, (e3, t2) => t2 ? `\\\\${t2}` : `(?:|/.*)`)}$`);\n}\nfunction z() {\n L = Object.create(null);\n}\nfunction B(e2) {\n let t2 = new ce, n2 = [];\n if (e2.length === 0)\n return I;\n let r2 = e2.map((e3) => [!/\\*|\\/:/.test(e3[0]), ...e3]).sort(([e3, t3], [n3, r3]) => e3 ? 1 : n3 ? -1 : t3.length - r3.length), i2 = Object.create(null);\n for (let e3 = 0, a3 = -1, o3 = r2.length;e3 < o3; e3++) {\n let [o4, s3, c3] = r2[e3];\n o4 ? i2[s3] = [c3.map(([e4]) => [e4, Object.create(null)]), F] : a3++;\n let l2;\n try {\n l2 = t2.insert(s3, a3, o4);\n } catch (e4) {\n throw e4 === N ? new T(s3) : e4;\n }\n o4 || (n2[a3] = c3.map(([e4, t3]) => {\n let n3 = Object.create(null);\n for (--t3;t3 >= 0; t3--) {\n let [e5, r3] = l2[t3];\n n3[e5] = r3;\n }\n return [e4, n3];\n }));\n }\n let [a2, o2, s2] = t2.buildRegExp();\n for (let e3 = 0, t3 = n2.length;e3 < t3; e3++)\n for (let t4 = 0, r3 = n2[e3].length;t4 < r3; t4++) {\n let r4 = n2[e3][t4]?.[1];\n if (!r4)\n continue;\n let i3 = Object.keys(r4);\n for (let e4 = 0, t5 = i3.length;e4 < t5; e4++)\n r4[i3[e4]] = s2[r4[i3[e4]]];\n }\n let c2 = [];\n for (let e3 in o2)\n c2[e3] = n2[o2[e3]];\n return [a2, c2, i2];\n}\nfunction V(e2, t2) {\n if (e2) {\n for (let n2 of Object.keys(e2).sort((e3, t3) => t3.length - e3.length))\n if (R(n2).test(t2))\n return [...e2[n2]];\n }\n}\nvar H = class {\n name = `RegExpRouter`;\n #middleware;\n #routes;\n constructor() {\n this.#middleware = { [C]: Object.create(null) }, this.#routes = { [C]: Object.create(null) };\n }\n add(t2, n2, r2) {\n let i2 = this.#middleware, a2 = this.#routes;\n if (!i2 || !a2)\n throw Error(w);\n i2[t2] || [i2, a2].forEach((e2) => {\n e2[t2] = Object.create(null), Object.keys(e2[C]).forEach((n3) => {\n e2[t2][n3] = [...e2[C][n3]];\n });\n }), n2 === `/*` && (n2 = `*`);\n let o2 = (n2.match(/\\/:/g) || []).length;\n if (/\\*$/.test(n2)) {\n let e2 = R(n2);\n t2 === C ? Object.keys(i2).forEach((e3) => {\n i2[e3][n2] ||= V(i2[e3], n2) || V(i2[C], n2) || [];\n }) : i2[t2][n2] ||= V(i2[t2], n2) || V(i2[C], n2) || [], Object.keys(i2).forEach((n3) => {\n (t2 === C || t2 === n3) && Object.keys(i2[n3]).forEach((t3) => {\n e2.test(t3) && i2[n3][t3].push([r2, o2]);\n });\n }), Object.keys(a2).forEach((n3) => {\n (t2 === C || t2 === n3) && Object.keys(a2[n3]).forEach((t3) => e2.test(t3) && a2[n3][t3].push([r2, o2]));\n });\n return;\n }\n let s2 = d(n2) || [n2];\n for (let e2 = 0, n3 = s2.length;e2 < n3; e2++) {\n let c2 = s2[e2];\n Object.keys(a2).forEach((s3) => {\n (t2 === C || t2 === s3) && (a2[s3][c2] ||= [...V(i2[s3], c2) || V(i2[C], c2) || []], a2[s3][c2].push([r2, o2 - n3 + e2 + 1]));\n });\n }\n }\n match(e2, t2) {\n z();\n let n2 = this.#buildAllMatchers();\n return this.match = (e3, t3) => {\n let r2 = n2[e3] || n2[C], i2 = r2[2][t3];\n if (i2)\n return i2;\n let a2 = t3.match(r2[0]);\n if (!a2)\n return [[], F];\n let o2 = a2.indexOf(``, 1);\n return [r2[1][o2], a2];\n }, this.match(e2, t2);\n }\n #buildAllMatchers() {\n let e2 = Object.create(null);\n return Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((t2) => {\n e2[t2] ||= this.#buildMatcher(t2);\n }), this.#middleware = this.#routes = undefined, e2;\n }\n #buildMatcher(e2) {\n let t2 = [], n2 = e2 === C;\n return [this.#middleware, this.#routes].forEach((r2) => {\n let i2 = r2[e2] ? Object.keys(r2[e2]).map((t3) => [t3, r2[e2][t3]]) : [];\n i2.length === 0 ? e2 !== C && t2.push(...Object.keys(r2[C]).map((e3) => [e3, r2[C][e3]])) : (n2 ||= true, t2.push(...i2));\n }), n2 ? B(t2) : null;\n }\n};\nvar U = class {\n name = `SmartRouter`;\n #routers = [];\n #routes = [];\n constructor(e2) {\n this.#routers = e2.routers;\n }\n add(e2, t2, n2) {\n if (!this.#routes)\n throw Error(w);\n this.#routes.push([e2, t2, n2]);\n }\n match(e2, t2) {\n if (!this.#routes)\n throw Error(`Fatal error`);\n let n2 = this.#routers, r2 = this.#routes, i2 = n2.length, a2 = 0, o2;\n for (;a2 < i2; a2++) {\n let i3 = n2[a2];\n try {\n for (let e3 = 0, t3 = r2.length;e3 < t3; e3++)\n i3.add(...r2[e3]);\n o2 = i3.match(e2, t2);\n } catch (e3) {\n if (e3 instanceof T)\n continue;\n throw e3;\n }\n this.match = i3.match.bind(i3), this.#routers = [i3], this.#routes = undefined;\n break;\n }\n if (a2 === i2)\n throw Error(`Fatal error`);\n return this.name = `SmartRouter + ${this.activeRouter.name}`, o2;\n }\n get activeRouter() {\n if (this.#routes || this.#routers.length !== 1)\n throw Error(`No active router has been determined yet.`);\n return this.#routers[0];\n }\n};\nvar W = Object.create(null);\nvar G = class {\n #methods;\n #children;\n #patterns;\n #order = 0;\n #params = W;\n constructor(e2, t2, n2) {\n if (this.#children = n2 || Object.create(null), this.#methods = [], e2 && t2) {\n let n3 = Object.create(null);\n n3[e2] = { handler: t2, possibleKeys: [], score: 0 }, this.#methods = [n3];\n }\n this.#patterns = [];\n }\n insert(e2, t2, n2) {\n this.#order = ++this.#order;\n let r2 = this, a2 = t(t2), o2 = [];\n for (let e3 = 0, t3 = a2.length;e3 < t3; e3++) {\n let t4 = a2[e3], n3 = a2[e3 + 1], s2 = a(t4, n3), c2 = Array.isArray(s2) ? s2[0] : t4;\n if (c2 in r2.#children) {\n r2 = r2.#children[c2], s2 && o2.push(s2[1]);\n continue;\n }\n r2.#children[c2] = new G, s2 && (r2.#patterns.push(s2), o2.push(s2[1])), r2 = r2.#children[c2];\n }\n return r2.#methods.push({ [e2]: { handler: n2, possibleKeys: o2.filter((e3, t3, n3) => n3.indexOf(e3) === t3), score: this.#order } }), r2;\n }\n #getHandlerSets(e2, t2, n2, r2) {\n let i2 = [];\n for (let a2 = 0, o2 = e2.#methods.length;a2 < o2; a2++) {\n let o3 = e2.#methods[a2], s2 = o3[t2] || o3[C], c2 = {};\n if (s2 !== undefined && (s2.params = Object.create(null), i2.push(s2), n2 !== W || r2 && r2 !== W))\n for (let e3 = 0, t3 = s2.possibleKeys.length;e3 < t3; e3++) {\n let t4 = s2.possibleKeys[e3], i3 = c2[s2.score];\n s2.params[t4] = r2?.[t4] && !i3 ? r2[t4] : n2[t4] ?? r2?.[t4], c2[s2.score] = true;\n }\n }\n return i2;\n }\n search(e2, t2) {\n let n2 = [];\n this.#params = W;\n let r2 = [this], i2 = e(t2), a2 = [];\n for (let t3 = 0, o2 = i2.length;t3 < o2; t3++) {\n let s2 = i2[t3], c2 = t3 === o2 - 1, l2 = [];\n for (let o3 = 0, u2 = r2.length;o3 < u2; o3++) {\n let u3 = r2[o3], d2 = u3.#children[s2];\n d2 && (d2.#params = u3.#params, c2 ? (d2.#children[`*`] && n2.push(...this.#getHandlerSets(d2.#children[`*`], e2, u3.#params)), n2.push(...this.#getHandlerSets(d2, e2, u3.#params))) : l2.push(d2));\n for (let r3 = 0, o4 = u3.#patterns.length;r3 < o4; r3++) {\n let o5 = u3.#patterns[r3], d3 = u3.#params === W ? {} : { ...u3.#params };\n if (o5 === `*`) {\n let t4 = u3.#children[`*`];\n t4 && (n2.push(...this.#getHandlerSets(t4, e2, u3.#params)), t4.#params = d3, l2.push(t4));\n continue;\n }\n let [f3, p3, m3] = o5;\n if (!s2 && !(m3 instanceof RegExp))\n continue;\n let h3 = u3.#children[f3], g3 = i2.slice(t3).join(`/`);\n if (m3 instanceof RegExp) {\n let t4 = m3.exec(g3);\n if (t4) {\n if (d3[p3] = t4[0], n2.push(...this.#getHandlerSets(h3, e2, u3.#params, d3)), Object.keys(h3.#children).length) {\n h3.#params = d3;\n let e3 = t4[0].match(/\\//)?.length ?? 0;\n (a2[e3] ||= []).push(h3);\n }\n continue;\n }\n }\n (m3 === true || m3.test(s2)) && (d3[p3] = s2, c2 ? (n2.push(...this.#getHandlerSets(h3, e2, d3, u3.#params)), h3.#children[`*`] && n2.push(...this.#getHandlerSets(h3.#children[`*`], e2, d3, u3.#params))) : (h3.#params = d3, l2.push(h3)));\n }\n }\n r2 = l2.concat(a2.shift() ?? []);\n }\n return n2.length > 1 && n2.sort((e3, t3) => e3.score - t3.score), [n2.map(({ handler: e3, params: t3 }) => [e3, t3])];\n }\n};\nvar le = class {\n name = `TrieRouter`;\n #node;\n constructor() {\n this.#node = new G;\n }\n add(t2, n2, r2) {\n let i2 = d(n2);\n if (i2) {\n for (let e2 = 0, n3 = i2.length;e2 < n3; e2++)\n this.#node.insert(t2, i2[e2], r2);\n return;\n }\n this.#node.insert(t2, n2, r2);\n }\n match(e2, t2) {\n return this.#node.search(e2, t2);\n }\n};\nvar K = class extends k {\n constructor(e2 = {}) {\n super(e2), this.router = e2.router ?? new U({ routers: [new H, new le] });\n }\n};\nvar ue = (e2, t2, n2) => {\n let r2 = e2.req.raw.headers.get(`Cookie`);\n if (typeof t2 == `string`) {\n if (!r2)\n return;\n let e3 = t2;\n return n2 === `secure` ? e3 = `__Secure-` + t2 : n2 === `host` && (e3 = `__Host-` + t2), y(r2, e3)[e3];\n }\n return r2 ? y(r2) : {};\n};\nvar q = class extends Error {\n res;\n status;\n constructor(e2 = 500, t2) {\n super(t2?.message, { cause: t2?.cause }), this.res = t2?.res, this.status = e2;\n }\n getResponse() {\n return this.res ? new Response(this.res.body, { status: this.status, headers: this.res.headers }) : new Response(this.message, { status: this.status });\n }\n};\nvar de = (e2, t2) => new Response(e2, { headers: { "Content-Type": t2 } }).formData();\nvar fe = /^application\\/([a-z-\\.]+\\+)?json(;\\s*[a-zA-Z0-9\\-]+\\=([^;]+))*$/;\nvar pe = /^multipart\\/form-data(;\\s?boundary=[a-zA-Z0-9\'"()+_,\\-./:=?]+)?$/;\nvar me = /^application\\/x-www-form-urlencoded(;\\s*[a-zA-Z0-9\\-]+\\=([^;]+))*$/;\nvar J = (e2, t2) => async (n2, r2) => {\n let i2 = {}, a2 = n2.req.header(`Content-Type`);\n switch (e2) {\n case `json`:\n if (!a2 || !fe.test(a2))\n break;\n try {\n i2 = await n2.req.json();\n } catch {\n throw new q(400, { message: `Malformed JSON in request body` });\n }\n break;\n case `form`: {\n if (!a2 || !(pe.test(a2) || me.test(a2)))\n break;\n let e3;\n if (n2.req.bodyCache.formData)\n e3 = await n2.req.bodyCache.formData;\n else\n try {\n let t4 = await n2.req.arrayBuffer();\n e3 = await de(t4, a2), n2.req.bodyCache.formData = e3;\n } catch (e4) {\n let t4 = `Malformed FormData request.`;\n throw t4 += e4 instanceof Error ? ` ${e4.message}` : ` ${String(e4)}`, new q(400, { message: t4 });\n }\n let t3 = {};\n e3.forEach((e4, n3) => {\n n3.endsWith(`[]`) ? (t3[n3] ??= []).push(e4) : Array.isArray(t3[n3]) ? t3[n3].push(e4) : (n3 in t3) ? t3[n3] = [t3[n3], e4] : t3[n3] = e4;\n }), i2 = t3;\n break;\n }\n case `query`:\n i2 = Object.fromEntries(Object.entries(n2.req.queries()).map(([e3, t3]) => t3.length === 1 ? [e3, t3[0]] : [e3, t3]));\n break;\n case `param`:\n i2 = n2.req.param();\n break;\n case `header`:\n i2 = n2.req.header();\n break;\n case `cookie`:\n i2 = ue(n2);\n break;\n }\n let o2 = await t2(i2, n2);\n if (o2 instanceof Response)\n return o2;\n n2.req.addValidatedData(e2, o2), await r2();\n};\nvar Y = (e2, t2) => e2.json({ error: t2 }, 400);\nvar X = (e2) => {\n let t2 = e2.req.param(`key`);\n return !t2 || t2 === `` ? { key: t2, err: `Key is required` } : t2.length > 475 ? { key: t2, err: `Key is too long. Max length is 475 characters.` } : { key: t2 };\n};\nvar Z = () => new K;\nvar he = Z().get(`/:key`, async (e2) => {\n let { key: t2, err: n2 } = X(e2);\n if (n2)\n return Y(e2, n2);\n let r2 = await e2.env.store.get(t2);\n return e2.json({ value: r2 }, 200);\n}).post(`/:key`, J(`json`, (e2, t2) => {\n let n2 = e2.value;\n return n2 ? typeof n2 == `string` ? n2.length > 20000 ? Y(t2, `Value is too long. Max length is 20,000 characters.`) : { value: n2 } : Y(t2, `Value must be a string`) : Y(t2, `Value is required`);\n}), async (e2) => {\n let { key: t2, err: n2 } = X(e2);\n if (n2)\n return Y(e2, n2);\n let { value: r2 } = e2.req.valid(`json`);\n return await e2.env.store.set(t2, r2), e2.body(null, 204);\n}).delete(`/:key`, async (e2) => {\n let { key: t2, err: n2 } = X(e2);\n return n2 ? Y(e2, n2) : (await e2.env.store.delete(t2), e2.body(null, 204));\n}).get(`/`, async (e2) => {\n let { cursor: t2, limit: n2, prefix: r2 } = e2.req.query(), { entries: i2, cursor: a2 } = await e2.env.store.list(r2, { cursor: t2 ? String(t2) : undefined, limit: n2 ? Number(n2) : 100 });\n return e2.json({ entries: i2, cursor: a2 });\n});\nvar ge = (e2) => {\n let t2 = e2.req.param(`key`);\n return t2 ? t2.length > 475 ? { key: t2, err: `Key is too long. Max length is 475 characters.` } : { key: t2 } : { key: t2, err: `Key is required` };\n};\nvar Q = J(`param`, (e2) => ({ id: e2.id }));\nvar $ = Z().post(`/:key`, async (e2) => {\n let { key: t2, err: n2 } = ge(e2);\n return n2 ? Y(e2, n2) : e2.json(await e2.env.chat.upsert(t2), 200);\n}).get(`/:id`, Q, async (e2) => {\n let { id: t2 } = e2.req.valid(`param`);\n return e2.json(await e2.env.chat.get(t2), 200);\n}).get(`/:id/messages`, Q, async (e2) => {\n let { id: t2 } = e2.req.valid(`param`);\n return e2.json(await e2.env.chat.getMessages(t2), 200);\n}).post(`/:id/sendMessages`, J(`json`, (e2) => ({ id: e2.id, messages: e2.messages, options: e2.options })), async (e2) => {\n let { id: t2, messages: n2, options: r2 } = e2.req.valid(`json`);\n return t2 ? (await e2.env.chat.sendMessages(t2, n2, r2), e2.body(null, 204)) : Y(e2, `ID is required`);\n}).delete(`/:id/messages`, Q, J(`query`, (e2) => (typeof e2.message == `string` && (e2.message = [e2.message]), { messages: e2.message })), async (e2) => {\n let { id: t2 } = e2.req.valid(`param`), { messages: n2 } = e2.req.valid(`query`);\n return await e2.env.chat.deleteMessages(t2, n2), e2.body(null, 204);\n}).post(`/:id/start`, Q, async (e2) => {\n let { id: t2 } = e2.req.valid(`param`);\n return await e2.env.chat.start(t2), e2.body(null, 204);\n}).post(`/:id/stop`, Q, async (e2) => {\n let { id: t2 } = e2.req.valid(`param`);\n return await e2.env.chat.stop(t2), e2.body(null, 204);\n}).delete(`/:id`, Q, async (e2) => {\n let { id: t2 } = e2.req.valid(`param`);\n return await e2.env.chat.delete(t2), e2.body(null, 204);\n});\nvar _e = Z().post(`/v1/traces`, async (e2) => e2.env.otlp ? e2.env.otlp.traces(e2.req.raw) : e2.body(null, 204));\nvar ve = new K().onError((e2, t2) => t2.json({ error: e2 instanceof Error ? e2.message : `Unknown error` }, 500)).route(`/kv`, he).route(`/chat`, $).route(`/otlp`, _e);\n\n// ../../node_modules/@ai-sdk/provider/dist/index.mjs\nvar marker = "vercel.ai.error";\nvar symbol = Symbol.for(marker);\nvar _a;\nvar _AISDKError = class _AISDKError2 extends Error {\n constructor({\n name: name14,\n message,\n cause\n }) {\n super(message);\n this[_a] = true;\n this.name = name14;\n this.cause = cause;\n }\n static isInstance(error) {\n return _AISDKError2.hasMarker(error, marker);\n }\n static hasMarker(error, marker15) {\n const markerSymbol = Symbol.for(marker15);\n return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;\n }\n};\n_a = symbol;\nvar AISDKError = _AISDKError;\nvar name = "AI_APICallError";\nvar marker2 = `vercel.ai.error.${name}`;\nvar symbol2 = Symbol.for(marker2);\nvar _a2;\n_a2 = symbol2;\nvar name2 = "AI_EmptyResponseBodyError";\nvar marker3 = `vercel.ai.error.${name2}`;\nvar symbol3 = Symbol.for(marker3);\nvar _a3;\n_a3 = symbol3;\nfunction getErrorMessage(error) {\n if (error == null) {\n return "unknown error";\n }\n if (typeof error === "string") {\n return error;\n }\n if (error instanceof Error) {\n return error.message;\n }\n return JSON.stringify(error);\n}\nvar name3 = "AI_InvalidArgumentError";\nvar marker4 = `vercel.ai.error.${name3}`;\nvar symbol4 = Symbol.for(marker4);\nvar _a4;\nvar InvalidArgumentError = class extends AISDKError {\n constructor({\n message,\n cause,\n argument\n }) {\n super({ name: name3, message, cause });\n this[_a4] = true;\n this.argument = argument;\n }\n static isInstance(error) {\n return AISDKError.hasMarker(error, marker4);\n }\n};\n_a4 = symbol4;\nvar name4 = "AI_InvalidPromptError";\nvar marker5 = `vercel.ai.error.${name4}`;\nvar symbol5 = Symbol.for(marker5);\nvar _a5;\n_a5 = symbol5;\nvar name5 = "AI_InvalidResponseDataError";\nvar marker6 = `vercel.ai.error.${name5}`;\nvar symbol6 = Symbol.for(marker6);\nvar _a6;\n_a6 = symbol6;\nvar name6 = "AI_JSONParseError";\nvar marker7 = `vercel.ai.error.${name6}`;\nvar symbol7 = Symbol.for(marker7);\nvar _a7;\nvar JSONParseError = class extends AISDKError {\n constructor({ text, cause }) {\n super({\n name: name6,\n message: `JSON parsing failed: Text: ${text}.\nError message: ${getErrorMessage(cause)}`,\n cause\n });\n this[_a7] = true;\n this.text = text;\n }\n static isInstance(error) {\n return AISDKError.hasMarker(error, marker7);\n }\n};\n_a7 = symbol7;\nvar name7 = "AI_LoadAPIKeyError";\nvar marker8 = `vercel.ai.error.${name7}`;\nvar symbol8 = Symbol.for(marker8);\nvar _a8;\n_a8 = symbol8;\nvar name8 = "AI_LoadSettingError";\nvar marker9 = `vercel.ai.error.${name8}`;\nvar symbol9 = Symbol.for(marker9);\nvar _a9;\n_a9 = symbol9;\nvar name9 = "AI_NoContentGeneratedError";\nvar marker10 = `vercel.ai.error.${name9}`;\nvar symbol10 = Symbol.for(marker10);\nvar _a10;\n_a10 = symbol10;\nvar name10 = "AI_NoSuchModelError";\nvar marker11 = `vercel.ai.error.${name10}`;\nvar symbol11 = Symbol.for(marker11);\nvar _a11;\n_a11 = symbol11;\nvar name11 = "AI_TooManyEmbeddingValuesForCallError";\nvar marker12 = `vercel.ai.error.${name11}`;\nvar symbol12 = Symbol.for(marker12);\nvar _a12;\n_a12 = symbol12;\nvar name12 = "AI_TypeValidationError";\nvar marker13 = `vercel.ai.error.${name12}`;\nvar symbol13 = Symbol.for(marker13);\nvar _a13;\nvar _TypeValidationError = class _TypeValidationError2 extends AISDKError {\n constructor({ value, cause }) {\n super({\n name: name12,\n message: `Type validation failed: Value: ${JSON.stringify(value)}.\nError message: ${getErrorMessage(cause)}`,\n cause\n });\n this[_a13] = true;\n this.value = value;\n }\n static isInstance(error) {\n return AISDKError.hasMarker(error, marker13);\n }\n static wrap({\n value,\n cause\n }) {\n return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });\n }\n};\n_a13 = symbol13;\nvar TypeValidationError = _TypeValidationError;\nvar name13 = "AI_UnsupportedFunctionalityError";\nvar marker14 = `vercel.ai.error.${name13}`;\nvar symbol14 = Symbol.for(marker14);\nvar _a14;\n_a14 = symbol14;\n\n// ../../node_modules/zod/dist/esm/v4/classic/external.js\nvar exports_external = {};\n__export(exports_external, {\n xid: () => xid2,\n void: () => _void2,\n uuidv7: () => uuidv7,\n uuidv6: () => uuidv6,\n uuidv4: () => uuidv4,\n uuid: () => uuid2,\n url: () => url,\n uppercase: () => _uppercase,\n unknown: () => unknown,\n union: () => union,\n undefined: () => _undefined3,\n ulid: () => ulid2,\n uint64: () => uint64,\n uint32: () => uint32,\n tuple: () => tuple,\n trim: () => _trim,\n treeifyError: () => treeifyError,\n transform: () => transform,\n toUpperCase: () => _toUpperCase,\n toLowerCase: () => _toLowerCase,\n toJSONSchema: () => toJSONSchema,\n templateLiteral: () => templateLiteral,\n symbol: () => symbol15,\n superRefine: () => superRefine,\n success: () => success,\n stringbool: () => stringbool,\n string: () => string2,\n strictObject: () => strictObject,\n startsWith: () => _startsWith,\n size: () => _size,\n setErrorMap: () => setErrorMap,\n set: () => set,\n safeParseAsync: () => safeParseAsync2,\n safeParse: () => safeParse2,\n registry: () => registry,\n regexes: () => exports_regexes,\n regex: () => _regex,\n refine: () => refine,\n record: () => record,\n readonly: () => readonly,\n property: () => _property,\n promise: () => promise,\n prettifyError: () => prettifyError,\n preprocess: () => preprocess,\n prefault: () => prefault,\n positive: () => _positive,\n pipe: () => pipe,\n partialRecord: () => partialRecord,\n parseAsync: () => parseAsync2,\n parse: () => parse3,\n overwrite: () => _overwrite,\n optional: () => optional,\n object: () => object,\n number: () => number2,\n nullish: () => nullish2,\n nullable: () => nullable,\n null: () => _null3,\n normalize: () => _normalize,\n nonpositive: () => _nonpositive,\n nonoptional: () => nonoptional,\n nonnegative: () => _nonnegative,\n never: () => never,\n negative: () => _negative,\n nativeEnum: () => nativeEnum,\n nanoid: () => nanoid2,\n nan: () => nan,\n multipleOf: () => _multipleOf,\n minSize: () => _minSize,\n minLength: () => _minLength,\n mime: () => _mime,\n maxSize: () => _maxSize,\n maxLength: () => _maxLength,\n map: () => map,\n lte: () => _lte,\n lt: () => _lt,\n lowercase: () => _lowercase,\n looseObject: () => looseObject,\n locales: () => exports_locales,\n literal: () => literal,\n length: () => _length,\n lazy: () => lazy,\n ksuid: () => ksuid2,\n keyof: () => keyof,\n jwt: () => jwt,\n json: () => json,\n iso: () => exports_iso,\n ipv6: () => ipv62,\n ipv4: () => ipv42,\n intersection: () => intersection,\n int64: () => int64,\n int32: () => int32,\n int: () => int,\n instanceof: () => _instanceof,\n includes: () => _includes,\n guid: () => guid2,\n gte: () => _gte,\n gt: () => _gt,\n globalRegistry: () => globalRegistry,\n getErrorMap: () => getErrorMap,\n function: () => _function,\n formatError: () => formatError,\n float64: () => float64,\n float32: () => float32,\n flattenError: () => flattenError,\n file: () => file,\n enum: () => _enum2,\n endsWith: () => _endsWith,\n emoji: () => emoji2,\n email: () => email2,\n e164: () => e1642,\n discriminatedUnion: () => discriminatedUnion,\n date: () => date3,\n custom: () => custom,\n cuid2: () => cuid22,\n cuid: () => cuid3,\n core: () => exports_core2,\n config: () => config,\n coerce: () => exports_coerce,\n clone: () => clone,\n cidrv6: () => cidrv62,\n cidrv4: () => cidrv42,\n check: () => check,\n catch: () => _catch2,\n boolean: () => boolean2,\n bigint: () => bigint2,\n base64url: () => base64url2,\n base64: () => base642,\n array: () => array,\n any: () => any,\n _default: () => _default2,\n _ZodString: () => _ZodString,\n ZodXID: () => ZodXID,\n ZodVoid: () => ZodVoid,\n ZodUnknown: () => ZodUnknown,\n ZodUnion: () => ZodUnion,\n ZodUndefined: () => ZodUndefined,\n ZodUUID: () => ZodUUID,\n ZodURL: () => ZodURL,\n ZodULID: () => ZodULID,\n ZodType: () => ZodType,\n ZodTuple: () => ZodTuple,\n ZodTransform: () => ZodTransform,\n ZodTemplateLiteral: () => ZodTemplateLiteral,\n ZodSymbol: () => ZodSymbol,\n ZodSuccess: () => ZodSuccess,\n ZodStringFormat: () => ZodStringFormat,\n ZodString: () => ZodString,\n ZodSet: () => ZodSet,\n ZodRecord: () => ZodRecord,\n ZodRealError: () => ZodRealError,\n ZodReadonly: () => ZodReadonly,\n ZodPromise: () => ZodPromise,\n ZodPrefault: () => ZodPrefault,\n ZodPipe: () => ZodPipe,\n ZodOptional: () => ZodOptional,\n ZodObject: () => ZodObject,\n ZodNumberFormat: () => ZodNumberFormat,\n ZodNumber: () => ZodNumber,\n ZodNullable: () => ZodNullable,\n ZodNull: () => ZodNull,\n ZodNonOptional: () => ZodNonOptional,\n ZodNever: () => ZodNever,\n ZodNanoID: () => ZodNanoID,\n ZodNaN: () => ZodNaN,\n ZodMap: () => ZodMap,\n ZodLiteral: () => ZodLiteral,\n ZodLazy: () => ZodLazy,\n ZodKSUID: () => ZodKSUID,\n ZodJWT: () => ZodJWT,\n ZodIssueCode: () => ZodIssueCode,\n ZodIntersection: () => ZodIntersection,\n ZodISOTime: () => ZodISOTime,\n ZodISODuration: () => ZodISODuration,\n ZodISODateTime: () => ZodISODateTime,\n ZodISODate: () => ZodISODate,\n ZodIPv6: () => ZodIPv6,\n ZodIPv4: () => ZodIPv4,\n ZodGUID: () => ZodGUID,\n ZodFile: () => ZodFile,\n ZodError: () => ZodError,\n ZodEnum: () => ZodEnum,\n ZodEmoji: () => ZodEmoji,\n ZodEmail: () => ZodEmail,\n ZodE164: () => ZodE164,\n ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,\n ZodDefault: () => ZodDefault,\n ZodDate: () => ZodDate,\n ZodCustom: () => ZodCustom,\n ZodCatch: () => ZodCatch,\n ZodCUID2: () => ZodCUID2,\n ZodCUID: () => ZodCUID,\n ZodCIDRv6: () => ZodCIDRv6,\n ZodCIDRv4: () => ZodCIDRv4,\n ZodBoolean: () => ZodBoolean,\n ZodBigIntFormat: () => ZodBigIntFormat,\n ZodBigInt: () => ZodBigInt,\n ZodBase64URL: () => ZodBase64URL,\n ZodBase64: () => ZodBase64,\n ZodArray: () => ZodArray,\n ZodAny: () => ZodAny,\n NEVER: () => NEVER,\n $output: () => $output,\n $input: () => $input,\n $brand: () => $brand\n});\n\n// ../../node_modules/zod/dist/esm/v4/core/index.js\nvar exports_core2 = {};\n__export(exports_core2, {\n version: () => version,\n util: () => exports_util,\n treeifyError: () => treeifyError,\n toJSONSchema: () => toJSONSchema,\n toDotPath: () => toDotPath,\n safeParseAsync: () => safeParseAsync,\n safeParse: () => safeParse,\n registry: () => registry,\n regexes: () => exports_regexes,\n prettifyError: () => prettifyError,\n parseAsync: () => parseAsync,\n parse: () => parse,\n locales: () => exports_locales,\n isValidJWT: () => isValidJWT,\n isValidBase64URL: () => isValidBase64URL,\n isValidBase64: () => isValidBase64,\n globalRegistry: () => globalRegistry,\n globalConfig: () => globalConfig,\n function: () => _function,\n formatError: () => formatError,\n flattenError: () => flattenError,\n config: () => config,\n clone: () => clone,\n _xid: () => _xid,\n _void: () => _void,\n _uuidv7: () => _uuidv7,\n _uuidv6: () => _uuidv6,\n _uuidv4: () => _uuidv4,\n _uuid: () => _uuid,\n _url: () => _url,\n _uppercase: () => _uppercase,\n _unknown: () => _unknown,\n _union: () => _union,\n _undefined: () => _undefined2,\n _ulid: () => _ulid,\n _uint64: () => _uint64,\n _uint32: () => _uint32,\n _tuple: () => _tuple,\n _trim: () => _trim,\n _transform: () => _transform,\n _toUpperCase: () => _toUpperCase,\n _toLowerCase: () => _toLowerCase,\n _templateLiteral: () => _templateLiteral,\n _symbol: () => _symbol,\n _success: () => _success,\n _stringbool: () => _stringbool,\n _string: () => _string,\n _startsWith: () => _startsWith,\n _size: () => _size,\n _set: () => _set,\n _safeParseAsync: () => _safeParseAsync,\n _safeParse: () => _safeParse,\n _regex: () => _regex,\n _refine: () => _refine,\n _record: () => _record,\n _readonly: () => _readonly,\n _property: () => _property,\n _promise: () => _promise,\n _positive: () => _positive,\n _pipe: () => _pipe,\n _parseAsync: () => _parseAsync,\n _parse: () => _parse,\n _overwrite: () => _overwrite,\n _optional: () => _optional,\n _number: () => _number,\n _nullable: () => _nullable,\n _null: () => _null2,\n _normalize: () => _normalize,\n _nonpositive: () => _nonpositive,\n _nonoptional: () => _nonoptional,\n _nonnegative: () => _nonnegative,\n _never: () => _never,\n _negative: () => _negative,\n _nativeEnum: () => _nativeEnum,\n _nanoid: () => _nanoid,\n _nan: () => _nan,\n _multipleOf: () => _multipleOf,\n _minSize: () => _minSize,\n _minLength: () => _minLength,\n _min: () => _gte,\n _mime: () => _mime,\n _maxSize: () => _maxSize,\n _maxLength: () => _maxLength,\n _max: () => _lte,\n _map: () => _map,\n _lte: () => _lte,\n _lt: () => _lt,\n _lowercase: () => _lowercase,\n _literal: () => _literal,\n _length: () => _length,\n _lazy: () => _lazy,\n _ksuid: () => _ksuid,\n _jwt: () => _jwt,\n _isoTime: () => _isoTime,\n _isoDuration: () => _isoDuration,\n _isoDateTime: () => _isoDateTime,\n _isoDate: () => _isoDate,\n _ipv6: () => _ipv6,\n _ipv4: () => _ipv4,\n _intersection: () => _intersection,\n _int64: () => _int64,\n _int32: () => _int32,\n _int: () => _int,\n _includes: () => _includes,\n _guid: () => _guid,\n _gte: () => _gte,\n _gt: () => _gt,\n _float64: () => _float64,\n _float32: () => _float32,\n _file: () => _file,\n _enum: () => _enum,\n _endsWith: () => _endsWith,\n _emoji: () => _emoji2,\n _email: () => _email,\n _e164: () => _e164,\n _discriminatedUnion: () => _discriminatedUnion,\n _default: () => _default,\n _date: () => _date,\n _custom: () => _custom,\n _cuid2: () => _cuid2,\n _cuid: () => _cuid,\n _coercedString: () => _coercedString,\n _coercedNumber: () => _coercedNumber,\n _coercedDate: () => _coercedDate,\n _coercedBoolean: () => _coercedBoolean,\n _coercedBigint: () => _coercedBigint,\n _cidrv6: () => _cidrv6,\n _cidrv4: () => _cidrv4,\n _catch: () => _catch,\n _boolean: () => _boolean,\n _bigint: () => _bigint,\n _base64url: () => _base64url,\n _base64: () => _base64,\n _array: () => _array,\n _any: () => _any,\n JSONSchemaGenerator: () => JSONSchemaGenerator,\n JSONSchema: () => exports_json_schema,\n Doc: () => Doc,\n $output: () => $output,\n $input: () => $input,\n $constructor: () => $constructor,\n $brand: () => $brand,\n $ZodXID: () => $ZodXID,\n $ZodVoid: () => $ZodVoid,\n $ZodUnknown: () => $ZodUnknown,\n $ZodUnion: () => $ZodUnion,\n $ZodUndefined: () => $ZodUndefined,\n $ZodUUID: () => $ZodUUID,\n $ZodURL: () => $ZodURL,\n $ZodULID: () => $ZodULID,\n $ZodType: () => $ZodType,\n $ZodTuple: () => $ZodTuple,\n $ZodTransform: () => $ZodTransform,\n $ZodTemplateLiteral: () => $ZodTemplateLiteral,\n $ZodSymbol: () => $ZodSymbol,\n $ZodSuccess: () => $ZodSuccess,\n $ZodStringFormat: () => $ZodStringFormat,\n $ZodString: () => $ZodString,\n $ZodSet: () => $ZodSet,\n $ZodRegistry: () => $ZodRegistry,\n $ZodRecord: () => $ZodRecord,\n $ZodRealError: () => $ZodRealError,\n $ZodReadonly: () => $ZodReadonly,\n $ZodPromise: () => $ZodPromise,\n $ZodPrefault: () => $ZodPrefault,\n $ZodPipe: () => $ZodPipe,\n $ZodOptional: () => $ZodOptional,\n $ZodObject: () => $ZodObject,\n $ZodNumberFormat: () => $ZodNumberFormat,\n $ZodNumber: () => $ZodNumber,\n $ZodNullable: () => $ZodNullable,\n $ZodNull: () => $ZodNull,\n $ZodNonOptional: () => $ZodNonOptional,\n $ZodNever: () => $ZodNever,\n $ZodNanoID: () => $ZodNanoID,\n $ZodNaN: () => $ZodNaN,\n $ZodMap: () => $ZodMap,\n $ZodLiteral: () => $ZodLiteral,\n $ZodLazy: () => $ZodLazy,\n $ZodKSUID: () => $ZodKSUID,\n $ZodJWT: () => $ZodJWT,\n $ZodIntersection: () => $ZodIntersection,\n $ZodISOTime: () => $ZodISOTime,\n $ZodISODuration: () => $ZodISODuration,\n $ZodISODateTime: () => $ZodISODateTime,\n $ZodISODate: () => $ZodISODate,\n $ZodIPv6: () => $ZodIPv6,\n $ZodIPv4: () => $ZodIPv4,\n $ZodGUID: () => $ZodGUID,\n $ZodFunction: () => $ZodFunction,\n $ZodFile: () => $ZodFile,\n $ZodError: () => $ZodError,\n $ZodEnum: () => $ZodEnum,\n $ZodEmoji: () => $ZodEmoji,\n $ZodEmail: () => $ZodEmail,\n $ZodE164: () => $ZodE164,\n $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,\n $ZodDefault: () => $ZodDefault,\n $ZodDate: () => $ZodDate,\n $ZodCustom: () => $ZodCustom,\n $ZodCheckUpperCase: () => $ZodCheckUpperCase,\n $ZodCheckStringFormat: () => $ZodCheckStringFormat,\n $ZodCheckStartsWith: () => $ZodCheckStartsWith,\n $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,\n $ZodCheckRegex: () => $ZodCheckRegex,\n $ZodCheckProperty: () => $ZodCheckProperty,\n $ZodCheckOverwrite: () => $ZodCheckOverwrite,\n $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,\n $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,\n $ZodCheckMinSize: () => $ZodCheckMinSize,\n $ZodCheckMinLength: () => $ZodCheckMinLength,\n $ZodCheckMimeType: () => $ZodCheckMimeType,\n $ZodCheckMaxSize: () => $ZodCheckMaxSize,\n $ZodCheckMaxLength: () => $ZodCheckMaxLength,\n $ZodCheckLowerCase: () => $ZodCheckLowerCase,\n $ZodCheckLessThan: () => $ZodCheckLessThan,\n $ZodCheckLengthEquals: () => $ZodCheckLengthEquals,\n $ZodCheckIncludes: () => $ZodCheckIncludes,\n $ZodCheckGreaterThan: () => $ZodCheckGreaterThan,\n $ZodCheckEndsWith: () => $ZodCheckEndsWith,\n $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,\n $ZodCheck: () => $ZodCheck,\n $ZodCatch: () => $ZodCatch,\n $ZodCUID2: () => $ZodCUID2,\n $ZodCUID: () => $ZodCUID,\n $ZodCIDRv6: () => $ZodCIDRv6,\n $ZodCIDRv4: () => $ZodCIDRv4,\n $ZodBoolean: () => $ZodBoolean,\n $ZodBigIntFormat: () => $ZodBigIntFormat,\n $ZodBigInt: () => $ZodBigInt,\n $ZodBase64URL: () => $ZodBase64URL,\n $ZodBase64: () => $ZodBase64,\n $ZodAsyncError: () => $ZodAsyncError,\n $ZodArray: () => $ZodArray,\n $ZodAny: () => $ZodAny\n});\n\n// ../../node_modules/zod/dist/esm/v4/core/core.js\nfunction $constructor(name14, initializer, params) {\n function init(inst, def) {\n var _a15;\n Object.defineProperty(inst, "_zod", {\n value: inst._zod ?? {},\n enumerable: false\n });\n (_a15 = inst._zod).traits ?? (_a15.traits = new Set);\n inst._zod.traits.add(name14);\n initializer(inst, def);\n for (const k2 in _3.prototype) {\n if (!(k2 in inst))\n Object.defineProperty(inst, k2, { value: _3.prototype[k2].bind(inst) });\n }\n inst._zod.constr = _3;\n inst._zod.def = def;\n }\n const Parent = params?.Parent ?? Object;\n\n class Definition extends Parent {\n }\n Object.defineProperty(Definition, "name", { value: name14 });\n function _3(def) {\n var _a15;\n const inst = params?.Parent ? new Definition : this;\n init(inst, def);\n (_a15 = inst._zod).deferred ?? (_a15.deferred = []);\n for (const fn of inst._zod.deferred) {\n fn();\n }\n return inst;\n }\n Object.defineProperty(_3, "init", { value: init });\n Object.defineProperty(_3, Symbol.hasInstance, {\n value: (inst) => {\n if (params?.Parent && inst instanceof params.Parent)\n return true;\n return inst?._zod?.traits?.has(name14);\n }\n });\n Object.defineProperty(_3, "name", { value: name14 });\n return _3;\n}\nvar $brand = Symbol("zod_brand");\n\nclass $ZodAsyncError extends Error {\n constructor() {\n super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);\n }\n}\nvar globalConfig = {};\nfunction config(newConfig) {\n if (newConfig)\n Object.assign(globalConfig, newConfig);\n return globalConfig;\n}\n// ../../node_modules/zod/dist/esm/v4/core/util.js\nvar exports_util = {};\n__export(exports_util, {\n unwrapMessage: () => unwrapMessage,\n stringifyPrimitive: () => stringifyPrimitive,\n required: () => required,\n randomString: () => randomString,\n propertyKeyTypes: () => propertyKeyTypes,\n promiseAllObject: () => promiseAllObject,\n primitiveTypes: () => primitiveTypes,\n prefixIssues: () => prefixIssues,\n pick: () => pick,\n partial: () => partial,\n optionalKeys: () => optionalKeys,\n omit: () => omit,\n numKeys: () => numKeys,\n nullish: () => nullish,\n normalizeParams: () => normalizeParams,\n merge: () => merge,\n jsonStringifyReplacer: () => jsonStringifyReplacer,\n joinValues: () => joinValues,\n issue: () => issue,\n isPlainObject: () => isPlainObject,\n isObject: () => isObject,\n getSizableOrigin: () => getSizableOrigin,\n getParsedType: () => getParsedType,\n getLengthableOrigin: () => getLengthableOrigin,\n getEnumValues: () => getEnumValues,\n getElementAtPath: () => getElementAtPath,\n floatSafeRemainder: () => floatSafeRemainder,\n finalizeIssue: () => finalizeIssue,\n extend: () => extend,\n escapeRegex: () => escapeRegex,\n esc: () => esc,\n defineLazy: () => defineLazy,\n createTransparentProxy: () => createTransparentProxy,\n clone: () => clone,\n cleanRegex: () => cleanRegex,\n cleanEnum: () => cleanEnum,\n cached: () => cached,\n assignProp: () => assignProp,\n assertNotEqual: () => assertNotEqual,\n assertNever: () => assertNever,\n assertIs: () => assertIs,\n assertEqual: () => assertEqual,\n assert: () => assert,\n allowsEval: () => allowsEval,\n aborted: () => aborted,\n NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,\n Class: () => Class,\n BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES\n});\nfunction assertEqual(val) {\n return val;\n}\nfunction assertNotEqual(val) {\n return val;\n}\nfunction assertIs(_arg) {}\nfunction assertNever(_x) {\n throw new Error;\n}\nfunction assert(_3) {}\nfunction getEnumValues(entries) {\n const numericValues = Object.values(entries).filter((v3) => typeof v3 === "number");\n const values = Object.entries(entries).filter(([k2, _3]) => numericValues.indexOf(+k2) === -1).map(([_3, v3]) => v3);\n return values;\n}\nfunction joinValues(array, separator = "|") {\n return array.map((val) => stringifyPrimitive(val)).join(separator);\n}\nfunction jsonStringifyReplacer(_3, value) {\n if (typeof value === "bigint")\n return value.toString();\n return value;\n}\nfunction cached(getter) {\n const set = false;\n return {\n get value() {\n if (!set) {\n const value = getter();\n Object.defineProperty(this, "value", { value });\n return value;\n }\n throw new Error("cached value already set");\n }\n };\n}\nfunction nullish(input) {\n return input === null || input === undefined;\n}\nfunction cleanRegex(source) {\n const start = source.startsWith("^") ? 1 : 0;\n const end = source.endsWith("$") ? source.length - 1 : source.length;\n return source.slice(start, end);\n}\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(".")[1] || "").length;\n const stepDecCount = (step.toString().split(".")[1] || "").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));\n return valInt % stepInt / 10 ** decCount;\n}\nfunction defineLazy(object, key, getter) {\n const set = false;\n Object.defineProperty(object, key, {\n get() {\n if (!set) {\n const value = getter();\n object[key] = value;\n return value;\n }\n throw new Error("cached value already set");\n },\n set(v3) {\n Object.defineProperty(object, key, {\n value: v3\n });\n },\n configurable: true\n });\n}\nfunction assignProp(target, prop, value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n}\nfunction getElementAtPath(obj, path) {\n if (!path)\n return obj;\n return path.reduce((acc, key) => acc?.[key], obj);\n}\nfunction promiseAllObject(promisesObj) {\n const keys = Object.keys(promisesObj);\n const promises = keys.map((key) => promisesObj[key]);\n return Promise.all(promises).then((results) => {\n const resolvedObj = {};\n for (let i2 = 0;i2 < keys.length; i2++) {\n resolvedObj[keys[i2]] = results[i2];\n }\n return resolvedObj;\n });\n}\nfunction randomString(length = 10) {\n const chars = "abcdefghijklmnopqrstuvwxyz";\n let str = "";\n for (let i2 = 0;i2 < length; i2++) {\n str += chars[Math.floor(Math.random() * chars.length)];\n }\n return str;\n}\nfunction esc(str) {\n return JSON.stringify(str);\n}\nfunction isObject(data) {\n return typeof data === "object" && data !== null && !Array.isArray(data);\n}\nvar allowsEval = cached(() => {\n try {\n const F2 = Function;\n new F2("");\n return true;\n } catch (_3) {\n return false;\n }\n});\nfunction isPlainObject(data) {\n return typeof data === "object" && data !== null && (Object.getPrototypeOf(data) === Object.prototype || Object.getPrototypeOf(data) === null);\n}\nfunction numKeys(data) {\n let keyCount = 0;\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n keyCount++;\n }\n }\n return keyCount;\n}\nvar getParsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "undefined":\n return "undefined";\n case "string":\n return "string";\n case "number":\n return Number.isNaN(data) ? "nan" : "number";\n case "boolean":\n return "boolean";\n case "function":\n return "function";\n case "bigint":\n return "bigint";\n case "symbol":\n return "symbol";\n case "object":\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {\n return "promise";\n }\n if (typeof Map !== "undefined" && data instanceof Map) {\n return "map";\n }\n if (typeof Set !== "undefined" && data instanceof Set) {\n return "set";\n }\n if (typeof Date !== "undefined" && data instanceof Date) {\n return "date";\n }\n if (typeof File !== "undefined" && data instanceof File) {\n return "file";\n }\n return "object";\n default:\n throw new Error(`Unknown data type: ${t2}`);\n }\n};\nvar propertyKeyTypes = new Set(["string", "number", "symbol"]);\nvar primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);\nfunction escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&");\n}\nfunction clone(inst, def, params) {\n const cl = new inst._zod.constr(def ?? inst._zod.def);\n if (!def || params?.parent)\n cl._zod.parent = inst;\n return cl;\n}\nfunction normalizeParams(_params) {\n const params = _params;\n if (!params)\n return {};\n if (typeof params === "string")\n return { error: () => params };\n if (params?.message !== undefined) {\n if (params?.error !== undefined)\n throw new Error("Cannot specify both `message` and `error` params");\n params.error = params.message;\n }\n delete params.message;\n if (typeof params.error === "string")\n return { ...params, error: () => params.error };\n return params;\n}\nfunction createTransparentProxy(getter) {\n let target;\n return new Proxy({}, {\n get(_3, prop, receiver) {\n target ?? (target = getter());\n return Reflect.get(target, prop, receiver);\n },\n set(_3, prop, value, receiver) {\n target ?? (target = getter());\n return Reflect.set(target, prop, value, receiver);\n },\n has(_3, prop) {\n target ?? (target = getter());\n return Reflect.has(target, prop);\n },\n deleteProperty(_3, prop) {\n target ?? (target = getter());\n return Reflect.deleteProperty(target, prop);\n },\n ownKeys(_3) {\n target ?? (target = getter());\n return Reflect.ownKeys(target);\n },\n getOwnPropertyDescriptor(_3, prop) {\n target ?? (target = getter());\n return Reflect.getOwnPropertyDescriptor(target, prop);\n },\n defineProperty(_3, prop, descriptor) {\n target ?? (target = getter());\n return Reflect.defineProperty(target, prop, descriptor);\n }\n });\n}\nfunction stringifyPrimitive(value) {\n if (typeof value === "bigint")\n return value.toString() + "n";\n if (typeof value === "string")\n return `"${value}"`;\n return `${value}`;\n}\nfunction optionalKeys(shape) {\n return Object.keys(shape).filter((k2) => {\n return shape[k2]._zod.optin === "optional" && shape[k2]._zod.optout === "optional";\n });\n}\nvar NUMBER_FORMAT_RANGES = {\n safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],\n int32: [-2147483648, 2147483647],\n uint32: [0, 4294967295],\n float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],\n float64: [-Number.MAX_VALUE, Number.MAX_VALUE]\n};\nvar BIGINT_FORMAT_RANGES = {\n int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],\n uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]\n};\nfunction pick(schema, mask) {\n const newShape = {};\n const currDef = schema._zod.def;\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: "${key}"`);\n }\n if (!mask[key])\n continue;\n newShape[key] = currDef.shape[key];\n }\n return clone(schema, {\n ...schema._zod.def,\n shape: newShape,\n checks: []\n });\n}\nfunction omit(schema, mask) {\n const newShape = { ...schema._zod.def.shape };\n const currDef = schema._zod.def;\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: "${key}"`);\n }\n if (!mask[key])\n continue;\n delete newShape[key];\n }\n return clone(schema, {\n ...schema._zod.def,\n shape: newShape,\n checks: []\n });\n}\nfunction extend(schema, shape) {\n const def = {\n ...schema._zod.def,\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, "shape", _shape);\n return _shape;\n },\n checks: []\n };\n return clone(schema, def);\n}\nfunction merge(a2, b2) {\n return clone(a2, {\n ...a2._zod.def,\n get shape() {\n const _shape = { ...a2._zod.def.shape, ...b2._zod.def.shape };\n assignProp(this, "shape", _shape);\n return _shape;\n },\n catchall: b2._zod.def.catchall,\n checks: []\n });\n}\nfunction partial(Class, schema, mask) {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in oldShape)) {\n throw new Error(`Unrecognized key: "${key}"`);\n }\n if (!mask[key])\n continue;\n shape[key] = Class ? new Class({\n type: "optional",\n innerType: oldShape[key]\n }) : oldShape[key];\n }\n } else {\n for (const key in oldShape) {\n shape[key] = Class ? new Class({\n type: "optional",\n innerType: oldShape[key]\n }) : oldShape[key];\n }\n }\n return clone(schema, {\n ...schema._zod.def,\n shape,\n checks: []\n });\n}\nfunction required(Class, schema, mask) {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in shape)) {\n throw new Error(`Unrecognized key: "${key}"`);\n }\n if (!mask[key])\n continue;\n shape[key] = new Class({\n type: "nonoptional",\n innerType: oldShape[key]\n });\n }\n } else {\n for (const key in oldShape) {\n shape[key] = new Class({\n type: "nonoptional",\n innerType: oldShape[key]\n });\n }\n }\n return clone(schema, {\n ...schema._zod.def,\n shape,\n checks: []\n });\n}\nfunction aborted(x2, startIndex = 0) {\n for (let i2 = startIndex;i2 < x2.issues.length; i2++) {\n if (x2.issues[i2].continue !== true)\n return true;\n }\n return false;\n}\nfunction prefixIssues(path, issues) {\n return issues.map((iss) => {\n var _a15;\n (_a15 = iss).path ?? (_a15.path = []);\n iss.path.unshift(path);\n return iss;\n });\n}\nfunction unwrapMessage(message) {\n return typeof message === "string" ? message : message?.message;\n}\nfunction finalizeIssue(iss, ctx, config2) {\n const full = { ...iss, path: iss.path ?? [] };\n if (!iss.message) {\n const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";\n full.message = message;\n }\n delete full.inst;\n delete full.continue;\n if (!ctx?.reportInput) {\n delete full.input;\n }\n return full;\n}\nfunction getSizableOrigin(input) {\n if (input instanceof Set)\n return "set";\n if (input instanceof Map)\n return "map";\n if (input instanceof File)\n return "file";\n return "unknown";\n}\nfunction getLengthableOrigin(input) {\n if (Array.isArray(input))\n return "array";\n if (typeof input === "string")\n return "string";\n return "unknown";\n}\nfunction issue(...args) {\n const [iss, input, inst] = args;\n if (typeof iss === "string") {\n return {\n message: iss,\n code: "custom",\n input,\n inst\n };\n }\n return { ...iss };\n}\nfunction cleanEnum(obj) {\n return Object.entries(obj).filter(([k2, _3]) => {\n return Number.isNaN(Number.parseInt(k2, 10));\n }).map((el) => el[1]);\n}\n\nclass Class {\n constructor(..._args) {}\n}\n\n// ../../node_modules/zod/dist/esm/v4/core/errors.js\nvar initializer = (inst, def) => {\n inst.name = "$ZodError";\n Object.defineProperty(inst, "_zod", {\n value: inst._zod,\n enumerable: false\n });\n Object.defineProperty(inst, "issues", {\n value: def,\n enumerable: false\n });\n Object.defineProperty(inst, "message", {\n get() {\n return JSON.stringify(def, jsonStringifyReplacer, 2);\n },\n enumerable: true\n });\n};\nvar $ZodError = $constructor("$ZodError", initializer);\nvar $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });\nfunction flattenError(error, mapper = (issue2) => issue2.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n } else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}\nfunction formatError(error, _mapper) {\n const mapper = _mapper || function(issue2) {\n return issue2.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error2) => {\n for (const issue2 of error2.issues) {\n if (issue2.code === "invalid_union" && issue2.errors.length) {\n issue2.errors.map((issues) => processError({ issues }));\n } else if (issue2.code === "invalid_key") {\n processError({ issues: issue2.issues });\n } else if (issue2.code === "invalid_element") {\n processError({ issues: issue2.issues });\n } else if (issue2.path.length === 0) {\n fieldErrors._errors.push(mapper(issue2));\n } else {\n let curr = fieldErrors;\n let i2 = 0;\n while (i2 < issue2.path.length) {\n const el = issue2.path[i2];\n const terminal = i2 === issue2.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n } else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue2));\n }\n curr = curr[el];\n i2++;\n }\n }\n }\n };\n processError(error);\n return fieldErrors;\n}\nfunction treeifyError(error, _mapper) {\n const mapper = _mapper || function(issue2) {\n return issue2.message;\n };\n const result = { errors: [] };\n const processError = (error2, path = []) => {\n var _a15, _b;\n for (const issue2 of error2.issues) {\n if (issue2.code === "invalid_union" && issue2.errors.length) {\n issue2.errors.map((issues) => processError({ issues }, issue2.path));\n } else if (issue2.code === "invalid_key") {\n processError({ issues: issue2.issues }, issue2.path);\n } else if (issue2.code === "invalid_element") {\n processError({ issues: issue2.issues }, issue2.path);\n } else {\n const fullpath = [...path, ...issue2.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue2));\n continue;\n }\n let curr = result;\n let i2 = 0;\n while (i2 < fullpath.length) {\n const el = fullpath[i2];\n const terminal = i2 === fullpath.length - 1;\n if (typeof el === "string") {\n curr.properties ?? (curr.properties = {});\n (_a15 = curr.properties)[el] ?? (_a15[el] = { errors: [] });\n curr = curr.properties[el];\n } else {\n curr.items ?? (curr.items = []);\n (_b = curr.items)[el] ?? (_b[el] = { errors: [] });\n curr = curr.items[el];\n }\n if (terminal) {\n curr.errors.push(mapper(issue2));\n }\n i2++;\n }\n }\n }\n };\n processError(error);\n return result;\n}\nfunction toDotPath(path) {\n const segs = [];\n for (const seg of path) {\n if (typeof seg === "number")\n segs.push(`[${seg}]`);\n else if (typeof seg === "symbol")\n segs.push(`[${JSON.stringify(String(seg))}]`);\n else if (/[^\\w$]/.test(seg))\n segs.push(`[${JSON.stringify(seg)}]`);\n else {\n if (segs.length)\n segs.push(".");\n segs.push(seg);\n }\n }\n return segs.join("");\n}\nfunction prettifyError(error) {\n const lines = [];\n const issues = [...error.issues].sort((a2, b2) => a2.path.length - b2.path.length);\n for (const issue2 of issues) {\n lines.push(`✖ ${issue2.message}`);\n if (issue2.path?.length)\n lines.push(` → at ${toDotPath(issue2.path)}`);\n }\n return lines.join(`\n`);\n}\n\n// ../../node_modules/zod/dist/esm/v4/core/parse.js\nvar _parse = (_Err) => (schema, value, _ctx, _params) => {\n const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new $ZodAsyncError;\n }\n if (result.issues.length) {\n const e2 = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));\n Error.captureStackTrace(e2, _params?.callee);\n throw e2;\n }\n return result.value;\n};\nvar parse = /* @__PURE__ */ _parse($ZodRealError);\nvar _parseAsync = (_Err) => async (schema, value, _ctx, params) => {\n const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n if (result.issues.length) {\n const e2 = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));\n Error.captureStackTrace(e2, params?.callee);\n throw e2;\n }\n return result.value;\n};\nvar parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);\nvar _safeParse = (_Err) => (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new $ZodAsyncError;\n }\n return result.issues.length ? {\n success: false,\n error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))\n } : { success: true, data: result.value };\n};\nvar safeParse = /* @__PURE__ */ _safeParse($ZodRealError);\nvar _safeParseAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n return result.issues.length ? {\n success: false,\n error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))\n } : { success: true, data: result.value };\n};\nvar safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);\n// ../../node_modules/zod/dist/esm/v4/core/regexes.js\nvar exports_regexes = {};\n__export(exports_regexes, {\n xid: () => xid,\n uuid7: () => uuid7,\n uuid6: () => uuid6,\n uuid4: () => uuid4,\n uuid: () => uuid,\n uppercase: () => uppercase,\n unicodeEmail: () => unicodeEmail,\n undefined: () => _undefined,\n ulid: () => ulid,\n time: () => time,\n string: () => string,\n rfc5322Email: () => rfc5322Email,\n number: () => number,\n null: () => _null,\n nanoid: () => nanoid,\n lowercase: () => lowercase,\n ksuid: () => ksuid,\n ipv6: () => ipv6,\n ipv4: () => ipv4,\n integer: () => integer,\n html5Email: () => html5Email,\n hostname: () => hostname,\n guid: () => guid,\n extendedDuration: () => extendedDuration,\n emoji: () => emoji,\n email: () => email,\n e164: () => e164,\n duration: () => duration,\n domain: () => domain,\n datetime: () => datetime,\n date: () => date,\n cuid2: () => cuid2,\n cuid: () => cuid,\n cidrv6: () => cidrv6,\n cidrv4: () => cidrv4,\n browserEmail: () => browserEmail,\n boolean: () => boolean,\n bigint: () => bigint,\n base64url: () => base64url,\n base64: () => base64,\n _emoji: () => _emoji\n});\nvar cuid = /^[cC][^\\s-]{8,}$/;\nvar cuid2 = /^[0-9a-z]+$/;\nvar ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;\nvar xid = /^[0-9a-vA-V]{20}$/;\nvar ksuid = /^[A-Za-z0-9]{27}$/;\nvar nanoid = /^[a-zA-Z0-9_-]{21}$/;\nvar duration = /^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;\nvar extendedDuration = /^[-+]?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)?)??$/;\nvar guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;\nvar uuid = (version) => {\n if (!version)\n return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;\n return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);\n};\nvar uuid4 = /* @__PURE__ */ uuid(4);\nvar uuid6 = /* @__PURE__ */ uuid(6);\nvar uuid7 = /* @__PURE__ */ uuid(7);\nvar email = /^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_\'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;\nvar html5Email = /^[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])?)*$/;\nvar rfc5322Email = /^(([^<>()\\[\\]\\\\.,;:\\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,}))$/;\nvar unicodeEmail = /^[^\\s@"]{1,64}@[^\\s@]{1,255}$/u;\nvar browserEmail = /^[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])?)*$/;\nvar _emoji = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nfunction emoji() {\n return new RegExp(_emoji, "u");\n}\nvar ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nvar ipv6 = /^(([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})$/;\nvar cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/;\nvar cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\nvar base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;\nvar base64url = /^[A-Za-z0-9_-]*$/;\nvar hostname = /^([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+$/;\nvar domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}$/;\nvar e164 = /^\\+(?:[0-9]){6,14}[0-9]$/;\nvar dateSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nvar date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);\nfunction timeSource(args) {\n let regex = `([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d`;\n if (args.precision) {\n regex = `${regex}\\\\.\\\\d{${args.precision}}`;\n } else if (args.precision == null) {\n regex = `${regex}(\\\\.\\\\d+)?`;\n }\n return regex;\n}\nfunction time(args) {\n return new RegExp(`^${timeSource(args)}$`);\n}\nfunction datetime(args) {\n let regex = `${dateSource}T${timeSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join("|")})`;\n return new RegExp(`^${regex}$`);\n}\nvar string = (params) => {\n const regex = params ? `[\\\\s\\\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\\\s\\\\S]*`;\n return new RegExp(`^${regex}$`);\n};\nvar bigint = /^\\d+n?$/;\nvar integer = /^\\d+$/;\nvar number = /^-?\\d+(?:\\.\\d+)?/i;\nvar boolean = /true|false/i;\nvar _null = /null/i;\nvar _undefined = /undefined/i;\nvar lowercase = /^[^A-Z]*$/;\nvar uppercase = /^[^a-z]*$/;\n\n// ../../node_modules/zod/dist/esm/v4/core/checks.js\nvar $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {\n var _a15;\n inst._zod ?? (inst._zod = {});\n inst._zod.def = def;\n (_a15 = inst._zod).onattach ?? (_a15.onattach = []);\n});\nvar numericOriginMap = {\n number: "number",\n bigint: "bigint",\n object: "date"\n};\nvar $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value];\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;\n if (def.value < curr) {\n if (def.inclusive)\n bag.maximum = def.value;\n else\n bag.exclusiveMaximum = def.value;\n }\n });\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {\n return;\n }\n payload.issues.push({\n origin,\n code: "too_big",\n maximum: def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value];\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;\n if (def.value > curr) {\n if (def.inclusive)\n bag.minimum = def.value;\n else\n bag.exclusiveMinimum = def.value;\n }\n });\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {\n return;\n }\n payload.issues.push({\n origin,\n code: "too_small",\n minimum: def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.onattach.push((inst2) => {\n var _a15;\n (_a15 = inst2._zod.bag).multipleOf ?? (_a15.multipleOf = def.value);\n });\n inst._zod.check = (payload) => {\n if (typeof payload.value !== typeof def.value)\n throw new Error("Cannot mix number and bigint in multiple_of check.");\n const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;\n if (isMultiple)\n return;\n payload.issues.push({\n origin: typeof payload.value,\n code: "not_multiple_of",\n divisor: def.value,\n input: payload.value,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {\n $ZodCheck.init(inst, def);\n def.format = def.format || "float64";\n const isInt = def.format?.includes("int");\n const origin = isInt ? "int" : "number";\n const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.format = def.format;\n bag.minimum = minimum;\n bag.maximum = maximum;\n if (isInt)\n bag.pattern = integer;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n if (isInt) {\n if (!Number.isInteger(input)) {\n payload.issues.push({\n expected: origin,\n format: def.format,\n code: "invalid_type",\n input,\n inst\n });\n return;\n }\n if (!Number.isSafeInteger(input)) {\n if (input > 0) {\n payload.issues.push({\n input,\n code: "too_big",\n maximum: Number.MAX_SAFE_INTEGER,\n note: "Integers must be within the safe integer range.",\n inst,\n origin,\n continue: !def.abort\n });\n } else {\n payload.issues.push({\n input,\n code: "too_small",\n minimum: Number.MIN_SAFE_INTEGER,\n note: "Integers must be within the safe integer range.",\n inst,\n origin,\n continue: !def.abort\n });\n }\n return;\n }\n }\n if (input < minimum) {\n payload.issues.push({\n origin: "number",\n input,\n code: "too_small",\n minimum,\n inclusive: true,\n inst,\n continue: !def.abort\n });\n }\n if (input > maximum) {\n payload.issues.push({\n origin: "number",\n input,\n code: "too_big",\n maximum,\n inst\n });\n }\n };\n});\nvar $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {\n $ZodCheck.init(inst, def);\n const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.format = def.format;\n bag.minimum = minimum;\n bag.maximum = maximum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n if (input < minimum) {\n payload.issues.push({\n origin: "bigint",\n input,\n code: "too_small",\n minimum,\n inclusive: true,\n inst,\n continue: !def.abort\n });\n }\n if (input > maximum) {\n payload.issues.push({\n origin: "bigint",\n input,\n code: "too_big",\n maximum,\n inst\n });\n }\n };\n});\nvar $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.when = (payload) => {\n const val = payload.value;\n return !nullish(val) && val.size !== undefined;\n };\n inst._zod.onattach.push((inst2) => {\n const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;\n if (def.maximum < curr)\n inst2._zod.bag.maximum = def.maximum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size <= def.maximum)\n return;\n payload.issues.push({\n origin: getSizableOrigin(input),\n code: "too_big",\n maximum: def.maximum,\n input,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.when = (payload) => {\n const val = payload.value;\n return !nullish(val) && val.size !== undefined;\n };\n inst._zod.onattach.push((inst2) => {\n const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;\n if (def.minimum > curr)\n inst2._zod.bag.minimum = def.minimum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size >= def.minimum)\n return;\n payload.issues.push({\n origin: getSizableOrigin(input),\n code: "too_small",\n minimum: def.minimum,\n input,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.when = (payload) => {\n const val = payload.value;\n return !nullish(val) && val.size !== undefined;\n };\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.minimum = def.size;\n bag.maximum = def.size;\n bag.size = def.size;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size === def.size)\n return;\n const tooBig = size > def.size;\n payload.issues.push({\n origin: getSizableOrigin(input),\n ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },\n input: payload.value,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.when = (payload) => {\n const val = payload.value;\n return !nullish(val) && val.length !== undefined;\n };\n inst._zod.onattach.push((inst2) => {\n const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;\n if (def.maximum < curr)\n inst2._zod.bag.maximum = def.maximum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const length = input.length;\n if (length <= def.maximum)\n return;\n const origin = getLengthableOrigin(input);\n payload.issues.push({\n origin,\n code: "too_big",\n maximum: def.maximum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.when = (payload) => {\n const val = payload.value;\n return !nullish(val) && val.length !== undefined;\n };\n inst._zod.onattach.push((inst2) => {\n const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;\n if (def.minimum > curr)\n inst2._zod.bag.minimum = def.minimum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const length = input.length;\n if (length >= def.minimum)\n return;\n const origin = getLengthableOrigin(input);\n payload.issues.push({\n origin,\n code: "too_small",\n minimum: def.minimum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.when = (payload) => {\n const val = payload.value;\n return !nullish(val) && val.length !== undefined;\n };\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.minimum = def.length;\n bag.maximum = def.length;\n bag.length = def.length;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const length = input.length;\n if (length === def.length)\n return;\n const origin = getLengthableOrigin(input);\n const tooBig = length > def.length;\n payload.issues.push({\n origin,\n ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },\n input: payload.value,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {\n var _a15;\n $ZodCheck.init(inst, def);\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.format = def.format;\n if (def.pattern) {\n bag.patterns ?? (bag.patterns = new Set);\n bag.patterns.add(def.pattern);\n }\n });\n (_a15 = inst._zod).check ?? (_a15.check = (payload) => {\n if (!def.pattern)\n throw new Error("Not implemented.");\n def.pattern.lastIndex = 0;\n if (def.pattern.test(payload.value))\n return;\n payload.issues.push({\n origin: "string",\n code: "invalid_format",\n format: def.format,\n input: payload.value,\n ...def.pattern ? { pattern: def.pattern.toString() } : {},\n inst,\n continue: !def.abort\n });\n });\n});\nvar $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {\n $ZodCheckStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n def.pattern.lastIndex = 0;\n if (def.pattern.test(payload.value))\n return;\n payload.issues.push({\n origin: "string",\n code: "invalid_format",\n format: "regex",\n input: payload.value,\n pattern: def.pattern.toString(),\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {\n def.pattern ?? (def.pattern = lowercase);\n $ZodCheckStringFormat.init(inst, def);\n});\nvar $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {\n def.pattern ?? (def.pattern = uppercase);\n $ZodCheckStringFormat.init(inst, def);\n});\nvar $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {\n $ZodCheck.init(inst, def);\n const escapedRegex = escapeRegex(def.includes);\n const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);\n def.pattern = pattern;\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.patterns ?? (bag.patterns = new Set);\n bag.patterns.add(pattern);\n });\n inst._zod.check = (payload) => {\n if (payload.value.includes(def.includes, def.position))\n return;\n payload.issues.push({\n origin: "string",\n code: "invalid_format",\n format: "includes",\n includes: def.includes,\n input: payload.value,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {\n $ZodCheck.init(inst, def);\n const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);\n def.pattern ?? (def.pattern = pattern);\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.patterns ?? (bag.patterns = new Set);\n bag.patterns.add(pattern);\n });\n inst._zod.check = (payload) => {\n if (payload.value.startsWith(def.prefix))\n return;\n payload.issues.push({\n origin: "string",\n code: "invalid_format",\n format: "starts_with",\n prefix: def.prefix,\n input: payload.value,\n inst,\n continue: !def.abort\n });\n };\n});\nvar $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {\n $ZodCheck.init(inst, def);\n const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);\n def.pattern ?? (def.pattern = pattern);\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.patterns ?? (bag.patterns = new Set);\n bag.patterns.add(pattern);\n });\n inst._zod.check = (payload) => {\n if (payload.value.endsWith(def.suffix))\n return;\n payload.issues.push({\n origin: "string",\n code: "invalid_format",\n format: "ends_with",\n suffix: def.suffix,\n input: payload.value,\n inst,\n continue: !def.abort\n });\n };\n});\nfunction handleCheckPropertyResult(result, payload, property) {\n if (result.issues.length) {\n payload.issues.push(...prefixIssues(property, result.issues));\n }\n}\nvar $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n const result = def.schema._zod.run({\n value: payload.value[def.property],\n issues: []\n }, {});\n if (result instanceof Promise) {\n return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property));\n }\n handleCheckPropertyResult(result, payload, def.property);\n return;\n };\n});\nvar $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {\n $ZodCheck.init(inst, def);\n const mimeSet = new Set(def.mime);\n inst._zod.onattach.push((inst2) => {\n inst2._zod.bag.mime = def.mime;\n });\n inst._zod.check = (payload) => {\n if (mimeSet.has(payload.value.type))\n return;\n payload.issues.push({\n code: "invalid_value",\n values: def.mime,\n input: payload.value.type,\n path: ["type"],\n inst\n });\n };\n});\nvar $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n payload.value = def.tx(payload.value);\n };\n});\n\n// ../../node_modules/zod/dist/esm/v4/core/doc.js\nclass Doc {\n constructor(args = []) {\n this.content = [];\n this.indent = 0;\n if (this)\n this.args = args;\n }\n indented(fn) {\n this.indent += 1;\n fn(this);\n this.indent -= 1;\n }\n write(arg) {\n if (typeof arg === "function") {\n arg(this, { execution: "sync" });\n arg(this, { execution: "async" });\n return;\n }\n const content = arg;\n const lines = content.split(`\n`).filter((x2) => x2);\n const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));\n const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);\n for (const line of dedented) {\n this.content.push(line);\n }\n }\n compile() {\n const F2 = Function;\n const args = this?.args;\n const content = this?.content ?? [``];\n const lines = [...content.map((x2) => ` ${x2}`)];\n return new F2(...args, lines.join(`\n`));\n }\n}\n\n// ../../node_modules/zod/dist/esm/v4/core/versions.js\nvar version = {\n major: 4,\n minor: 0,\n patch: 0\n};\n\n// ../../node_modules/zod/dist/esm/v4/core/schemas.js\nvar $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {\n var _a15;\n inst ?? (inst = {});\n inst._zod.id = def.type + "_" + randomString(10);\n inst._zod.def = def;\n inst._zod.bag = inst._zod.bag || {};\n inst._zod.version = version;\n const checks = [...inst._zod.def.checks ?? []];\n if (inst._zod.traits.has("$ZodCheck")) {\n checks.unshift(inst);\n }\n for (const ch of checks) {\n for (const fn of ch._zod.onattach) {\n fn(inst);\n }\n }\n if (checks.length === 0) {\n (_a15 = inst._zod).deferred ?? (_a15.deferred = []);\n inst._zod.deferred?.push(() => {\n inst._zod.run = inst._zod.parse;\n });\n } else {\n const runChecks = (payload, checks2, ctx) => {\n let isAborted = aborted(payload);\n let asyncResult;\n for (const ch of checks2) {\n if (ch._zod.when) {\n const shouldRun = ch._zod.when(payload);\n if (!shouldRun)\n continue;\n } else {\n if (isAborted) {\n continue;\n }\n }\n const currLen = payload.issues.length;\n const _3 = ch._zod.check(payload);\n if (_3 instanceof Promise && ctx?.async === false) {\n throw new $ZodAsyncError;\n }\n if (asyncResult || _3 instanceof Promise) {\n asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {\n await _3;\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n return;\n if (!isAborted)\n isAborted = aborted(payload, currLen);\n });\n } else {\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n continue;\n if (!isAborted)\n isAborted = aborted(payload, currLen);\n }\n }\n if (asyncResult) {\n return asyncResult.then(() => {\n return payload;\n });\n }\n return payload;\n };\n inst._zod.run = (payload, ctx) => {\n const result = inst._zod.parse(payload, ctx);\n if (result instanceof Promise) {\n if (ctx.async === false)\n throw new $ZodAsyncError;\n return result.then((result2) => runChecks(result2, checks, ctx));\n }\n return runChecks(result, checks, ctx);\n };\n }\n inst["~standard"] = {\n validate: (value) => {\n try {\n const r2 = safeParse(inst, value);\n return r2.success ? { value: r2.data } : { issues: r2.error?.issues };\n } catch (_3) {\n return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });\n }\n },\n vendor: "zod",\n version: 1\n };\n});\nvar $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);\n inst._zod.parse = (payload, _3) => {\n if (def.coerce)\n try {\n payload.value = String(payload.value);\n } catch (_4) {}\n if (typeof payload.value === "string")\n return payload;\n payload.issues.push({\n expected: "string",\n code: "invalid_type",\n input: payload.value,\n inst\n });\n return payload;\n };\n});\nvar $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {\n $ZodCheckStringFormat.init(inst, def);\n $ZodString.init(inst, def);\n});\nvar $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {\n def.pattern ?? (def.pattern = guid);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {\n if (def.version) {\n const versionMap = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8\n };\n const v3 = versionMap[def.version];\n if (v3 === undefined)\n throw new Error(`Invalid UUID version: "${def.version}"`);\n def.pattern ?? (def.pattern = uuid(v3));\n } else\n def.pattern ?? (def.pattern = uuid());\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {\n def.pattern ?? (def.pattern = email);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n try {\n const url = new URL(payload.value);\n if (def.hostname) {\n def.hostname.lastIndex = 0;\n if (!def.hostname.test(url.hostname)) {\n payload.issues.push({\n code: "invalid_format",\n format: "url",\n note: "Invalid hostname",\n pattern: hostname.source,\n input: payload.value,\n inst\n });\n }\n }\n if (def.protocol) {\n def.protocol.lastIndex = 0;\n if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {\n payload.issues.push({\n code: "invalid_format",\n format: "url",\n note: "Invalid protocol",\n pattern: def.protocol.source,\n input: payload.value,\n inst\n });\n }\n }\n return;\n } catch (_3) {\n payload.issues.push({\n code: "invalid_format",\n format: "url",\n input: payload.value,\n inst\n });\n }\n };\n});\nvar $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {\n def.pattern ?? (def.pattern = emoji());\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {\n def.pattern ?? (def.pattern = nanoid);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {\n def.pattern ?? (def.pattern = cuid);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {\n def.pattern ?? (def.pattern = cuid2);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {\n def.pattern ?? (def.pattern = ulid);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {\n def.pattern ?? (def.pattern = xid);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {\n def.pattern ?? (def.pattern = ksuid);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {\n def.pattern ?? (def.pattern = datetime(def));\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {\n def.pattern ?? (def.pattern = date);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {\n def.pattern ?? (def.pattern = time(def));\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {\n def.pattern ?? (def.pattern = duration);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {\n def.pattern ?? (def.pattern = ipv4);\n $ZodStringFormat.init(inst, def);\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.format = `ipv4`;\n });\n});\nvar $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {\n def.pattern ?? (def.pattern = ipv6);\n $ZodStringFormat.init(inst, def);\n inst._zod.onattach.push((inst2) => {\n const bag = inst2._zod.bag;\n bag.format = `ipv6`;\n });\n inst._zod.check = (payload) => {\n try {\n new URL(`http://[${payload.value}]`);\n } catch {\n payload.issues.push({\n code: "invalid_format",\n format: "ipv6",\n input: payload.value,\n inst\n });\n }\n };\n});\nvar $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {\n def.pattern ?? (def.pattern = cidrv4);\n $ZodStringFormat.init(inst, def);\n});\nvar $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {\n def.pattern ?? (def.pattern = cidrv6);\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n const [address, prefix] = payload.value.split("/");\n try {\n if (!prefix)\n throw new Error;\n const prefixNum = Number(prefix);\n if (`${prefixNum}` !== prefix)\n throw new Error;\n if (prefixNum < 0 || prefixNum > 128)\n throw new Error;\n new URL(`http://[${address}]`);\n } catch {\n payload.issues.push({\n code: "invalid_format",\n format: "cidrv6",\n input: payload.value,\n inst\n });\n }\n };\n});\nfunction isValidBase64(data) {\n if (data === "")\n return true;\n if (data.length % 4 !== 0)\n return false;\n try {\n atob(data);\n return true;\n } catch {\n return false;\n }\n}\nvar $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {\n def.pattern ?? (def.pattern = base64);\n $ZodStringFormat.init(inst, def);\n inst._zod.onattach.push((inst2) => {\n inst2._zod.bag.contentEncoding = "base64";\n });\n inst._zod.check = (payload) => {\n if (isValidBase64(payload.value))\n return;\n payload.issues.push({\n code: "invalid_format",\n format: "base64",\n input: payload.value,\n inst\n });\n };\n});\nfunction isValidBase64URL(data) {\n if (!base64url.test(data))\n return false;\n const base642 = data.replace(/[-_]/g, (c2) => c2 === "-" ? "+" : "/");\n const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");\n return isValidBase64(padded);\n}\nvar $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {\n def.pattern ?? (def.pattern = base64url);\n $ZodStringFormat.init(inst, def);\n inst._zod.onattach.push((inst2) => {\n inst2._zod.bag.contentEncoding = "base64url";\n });\n inst._zod.check = (payload) => {\n if (isValidBase64URL(payload.value))\n return;\n payload.issues.push({\n code: "invalid_format",\n format: "base64url",\n input: payload.value,\n inst\n });\n };\n});\nvar $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {\n def.pattern ?? (def.pattern = e164);\n $ZodStringFormat.init(inst, def);\n});\nfunction isValidJWT(token, algorithm = null) {\n try {\n const tokensParts = token.split(".");\n if (tokensParts.length !== 3)\n return false;\n const [header] = tokensParts;\n const parsedHeader = JSON.parse(atob(header));\n if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")\n return false;\n if (!parsedHeader.alg)\n return false;\n if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))\n return false;\n return true;\n } catch {\n return false;\n }\n}\nvar $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidJWT(payload.value, def.alg))\n return;\n payload.issues.push({\n code: "invalid_format",\n format: "jwt",\n input: payload.value,\n inst\n });\n };\n});\nvar $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = inst._zod.bag.pattern ?? number;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Number(payload.value);\n } catch (_3) {}\n const input = payload.value;\n if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {\n return payload;\n }\n const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : undefined : undefined;\n payload.issues.push({\n expected: "number",\n code: "invalid_type",\n input,\n inst,\n ...received ? { received } : {}\n });\n return payload;\n };\n});\nvar $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {\n $ZodCheckNumberFormat.init(inst, def);\n $ZodNumber.init(inst, def);\n});\nvar $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = boolean;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Boolean(payload.value);\n } catch (_3) {}\n const input = payload.value;\n if (typeof input === "boolean")\n return payload;\n payload.issues.push({\n expected: "boolean",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = bigint;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = BigInt(payload.value);\n } catch (_3) {}\n const { value: input } = payload;\n if (typeof input === "bigint")\n return payload;\n payload.issues.push({\n expected: "bigint",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {\n $ZodCheckBigIntFormat.init(inst, def);\n $ZodBigInt.init(inst, def);\n});\nvar $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const { value: input } = payload;\n if (typeof input === "symbol")\n return payload;\n payload.issues.push({\n expected: "symbol",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = _undefined;\n inst._zod.values = new Set([undefined]);\n inst._zod.parse = (payload, _ctx) => {\n const { value: input } = payload;\n if (typeof input === "undefined")\n return payload;\n payload.issues.push({\n expected: "undefined",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = _null;\n inst._zod.values = new Set([null]);\n inst._zod.parse = (payload, _ctx) => {\n const { value: input } = payload;\n if (input === null)\n return payload;\n payload.issues.push({\n expected: "null",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nvar $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nvar $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n payload.issues.push({\n expected: "never",\n code: "invalid_type",\n input: payload.value,\n inst\n });\n return payload;\n };\n});\nvar $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const { value: input } = payload;\n if (typeof input === "undefined")\n return payload;\n payload.issues.push({\n expected: "void",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce) {\n try {\n payload.value = new Date(payload.value);\n } catch (_err) {}\n }\n const input = payload.value;\n const isDate = input instanceof Date;\n const isValidDate = isDate && !Number.isNaN(input.getTime());\n if (isValidDate)\n return payload;\n payload.issues.push({\n expected: "date",\n code: "invalid_type",\n input,\n ...isDate ? { received: "Invalid Date" } : {},\n inst\n });\n return payload;\n };\n});\nfunction handleArrayResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nvar $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n expected: "array",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n }\n payload.value = Array(input.length);\n const proms = [];\n for (let i2 = 0;i2 < input.length; i2++) {\n const item = input[i2];\n const result = def.element._zod.run({\n value: item,\n issues: []\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));\n } else {\n handleArrayResult(result, payload, i2);\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload;\n };\n});\nfunction handleObjectResult(result, final, key) {\n if (result.issues.length) {\n final.issues.push(...prefixIssues(key, result.issues));\n }\n final.value[key] = result.value;\n}\nfunction handleOptionalObjectResult(result, final, key, input) {\n if (result.issues.length) {\n if (input[key] === undefined) {\n if (key in input) {\n final.value[key] = undefined;\n } else {\n final.value[key] = result.value;\n }\n } else {\n final.issues.push(...prefixIssues(key, result.issues));\n }\n } else if (result.value === undefined) {\n if (key in input)\n final.value[key] = undefined;\n } else {\n final.value[key] = result.value;\n }\n}\nvar $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {\n $ZodType.init(inst, def);\n const _normalized = cached(() => {\n const keys = Object.keys(def.shape);\n for (const k2 of keys) {\n if (!(def.shape[k2] instanceof $ZodType)) {\n throw new Error(`Invalid element at key "${k2}": expected a Zod schema`);\n }\n }\n const okeys = optionalKeys(def.shape);\n return {\n shape: def.shape,\n keys,\n keySet: new Set(keys),\n numKeys: keys.length,\n optionalKeys: new Set(okeys)\n };\n });\n defineLazy(inst._zod, "propValues", () => {\n const shape = def.shape;\n const propValues = {};\n for (const key in shape) {\n const field = shape[key]._zod;\n if (field.values) {\n propValues[key] ?? (propValues[key] = new Set);\n for (const v3 of field.values)\n propValues[key].add(v3);\n }\n }\n return propValues;\n });\n const generateFastpass = (shape) => {\n const doc = new Doc(["shape", "payload", "ctx"]);\n const { keys, optionalKeys: optionalKeys2 } = _normalized.value;\n const parseStr = (key) => {\n const k2 = esc(key);\n return `shape[${k2}]._zod.run({ value: input[${k2}], issues: [] }, ctx)`;\n };\n doc.write(`const input = payload.value;`);\n const ids = Object.create(null);\n for (const key of keys) {\n ids[key] = randomString(15);\n }\n doc.write(`const newResult = {}`);\n for (const key of keys) {\n if (optionalKeys2.has(key)) {\n const id = ids[key];\n doc.write(`const ${id} = ${parseStr(key)};`);\n const k2 = esc(key);\n doc.write(`\n if (${id}.issues.length) {\n if (input[${k2}] === undefined) {\n if (${k2} in input) {\n newResult[${k2}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${id}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${k2}, ...iss.path] : [${k2}],\n }))\n );\n }\n } else if (${id}.value === undefined) {\n if (${k2} in input) newResult[${k2}] = undefined;\n } else {\n newResult[${k2}] = ${id}.value;\n }\n `);\n } else {\n const id = ids[key];\n doc.write(`const ${id} = ${parseStr(key)};`);\n doc.write(`\n if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]\n })));`);\n doc.write(`newResult[${esc(key)}] = ${id}.value`);\n }\n }\n doc.write(`payload.value = newResult;`);\n doc.write(`return payload;`);\n const fn = doc.compile();\n return (payload, ctx) => fn(shape, payload, ctx);\n };\n let fastpass;\n const isObject2 = isObject;\n const jit = !globalConfig.jitless;\n const allowsEval2 = allowsEval;\n const fastEnabled = jit && allowsEval2.value;\n const { catchall } = def;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject2(input)) {\n payload.issues.push({\n expected: "object",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n }\n const proms = [];\n if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {\n if (!fastpass)\n fastpass = generateFastpass(def.shape);\n payload = fastpass(payload, ctx);\n } else {\n payload.value = {};\n const shape = value.shape;\n for (const key of value.keys) {\n const el = shape[key];\n const r2 = el._zod.run({ value: input[key], issues: [] }, ctx);\n const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";\n if (r2 instanceof Promise) {\n proms.push(r2.then((r3) => isOptional ? handleOptionalObjectResult(r3, payload, key, input) : handleObjectResult(r3, payload, key)));\n } else {\n if (isOptional) {\n handleOptionalObjectResult(r2, payload, key, input);\n } else {\n handleObjectResult(r2, payload, key);\n }\n }\n }\n }\n if (!catchall) {\n return proms.length ? Promise.all(proms).then(() => payload) : payload;\n }\n const unrecognized = [];\n const keySet = value.keySet;\n const _catchall = catchall._zod;\n const t2 = _catchall.def.type;\n for (const key of Object.keys(input)) {\n if (keySet.has(key))\n continue;\n if (t2 === "never") {\n unrecognized.push(key);\n continue;\n }\n const r2 = _catchall.run({ value: input[key], issues: [] }, ctx);\n if (r2 instanceof Promise) {\n proms.push(r2.then((r3) => handleObjectResult(r3, payload, key)));\n } else {\n handleObjectResult(r2, payload, key);\n }\n }\n if (unrecognized.length) {\n payload.issues.push({\n code: "unrecognized_keys",\n keys: unrecognized,\n input,\n inst\n });\n }\n if (!proms.length)\n return payload;\n return Promise.all(proms).then(() => {\n return payload;\n });\n };\n});\nfunction handleUnionResults(results, final, inst, ctx) {\n for (const result of results) {\n if (result.issues.length === 0) {\n final.value = result.value;\n return final;\n }\n }\n final.issues.push({\n code: "invalid_union",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))\n });\n return final;\n}\nvar $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "values", () => {\n if (def.options.every((o2) => o2._zod.values)) {\n return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));\n }\n return;\n });\n defineLazy(inst._zod, "pattern", () => {\n if (def.options.every((o2) => o2._zod.pattern)) {\n const patterns = def.options.map((o2) => o2._zod.pattern);\n return new RegExp(`^(${patterns.map((p3) => cleanRegex(p3.source)).join("|")})$`);\n }\n return;\n });\n inst._zod.parse = (payload, ctx) => {\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: []\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n } else {\n if (result.issues.length === 0)\n return result;\n results.push(result);\n }\n }\n if (!async)\n return handleUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results2) => {\n return handleUnionResults(results2, payload, inst, ctx);\n });\n };\n});\nvar $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {\n $ZodUnion.init(inst, def);\n const _super = inst._zod.parse;\n defineLazy(inst._zod, "propValues", () => {\n const propValues = {};\n for (const option of def.options) {\n const pv = option._zod.propValues;\n if (!pv || Object.keys(pv).length === 0)\n throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);\n for (const [k2, v3] of Object.entries(pv)) {\n if (!propValues[k2])\n propValues[k2] = new Set;\n for (const val of v3) {\n propValues[k2].add(val);\n }\n }\n }\n return propValues;\n });\n const disc = cached(() => {\n const opts = def.options;\n const map = new Map;\n for (const o2 of opts) {\n const values = o2._zod.propValues[def.discriminator];\n if (!values || values.size === 0)\n throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);\n for (const v3 of values) {\n if (map.has(v3)) {\n throw new Error(`Duplicate discriminator value "${String(v3)}"`);\n }\n map.set(v3, o2);\n }\n }\n return map;\n });\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n code: "invalid_type",\n expected: "object",\n input,\n inst\n });\n return payload;\n }\n const opt = disc.value.get(input?.[def.discriminator]);\n if (opt) {\n return opt._zod.run(payload, ctx);\n }\n if (def.unionFallback) {\n return _super(payload, ctx);\n }\n payload.issues.push({\n code: "invalid_union",\n errors: [],\n note: "No matching discriminator",\n input,\n path: [def.discriminator],\n inst\n });\n return payload;\n };\n});\nvar $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const { value: input } = payload;\n const left = def.left._zod.run({ value: input, issues: [] }, ctx);\n const right = def.right._zod.run({ value: input, issues: [] }, ctx);\n const async = left instanceof Promise || right instanceof Promise;\n if (async) {\n return Promise.all([left, right]).then(([left2, right2]) => {\n return handleIntersectionResults(payload, left2, right2);\n });\n }\n return handleIntersectionResults(payload, left, right);\n };\n});\nfunction mergeValues(a2, b2) {\n if (a2 === b2) {\n return { valid: true, data: a2 };\n }\n if (a2 instanceof Date && b2 instanceof Date && +a2 === +b2) {\n return { valid: true, data: a2 };\n }\n if (isPlainObject(a2) && isPlainObject(b2)) {\n const bKeys = Object.keys(b2);\n const sharedKeys = Object.keys(a2).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a2, ...b2 };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a2[key], b2[key]);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [key, ...sharedValue.mergeErrorPath]\n };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n if (Array.isArray(a2) && Array.isArray(b2)) {\n if (a2.length !== b2.length) {\n return { valid: false, mergeErrorPath: [] };\n }\n const newArray = [];\n for (let index = 0;index < a2.length; index++) {\n const itemA = a2[index];\n const itemB = b2[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [index, ...sharedValue.mergeErrorPath]\n };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n return { valid: false, mergeErrorPath: [] };\n}\nfunction handleIntersectionResults(result, left, right) {\n if (left.issues.length) {\n result.issues.push(...left.issues);\n }\n if (right.issues.length) {\n result.issues.push(...right.issues);\n }\n if (aborted(result))\n return result;\n const merged = mergeValues(left.value, right.value);\n if (!merged.valid) {\n throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);\n }\n result.value = merged.data;\n return result;\n}\nvar $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {\n $ZodType.init(inst, def);\n const items = def.items;\n const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n input,\n inst,\n expected: "tuple",\n code: "invalid_type"\n });\n return payload;\n }\n payload.value = [];\n const proms = [];\n if (!def.rest) {\n const tooBig = input.length > items.length;\n const tooSmall = input.length < optStart - 1;\n if (tooBig || tooSmall) {\n payload.issues.push({\n input,\n inst,\n origin: "array",\n ...tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }\n });\n return payload;\n }\n }\n let i2 = -1;\n for (const item of items) {\n i2++;\n if (i2 >= input.length) {\n if (i2 >= optStart)\n continue;\n }\n const result = item._zod.run({\n value: input[i2],\n issues: []\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));\n } else {\n handleTupleResult(result, payload, i2);\n }\n }\n if (def.rest) {\n const rest = input.slice(items.length);\n for (const el of rest) {\n i2++;\n const result = def.rest._zod.run({\n value: el,\n issues: []\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));\n } else {\n handleTupleResult(result, payload, i2);\n }\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleTupleResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nvar $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!isPlainObject(input)) {\n payload.issues.push({\n expected: "record",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n }\n const proms = [];\n if (def.keyType._zod.values) {\n const values = def.keyType._zod.values;\n payload.value = {};\n for (const key of values) {\n if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result2) => {\n if (result2.issues.length) {\n payload.issues.push(...prefixIssues(key, result2.issues));\n }\n payload.value[key] = result2.value;\n }));\n } else {\n if (result.issues.length) {\n payload.issues.push(...prefixIssues(key, result.issues));\n }\n payload.value[key] = result.value;\n }\n }\n }\n let unrecognized;\n for (const key in input) {\n if (!values.has(key)) {\n unrecognized = unrecognized ?? [];\n unrecognized.push(key);\n }\n }\n if (unrecognized && unrecognized.length > 0) {\n payload.issues.push({\n code: "unrecognized_keys",\n input,\n inst,\n keys: unrecognized\n });\n }\n } else {\n payload.value = {};\n for (const key of Reflect.ownKeys(input)) {\n if (key === "__proto__")\n continue;\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error("Async schemas not supported in object keys currently");\n }\n if (keyResult.issues.length) {\n payload.issues.push({\n origin: "record",\n code: "invalid_key",\n issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),\n input: key,\n path: [key],\n inst\n });\n payload.value[keyResult.value] = keyResult.value;\n continue;\n }\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result2) => {\n if (result2.issues.length) {\n payload.issues.push(...prefixIssues(key, result2.issues));\n }\n payload.value[keyResult.value] = result2.value;\n }));\n } else {\n if (result.issues.length) {\n payload.issues.push(...prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload;\n };\n});\nvar $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Map)) {\n payload.issues.push({\n expected: "map",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n }\n const proms = [];\n payload.value = new Map;\n for (const [key, value] of input) {\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);\n if (keyResult instanceof Promise || valueResult instanceof Promise) {\n proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {\n handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);\n }));\n } else {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {\n if (keyResult.issues.length) {\n if (propertyKeyTypes.has(typeof key)) {\n final.issues.push(...prefixIssues(key, keyResult.issues));\n } else {\n final.issues.push({\n origin: "map",\n code: "invalid_key",\n input,\n inst,\n issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))\n });\n }\n }\n if (valueResult.issues.length) {\n if (propertyKeyTypes.has(typeof key)) {\n final.issues.push(...prefixIssues(key, valueResult.issues));\n } else {\n final.issues.push({\n origin: "map",\n code: "invalid_element",\n input,\n inst,\n key,\n issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))\n });\n }\n }\n final.value.set(keyResult.value, valueResult.value);\n}\nvar $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Set)) {\n payload.issues.push({\n input,\n inst,\n expected: "set",\n code: "invalid_type"\n });\n return payload;\n }\n const proms = [];\n payload.value = new Set;\n for (const item of input) {\n const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result2) => handleSetResult(result2, payload)));\n } else\n handleSetResult(result, payload);\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleSetResult(result, final) {\n if (result.issues.length) {\n final.issues.push(...result.issues);\n }\n final.value.add(result.value);\n}\nvar $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {\n $ZodType.init(inst, def);\n const values = getEnumValues(def.entries);\n inst._zod.values = new Set(values);\n inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2.toString()).join("|")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (inst._zod.values.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: "invalid_value",\n values,\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.values = new Set(def.values);\n inst._zod.pattern = new RegExp(`^(${def.values.map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2 ? o2.toString() : String(o2)).join("|")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (inst._zod.values.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: "invalid_value",\n values: def.values,\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (input instanceof File)\n return payload;\n payload.issues.push({\n expected: "file",\n code: "invalid_type",\n input,\n inst\n });\n return payload;\n };\n});\nvar $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const _out = def.transform(payload.value, payload);\n if (_ctx.async) {\n const output = _out instanceof Promise ? _out : Promise.resolve(_out);\n return output.then((output2) => {\n payload.value = output2;\n return payload;\n });\n }\n if (_out instanceof Promise) {\n throw new $ZodAsyncError;\n }\n payload.value = _out;\n return payload;\n };\n});\nvar $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = "optional";\n inst._zod.optout = "optional";\n defineLazy(inst._zod, "values", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;\n });\n defineLazy(inst._zod, "pattern", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n if (payload.value === undefined) {\n return payload;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nvar $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);\n defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);\n defineLazy(inst._zod, "pattern", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;\n });\n defineLazy(inst._zod, "values", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n if (payload.value === null)\n return payload;\n return def.innerType._zod.run(payload, ctx);\n };\n});\nvar $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = "optional";\n defineLazy(inst._zod, "values", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n return payload;\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result2) => handleDefaultResult(result2, def));\n }\n return handleDefaultResult(result, def);\n };\n});\nfunction handleDefaultResult(payload, def) {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return payload;\n}\nvar $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = "optional";\n defineLazy(inst._zod, "values", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nvar $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "values", () => {\n const v3 = def.innerType._zod.values;\n return v3 ? new Set([...v3].filter((x2) => x2 !== undefined)) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result2) => handleNonOptionalResult(result2, inst));\n }\n return handleNonOptionalResult(result, inst);\n };\n});\nfunction handleNonOptionalResult(payload, inst) {\n if (!payload.issues.length && payload.value === undefined) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: payload.value,\n inst\n });\n }\n return payload;\n}\nvar $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result2) => {\n payload.value = result2.issues.length === 0;\n return payload;\n });\n }\n payload.value = result.issues.length === 0;\n return payload;\n };\n});\nvar $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);\n defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);\n defineLazy(inst._zod, "values", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result2) => {\n payload.value = result2.value;\n if (result2.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))\n },\n input: payload.value\n });\n payload.issues = [];\n }\n return payload;\n });\n }\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))\n },\n input: payload.value\n });\n payload.issues = [];\n }\n return payload;\n };\n});\nvar $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: "nan",\n code: "invalid_type"\n });\n return payload;\n }\n return payload;\n };\n});\nvar $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "values", () => def.in._zod.values);\n defineLazy(inst._zod, "optin", () => def.in._zod.optin);\n defineLazy(inst._zod, "optout", () => def.out._zod.optout);\n inst._zod.parse = (payload, ctx) => {\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left2) => handlePipeResult(left2, def, ctx));\n }\n return handlePipeResult(left, def, ctx);\n };\n});\nfunction handlePipeResult(left, def, ctx) {\n if (aborted(left)) {\n return left;\n }\n return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);\n}\nvar $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);\n defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);\n defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then(handleReadonlyResult);\n }\n return handleReadonlyResult(result);\n };\n});\nfunction handleReadonlyResult(payload) {\n payload.value = Object.freeze(payload.value);\n return payload;\n}\nvar $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {\n $ZodType.init(inst, def);\n const regexParts = [];\n for (const part of def.parts) {\n if (part instanceof $ZodType) {\n if (!part._zod.pattern) {\n throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);\n }\n const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;\n if (!source)\n throw new Error(`Invalid template literal part: ${part._zod.traits}`);\n const start = source.startsWith("^") ? 1 : 0;\n const end = source.endsWith("$") ? source.length - 1 : source.length;\n regexParts.push(source.slice(start, end));\n } else if (part === null || primitiveTypes.has(typeof part)) {\n regexParts.push(escapeRegex(`${part}`));\n } else {\n throw new Error(`Invalid template literal part: ${part}`);\n }\n }\n inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== "string") {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: "template_literal",\n code: "invalid_type"\n });\n return payload;\n }\n inst._zod.pattern.lastIndex = 0;\n if (!inst._zod.pattern.test(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n code: "invalid_format",\n format: "template_literal",\n pattern: inst._zod.pattern.source\n });\n return payload;\n }\n return payload;\n };\n});\nvar $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));\n };\n});\nvar $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {\n $ZodType.init(inst, def);\n defineLazy(inst._zod, "innerType", () => def.getter());\n defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);\n defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);\n defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);\n defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);\n inst._zod.parse = (payload, ctx) => {\n const inner = inst._zod.innerType;\n return inner._zod.run(payload, ctx);\n };\n});\nvar $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {\n $ZodCheck.init(inst, def);\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _3) => {\n return payload;\n };\n inst._zod.check = (payload) => {\n const input = payload.value;\n const r2 = def.fn(input);\n if (r2 instanceof Promise) {\n return r2.then((r3) => handleRefineResult(r3, payload, input, inst));\n }\n handleRefineResult(r2, payload, input, inst);\n return;\n };\n});\nfunction handleRefineResult(result, payload, input, inst) {\n if (!result) {\n const _iss = {\n code: "custom",\n input,\n inst,\n path: [...inst._zod.def.path ?? []],\n continue: !inst._zod.def.abort\n };\n if (inst._zod.def.params)\n _iss.params = inst._zod.def.params;\n payload.issues.push(issue(_iss));\n }\n}\n// ../../node_modules/zod/dist/esm/v4/locales/index.js\nvar exports_locales = {};\n__export(exports_locales, {\n zhTW: () => zh_TW_default,\n zhCN: () => zh_CN_default,\n vi: () => vi_default,\n ur: () => ur_default,\n ua: () => ua_default,\n tr: () => tr_default,\n th: () => th_default,\n ta: () => ta_default,\n sv: () => sv_default,\n sl: () => sl_default,\n ru: () => ru_default,\n pt: () => pt_default,\n pl: () => pl_default,\n ota: () => ota_default,\n no: () => no_default,\n nl: () => nl_default,\n ms: () => ms_default,\n mk: () => mk_default,\n ko: () => ko_default,\n kh: () => kh_default,\n ja: () => ja_default,\n it: () => it_default,\n id: () => id_default,\n hu: () => hu_default,\n he: () => he_default,\n frCA: () => fr_CA_default,\n fr: () => fr_default,\n fi: () => fi_default,\n fa: () => fa_default,\n es: () => es_default,\n en: () => en_default,\n de: () => de_default,\n cs: () => cs_default,\n ca: () => ca_default,\n be: () => be_default,\n az: () => az_default,\n ar: () => ar_default\n});\n\n// ../../node_modules/zod/dist/esm/v4/locales/ar.js\nvar error = () => {\n const Sizable = {\n string: { unit: "حرف", verb: "أن يحوي" },\n file: { unit: "بايت", verb: "أن يحوي" },\n array: { unit: "عنصر", verb: "أن يحوي" },\n set: { unit: "عنصر", verb: "أن يحوي" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "مدخل",\n email: "بريد إلكتروني",\n url: "رابط",\n emoji: "إيموجي",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "تاريخ ووقت بمعيار ISO",\n date: "تاريخ بمعيار ISO",\n time: "وقت بمعيار ISO",\n duration: "مدة بمعيار ISO",\n ipv4: "عنوان IPv4",\n ipv6: "عنوان IPv6",\n cidrv4: "مدى عناوين بصيغة IPv4",\n cidrv6: "مدى عناوين بصيغة IPv6",\n base64: "نَص بترميز base64-encoded",\n base64url: "نَص بترميز base64url-encoded",\n json_string: "نَص على هيئة JSON",\n e164: "رقم هاتف بمعيار E.164",\n jwt: "JWT",\n template_literal: "مدخل"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `مدخلات غير مقبولة: يفترض إدخال ${issue2.expected}، ولكن تم إدخال ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `مدخلات غير مقبولة: يفترض إدخال ${stringifyPrimitive(issue2.values[0])}`;\n return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return ` أكبر من اللازم: يفترض أن تكون ${issue2.origin ?? "القيمة"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "عنصر"}`;\n return `أكبر من اللازم: يفترض أن تكون ${issue2.origin ?? "القيمة"} ${adj} ${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `أصغر من اللازم: يفترض لـ ${issue2.origin} أن يكون ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `أصغر من اللازم: يفترض لـ ${issue2.origin} أن يكون ${adj} ${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `نَص غير مقبول: يجب أن يبدأ بـ "${issue2.prefix}"`;\n if (_issue.format === "ends_with")\n return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} غير مقبول`;\n }\n case "not_multiple_of":\n return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue2.divisor}`;\n case "unrecognized_keys":\n return `معرف${issue2.keys.length > 1 ? "ات" : ""} غريب${issue2.keys.length > 1 ? "ة" : ""}: ${joinValues(issue2.keys, "، ")}`;\n case "invalid_key":\n return `معرف غير مقبول في ${issue2.origin}`;\n case "invalid_union":\n return "مدخل غير مقبول";\n case "invalid_element":\n return `مدخل غير مقبول في ${issue2.origin}`;\n default:\n return "مدخل غير مقبول";\n }\n };\n};\nfunction ar_default() {\n return {\n localeError: error()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/az.js\nvar error2 = () => {\n const Sizable = {\n string: { unit: "simvol", verb: "olmalıdır" },\n file: { unit: "bayt", verb: "olmalıdır" },\n array: { unit: "element", verb: "olmalıdır" },\n set: { unit: "element", verb: "olmalıdır" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "input",\n email: "email address",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO datetime",\n date: "ISO date",\n time: "ISO time",\n duration: "ISO duration",\n ipv4: "IPv4 address",\n ipv6: "IPv6 address",\n cidrv4: "IPv4 range",\n cidrv6: "IPv6 range",\n base64: "base64-encoded string",\n base64url: "base64url-encoded string",\n json_string: "JSON string",\n e164: "E.164 number",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Yanlış dəyər: gözlənilən ${issue2.expected}, daxil olan ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Yanlış dəyər: gözlənilən ${stringifyPrimitive(issue2.values[0])}`;\n return `Yanlış seçim: aşağıdakılardan biri olmalıdır: ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Çox böyük: gözlənilən ${issue2.origin ?? "dəyər"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`;\n return `Çox böyük: gözlənilən ${issue2.origin ?? "dəyər"} ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Çox kiçik: gözlənilən ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n return `Çox kiçik: gözlənilən ${issue2.origin} ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Yanlış mətn: "${_issue.prefix}" ilə başlamalıdır`;\n if (_issue.format === "ends_with")\n return `Yanlış mətn: "${_issue.suffix}" ilə bitməlidir`;\n if (_issue.format === "includes")\n return `Yanlış mətn: "${_issue.includes}" daxil olmalıdır`;\n if (_issue.format === "regex")\n return `Yanlış mətn: ${_issue.pattern} şablonuna uyğun olmalıdır`;\n return `Yanlış ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Yanlış ədəd: ${issue2.divisor} ilə bölünə bilən olmalıdır`;\n case "unrecognized_keys":\n return `Tanınmayan açar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `${issue2.origin} daxilində yanlış açar`;\n case "invalid_union":\n return "Yanlış dəyər";\n case "invalid_element":\n return `${issue2.origin} daxilində yanlış dəyər`;\n default:\n return `Yanlış dəyər`;\n }\n };\n};\nfunction az_default() {\n return {\n localeError: error2()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/be.js\nfunction getBelarusianPlural(count, one, few, many) {\n const absCount = Math.abs(count);\n const lastDigit = absCount % 10;\n const lastTwoDigits = absCount % 100;\n if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {\n return many;\n }\n if (lastDigit === 1) {\n return one;\n }\n if (lastDigit >= 2 && lastDigit <= 4) {\n return few;\n }\n return many;\n}\nvar error3 = () => {\n const Sizable = {\n string: {\n unit: {\n one: "сімвал",\n few: "сімвалы",\n many: "сімвалаў"\n },\n verb: "мець"\n },\n array: {\n unit: {\n one: "элемент",\n few: "элементы",\n many: "элементаў"\n },\n verb: "мець"\n },\n set: {\n unit: {\n one: "элемент",\n few: "элементы",\n many: "элементаў"\n },\n verb: "мець"\n },\n file: {\n unit: {\n one: "байт",\n few: "байты",\n many: "байтаў"\n },\n verb: "мець"\n }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "лік";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "масіў";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "увод",\n email: "email адрас",\n url: "URL",\n emoji: "эмодзі",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO дата і час",\n date: "ISO дата",\n time: "ISO час",\n duration: "ISO працягласць",\n ipv4: "IPv4 адрас",\n ipv6: "IPv6 адрас",\n cidrv4: "IPv4 дыяпазон",\n cidrv6: "IPv6 дыяпазон",\n base64: "радок у фармаце base64",\n base64url: "радок у фармаце base64url",\n json_string: "JSON радок",\n e164: "нумар E.164",\n jwt: "JWT",\n template_literal: "увод"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Няправільны ўвод: чакаўся ${issue2.expected}, атрымана ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Няправільны ўвод: чакалася ${stringifyPrimitive(issue2.values[0])}`;\n return `Няправільны варыянт: чакаўся адзін з ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n const maxValue = Number(issue2.maximum);\n const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);\n return `Занадта вялікі: чакалася, што ${issue2.origin ?? "значэнне"} павінна ${sizing.verb} ${adj}${issue2.maximum.toString()} ${unit}`;\n }\n return `Занадта вялікі: чакалася, што ${issue2.origin ?? "значэнне"} павінна быць ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n const minValue = Number(issue2.minimum);\n const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);\n return `Занадта малы: чакалася, што ${issue2.origin} павінна ${sizing.verb} ${adj}${issue2.minimum.toString()} ${unit}`;\n }\n return `Занадта малы: чакалася, што ${issue2.origin} павінна быць ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Няправільны радок: павінен змяшчаць "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`;\n return `Няправільны ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Няправільны лік: павінен быць кратным ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Нераспазнаны ${issue2.keys.length > 1 ? "ключы" : "ключ"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Няправільны ключ у ${issue2.origin}`;\n case "invalid_union":\n return "Няправільны ўвод";\n case "invalid_element":\n return `Няправільнае значэнне ў ${issue2.origin}`;\n default:\n return `Няправільны ўвод`;\n }\n };\n};\nfunction be_default() {\n return {\n localeError: error3()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ca.js\nvar error4 = () => {\n const Sizable = {\n string: { unit: "caràcters", verb: "contenir" },\n file: { unit: "bytes", verb: "contenir" },\n array: { unit: "elements", verb: "contenir" },\n set: { unit: "elements", verb: "contenir" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "entrada",\n email: "adreça electrònica",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "data i hora ISO",\n date: "data ISO",\n time: "hora ISO",\n duration: "durada ISO",\n ipv4: "adreça IPv4",\n ipv6: "adreça IPv6",\n cidrv4: "rang IPv4",\n cidrv6: "rang IPv6",\n base64: "cadena codificada en base64",\n base64url: "cadena codificada en base64url",\n json_string: "cadena JSON",\n e164: "número E.164",\n jwt: "JWT",\n template_literal: "entrada"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Tipus invàlid: s\'esperava ${issue2.expected}, s\'ha rebut ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Valor invàlid: s\'esperava ${stringifyPrimitive(issue2.values[0])}`;\n return `Opció invàlida: s\'esperava una de ${joinValues(issue2.values, " o ")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "com a màxim" : "menys de";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Massa gran: s\'esperava que ${issue2.origin ?? "el valor"} contingués ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;\n return `Massa gran: s\'esperava que ${issue2.origin ?? "el valor"} fos ${adj} ${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? "com a mínim" : "més de";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Massa petit: s\'esperava que ${issue2.origin} contingués ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Massa petit: s\'esperava que ${issue2.origin} fos ${adj} ${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Format invàlid: ha de començar amb "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `Format invàlid: ha d\'acabar amb "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Format invàlid: ha d\'incloure "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Format invàlid: ha de coincidir amb el patró ${_issue.pattern}`;\n return `Format invàlid per a ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Número invàlid: ha de ser múltiple de ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Clau${issue2.keys.length > 1 ? "s" : ""} no reconeguda${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Clau invàlida a ${issue2.origin}`;\n case "invalid_union":\n return "Entrada invàlida";\n case "invalid_element":\n return `Element invàlid a ${issue2.origin}`;\n default:\n return `Entrada invàlida`;\n }\n };\n};\nfunction ca_default() {\n return {\n localeError: error4()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/cs.js\nvar error5 = () => {\n const Sizable = {\n string: { unit: "znaků", verb: "mít" },\n file: { unit: "bajtů", verb: "mít" },\n array: { unit: "prvků", verb: "mít" },\n set: { unit: "prvků", verb: "mít" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "číslo";\n }\n case "string": {\n return "řetězec";\n }\n case "boolean": {\n return "boolean";\n }\n case "bigint": {\n return "bigint";\n }\n case "function": {\n return "funkce";\n }\n case "symbol": {\n return "symbol";\n }\n case "undefined": {\n return "undefined";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "pole";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "regulární výraz",\n email: "e-mailová adresa",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "datum a čas ve formátu ISO",\n date: "datum ve formátu ISO",\n time: "čas ve formátu ISO",\n duration: "doba trvání ISO",\n ipv4: "IPv4 adresa",\n ipv6: "IPv6 adresa",\n cidrv4: "rozsah IPv4",\n cidrv6: "rozsah IPv6",\n base64: "řetězec zakódovaný ve formátu base64",\n base64url: "řetězec zakódovaný ve formátu base64url",\n json_string: "řetězec ve formátu JSON",\n e164: "číslo E.164",\n jwt: "JWT",\n template_literal: "vstup"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Neplatný vstup: očekáváno ${issue2.expected}, obdrženo ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Neplatný vstup: očekáváno ${stringifyPrimitive(issue2.values[0])}`;\n return `Neplatná možnost: očekávána jedna z hodnot ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Hodnota je příliš velká: ${issue2.origin ?? "hodnota"} musí mít ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvků"}`;\n }\n return `Hodnota je příliš velká: ${issue2.origin ?? "hodnota"} musí být ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Hodnota je příliš malá: ${issue2.origin ?? "hodnota"} musí mít ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvků"}`;\n }\n return `Hodnota je příliš malá: ${issue2.origin ?? "hodnota"} musí být ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Neplatný řetězec: musí začínat na "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Neplatný řetězec: musí končit na "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Neplatný řetězec: musí obsahovat "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Neplatný řetězec: musí odpovídat vzoru ${_issue.pattern}`;\n return `Neplatný formát ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Neplatné číslo: musí být násobkem ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Neznámé klíče: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Neplatný klíč v ${issue2.origin}`;\n case "invalid_union":\n return "Neplatný vstup";\n case "invalid_element":\n return `Neplatná hodnota v ${issue2.origin}`;\n default:\n return `Neplatný vstup`;\n }\n };\n};\nfunction cs_default() {\n return {\n localeError: error5()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/de.js\nvar error6 = () => {\n const Sizable = {\n string: { unit: "Zeichen", verb: "zu haben" },\n file: { unit: "Bytes", verb: "zu haben" },\n array: { unit: "Elemente", verb: "zu haben" },\n set: { unit: "Elemente", verb: "zu haben" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "Zahl";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "Array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "Eingabe",\n email: "E-Mail-Adresse",\n url: "URL",\n emoji: "Emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO-Datum und -Uhrzeit",\n date: "ISO-Datum",\n time: "ISO-Uhrzeit",\n duration: "ISO-Dauer",\n ipv4: "IPv4-Adresse",\n ipv6: "IPv6-Adresse",\n cidrv4: "IPv4-Bereich",\n cidrv6: "IPv6-Bereich",\n base64: "Base64-codierter String",\n base64url: "Base64-URL-codierter String",\n json_string: "JSON-String",\n e164: "E.164-Nummer",\n jwt: "JWT",\n template_literal: "Eingabe"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Ungültige Eingabe: erwartet ${issue2.expected}, erhalten ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Ungültige Eingabe: erwartet ${stringifyPrimitive(issue2.values[0])}`;\n return `Ungültige Option: erwartet eine von ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Zu groß: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;\n return `Zu groß: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ist`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} hat`;\n }\n return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ist`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`;\n if (_issue.format === "ends_with")\n return `Ungültiger String: muss mit "${_issue.suffix}" enden`;\n if (_issue.format === "includes")\n return `Ungültiger String: muss "${_issue.includes}" enthalten`;\n if (_issue.format === "regex")\n return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`;\n return `Ungültig: ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Ungültige Zahl: muss ein Vielfaches von ${issue2.divisor} sein`;\n case "unrecognized_keys":\n return `${issue2.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Ungültiger Schlüssel in ${issue2.origin}`;\n case "invalid_union":\n return "Ungültige Eingabe";\n case "invalid_element":\n return `Ungültiger Wert in ${issue2.origin}`;\n default:\n return `Ungültige Eingabe`;\n }\n };\n};\nfunction de_default() {\n return {\n localeError: error6()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/en.js\nvar parsedType = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n};\nvar error7 = () => {\n const Sizable = {\n string: { unit: "characters", verb: "to have" },\n file: { unit: "bytes", verb: "to have" },\n array: { unit: "items", verb: "to have" },\n set: { unit: "items", verb: "to have" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const Nouns = {\n regex: "input",\n email: "email address",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO datetime",\n date: "ISO date",\n time: "ISO time",\n duration: "ISO duration",\n ipv4: "IPv4 address",\n ipv6: "IPv6 address",\n cidrv4: "IPv4 range",\n cidrv6: "IPv6 range",\n base64: "base64-encoded string",\n base64url: "base64url-encoded string",\n json_string: "JSON string",\n e164: "E.164 number",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Invalid input: expected ${issue2.expected}, received ${parsedType(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;\n return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;\n return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Invalid string: must start with "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `Invalid string: must end with "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Invalid string: must include "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Invalid string: must match pattern ${_issue.pattern}`;\n return `Invalid ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Invalid number: must be a multiple of ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Invalid key in ${issue2.origin}`;\n case "invalid_union":\n return "Invalid input";\n case "invalid_element":\n return `Invalid value in ${issue2.origin}`;\n default:\n return `Invalid input`;\n }\n };\n};\nfunction en_default() {\n return {\n localeError: error7()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/es.js\nvar error8 = () => {\n const Sizable = {\n string: { unit: "caracteres", verb: "tener" },\n file: { unit: "bytes", verb: "tener" },\n array: { unit: "elementos", verb: "tener" },\n set: { unit: "elementos", verb: "tener" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "número";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "arreglo";\n }\n if (data === null) {\n return "nulo";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "entrada",\n email: "dirección de correo electrónico",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "fecha y hora ISO",\n date: "fecha ISO",\n time: "hora ISO",\n duration: "duración ISO",\n ipv4: "dirección IPv4",\n ipv6: "dirección IPv6",\n cidrv4: "rango IPv4",\n cidrv6: "rango IPv6",\n base64: "cadena codificada en base64",\n base64url: "URL codificada en base64",\n json_string: "cadena JSON",\n e164: "número E.164",\n jwt: "JWT",\n template_literal: "entrada"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Entrada inválida: se esperaba ${issue2.expected}, recibido ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Entrada inválida: se esperaba ${stringifyPrimitive(issue2.values[0])}`;\n return `Opción inválida: se esperaba una de ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Demasiado grande: se esperaba que ${issue2.origin ?? "valor"} tuviera ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;\n return `Demasiado grande: se esperaba que ${issue2.origin ?? "valor"} fuera ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Demasiado pequeño: se esperaba que ${issue2.origin} tuviera ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Demasiado pequeño: se esperaba que ${issue2.origin} fuera ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Cadena inválida: debe comenzar con "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Cadena inválida: debe terminar en "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Cadena inválida: debe incluir "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Cadena inválida: debe coincidir con el patrón ${_issue.pattern}`;\n return `Inválido ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Número inválido: debe ser múltiplo de ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Llave${issue2.keys.length > 1 ? "s" : ""} desconocida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Llave inválida en ${issue2.origin}`;\n case "invalid_union":\n return "Entrada inválida";\n case "invalid_element":\n return `Valor inválido en ${issue2.origin}`;\n default:\n return `Entrada inválida`;\n }\n };\n};\nfunction es_default() {\n return {\n localeError: error8()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/fa.js\nvar error9 = () => {\n const Sizable = {\n string: { unit: "کاراکتر", verb: "داشته باشد" },\n file: { unit: "بایت", verb: "داشته باشد" },\n array: { unit: "آیتم", verb: "داشته باشد" },\n set: { unit: "آیتم", verb: "داشته باشد" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "عدد";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "آرایه";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "ورودی",\n email: "آدرس ایمیل",\n url: "URL",\n emoji: "ایموجی",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "تاریخ و زمان ایزو",\n date: "تاریخ ایزو",\n time: "زمان ایزو",\n duration: "مدت زمان ایزو",\n ipv4: "IPv4 آدرس",\n ipv6: "IPv6 آدرس",\n cidrv4: "IPv4 دامنه",\n cidrv6: "IPv6 دامنه",\n base64: "base64-encoded رشته",\n base64url: "base64url-encoded رشته",\n json_string: "JSON رشته",\n e164: "E.164 عدد",\n jwt: "JWT",\n template_literal: "ورودی"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `ورودی نامعتبر: می‌بایست ${issue2.expected} می‌بود، ${parsedType2(issue2.input)} دریافت شد`;\n case "invalid_value":\n if (issue2.values.length === 1) {\n return `ورودی نامعتبر: می‌بایست ${stringifyPrimitive(issue2.values[0])} می‌بود`;\n }\n return `گزینه نامعتبر: می‌بایست یکی از ${joinValues(issue2.values, "|")} می‌بود`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `خیلی بزرگ: ${issue2.origin ?? "مقدار"} باید ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;\n }\n return `خیلی بزرگ: ${issue2.origin ?? "مقدار"} باید ${adj}${issue2.maximum.toString()} باشد`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `خیلی کوچک: ${issue2.origin} باید ${adj}${issue2.minimum.toString()} ${sizing.unit} باشد`;\n }\n return `خیلی کوچک: ${issue2.origin} باید ${adj}${issue2.minimum.toString()} باشد`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;\n }\n if (_issue.format === "ends_with") {\n return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;\n }\n if (_issue.format === "includes") {\n return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;\n }\n if (_issue.format === "regex") {\n return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;\n }\n return `${Nouns[_issue.format] ?? issue2.format} نامعتبر`;\n }\n case "not_multiple_of":\n return `عدد نامعتبر: باید مضرب ${issue2.divisor} باشد`;\n case "unrecognized_keys":\n return `کلید${issue2.keys.length > 1 ? "های" : ""} ناشناس: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `کلید ناشناس در ${issue2.origin}`;\n case "invalid_union":\n return `ورودی نامعتبر`;\n case "invalid_element":\n return `مقدار نامعتبر در ${issue2.origin}`;\n default:\n return `ورودی نامعتبر`;\n }\n };\n};\nfunction fa_default() {\n return {\n localeError: error9()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/fi.js\nvar error10 = () => {\n const Sizable = {\n string: { unit: "merkkiä", subject: "merkkijonon" },\n file: { unit: "tavua", subject: "tiedoston" },\n array: { unit: "alkiota", subject: "listan" },\n set: { unit: "alkiota", subject: "joukon" },\n number: { unit: "", subject: "luvun" },\n bigint: { unit: "", subject: "suuren kokonaisluvun" },\n int: { unit: "", subject: "kokonaisluvun" },\n date: { unit: "", subject: "päivämäärän" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "säännöllinen lauseke",\n email: "sähköpostiosoite",\n url: "URL-osoite",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO-aikaleima",\n date: "ISO-päivämäärä",\n time: "ISO-aika",\n duration: "ISO-kesto",\n ipv4: "IPv4-osoite",\n ipv6: "IPv6-osoite",\n cidrv4: "IPv4-alue",\n cidrv6: "IPv6-alue",\n base64: "base64-koodattu merkkijono",\n base64url: "base64url-koodattu merkkijono",\n json_string: "JSON-merkkijono",\n e164: "E.164-luku",\n jwt: "JWT",\n template_literal: "templaattimerkkijono"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Virheellinen tyyppi: odotettiin ${issue2.expected}, oli ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Virheellinen syöte: täytyy olla ${stringifyPrimitive(issue2.values[0])}`;\n return `Virheellinen valinta: täytyy olla yksi seuraavista: ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue2.maximum.toString()} ${sizing.unit}`.trim();\n }\n return `Liian suuri: arvon täytyy olla ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue2.minimum.toString()} ${sizing.unit}`.trim();\n }\n return `Liian pieni: arvon täytyy olla ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;\n if (_issue.format === "regex") {\n return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;\n }\n return `Virheellinen ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Virheellinen luku: täytyy olla luvun ${issue2.divisor} monikerta`;\n case "unrecognized_keys":\n return `${issue2.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return "Virheellinen avain tietueessa";\n case "invalid_union":\n return "Virheellinen unioni";\n case "invalid_element":\n return "Virheellinen arvo joukossa";\n default:\n return `Virheellinen syöte`;\n }\n };\n};\nfunction fi_default() {\n return {\n localeError: error10()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/fr.js\nvar error11 = () => {\n const Sizable = {\n string: { unit: "caractères", verb: "avoir" },\n file: { unit: "octets", verb: "avoir" },\n array: { unit: "éléments", verb: "avoir" },\n set: { unit: "éléments", verb: "avoir" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "nombre";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "tableau";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "entrée",\n email: "adresse e-mail",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "date et heure ISO",\n date: "date ISO",\n time: "heure ISO",\n duration: "durée ISO",\n ipv4: "adresse IPv4",\n ipv6: "adresse IPv6",\n cidrv4: "plage IPv4",\n cidrv6: "plage IPv6",\n base64: "chaîne encodée en base64",\n base64url: "chaîne encodée en base64url",\n json_string: "chaîne JSON",\n e164: "numéro E.164",\n jwt: "JWT",\n template_literal: "entrée"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Entrée invalide : ${issue2.expected} attendu, ${parsedType2(issue2.input)} reçu`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Entrée invalide : ${stringifyPrimitive(issue2.values[0])} attendu`;\n return `Option invalide : une valeur parmi ${joinValues(issue2.values, "|")} attendue`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Trop grand : ${issue2.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;\n return `Trop grand : ${issue2.origin ?? "valeur"} doit être ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Trop petit : ${issue2.origin} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Trop petit : ${issue2.origin} doit être ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Chaîne invalide : doit inclure "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} invalide`;\n }\n case "not_multiple_of":\n return `Nombre invalide : doit être un multiple de ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Clé${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Clé invalide dans ${issue2.origin}`;\n case "invalid_union":\n return "Entrée invalide";\n case "invalid_element":\n return `Valeur invalide dans ${issue2.origin}`;\n default:\n return `Entrée invalide`;\n }\n };\n};\nfunction fr_default() {\n return {\n localeError: error11()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/fr-CA.js\nvar error12 = () => {\n const Sizable = {\n string: { unit: "caractères", verb: "avoir" },\n file: { unit: "octets", verb: "avoir" },\n array: { unit: "éléments", verb: "avoir" },\n set: { unit: "éléments", verb: "avoir" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "entrée",\n email: "adresse courriel",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "date-heure ISO",\n date: "date ISO",\n time: "heure ISO",\n duration: "durée ISO",\n ipv4: "adresse IPv4",\n ipv6: "adresse IPv6",\n cidrv4: "plage IPv4",\n cidrv6: "plage IPv6",\n base64: "chaîne encodée en base64",\n base64url: "chaîne encodée en base64url",\n json_string: "chaîne JSON",\n e164: "numéro E.164",\n jwt: "JWT",\n template_literal: "entrée"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Entrée invalide : attendu ${issue2.expected}, reçu ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Entrée invalide : attendu ${stringifyPrimitive(issue2.values[0])}`;\n return `Option invalide : attendu l\'une des valeurs suivantes ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "≤" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} ait ${adj}${issue2.maximum.toString()} ${sizing.unit}`;\n return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} soit ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? "≥" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Trop petit : attendu que ${issue2.origin} ait ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Trop petit : attendu que ${issue2.origin} soit ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Chaîne invalide : doit inclure "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} invalide`;\n }\n case "not_multiple_of":\n return `Nombre invalide : doit être un multiple de ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Clé${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Clé invalide dans ${issue2.origin}`;\n case "invalid_union":\n return "Entrée invalide";\n case "invalid_element":\n return `Valeur invalide dans ${issue2.origin}`;\n default:\n return `Entrée invalide`;\n }\n };\n};\nfunction fr_CA_default() {\n return {\n localeError: error12()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/he.js\nvar error13 = () => {\n const Sizable = {\n string: { unit: "אותיות", verb: "לכלול" },\n file: { unit: "בייטים", verb: "לכלול" },\n array: { unit: "פריטים", verb: "לכלול" },\n set: { unit: "פריטים", verb: "לכלול" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "קלט",\n email: "כתובת אימייל",\n url: "כתובת רשת",\n emoji: "אימוג\'י",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "תאריך וזמן ISO",\n date: "תאריך ISO",\n time: "זמן ISO",\n duration: "משך זמן ISO",\n ipv4: "כתובת IPv4",\n ipv6: "כתובת IPv6",\n cidrv4: "טווח IPv4",\n cidrv6: "טווח IPv6",\n base64: "מחרוזת בבסיס 64",\n base64url: "מחרוזת בבסיס 64 לכתובות רשת",\n json_string: "מחרוזת JSON",\n e164: "מספר E.164",\n jwt: "JWT",\n template_literal: "קלט"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `קלט לא תקין: צריך ${issue2.expected}, התקבל ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `קלט לא תקין: צריך ${stringifyPrimitive(issue2.values[0])}`;\n return `קלט לא תקין: צריך אחת מהאפשרויות ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `גדול מדי: ${issue2.origin ?? "value"} צריך להיות ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;\n return `גדול מדי: ${issue2.origin ?? "value"} צריך להיות ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `קטן מדי: ${issue2.origin} צריך להיות ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `קטן מדי: ${issue2.origin} צריך להיות ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `מחרוזת לא תקינה: חייבת להתחיל ב"${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `מחרוזת לא תקינה: חייבת להסתיים ב "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `מחרוזת לא תקינה: חייבת לכלול "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `מחרוזת לא תקינה: חייבת להתאים לתבנית ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} לא תקין`;\n }\n case "not_multiple_of":\n return `מספר לא תקין: חייב להיות מכפלה של ${issue2.divisor}`;\n case "unrecognized_keys":\n return `מפתח${issue2.keys.length > 1 ? "ות" : ""} לא מזוה${issue2.keys.length > 1 ? "ים" : "ה"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `מפתח לא תקין ב${issue2.origin}`;\n case "invalid_union":\n return "קלט לא תקין";\n case "invalid_element":\n return `ערך לא תקין ב${issue2.origin}`;\n default:\n return `קלט לא תקין`;\n }\n };\n};\nfunction he_default() {\n return {\n localeError: error13()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/hu.js\nvar error14 = () => {\n const Sizable = {\n string: { unit: "karakter", verb: "legyen" },\n file: { unit: "byte", verb: "legyen" },\n array: { unit: "elem", verb: "legyen" },\n set: { unit: "elem", verb: "legyen" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "szám";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "tömb";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "bemenet",\n email: "email cím",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO időbélyeg",\n date: "ISO dátum",\n time: "ISO idő",\n duration: "ISO időintervallum",\n ipv4: "IPv4 cím",\n ipv6: "IPv6 cím",\n cidrv4: "IPv4 tartomány",\n cidrv6: "IPv6 tartomány",\n base64: "base64-kódolt string",\n base64url: "base64url-kódolt string",\n json_string: "JSON string",\n e164: "E.164 szám",\n jwt: "JWT",\n template_literal: "bemenet"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Érvénytelen bemenet: a várt érték ${issue2.expected}, a kapott érték ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Érvénytelen bemenet: a várt érték ${stringifyPrimitive(issue2.values[0])}`;\n return `Érvénytelen opció: valamelyik érték várt ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Túl nagy: ${issue2.origin ?? "érték"} mérete túl nagy ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elem"}`;\n return `Túl nagy: a bemeneti érték ${issue2.origin ?? "érték"} túl nagy: ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Túl kicsi: a bemeneti érték ${issue2.origin} mérete túl kicsi ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Túl kicsi: a bemeneti érték ${issue2.origin} túl kicsi ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`;\n if (_issue.format === "ends_with")\n return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`;\n if (_issue.format === "includes")\n return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`;\n if (_issue.format === "regex")\n return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`;\n return `Érvénytelen ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Érvénytelen szám: ${issue2.divisor} többszörösének kell lennie`;\n case "unrecognized_keys":\n return `Ismeretlen kulcs${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Érvénytelen kulcs ${issue2.origin}`;\n case "invalid_union":\n return "Érvénytelen bemenet";\n case "invalid_element":\n return `Érvénytelen érték: ${issue2.origin}`;\n default:\n return `Érvénytelen bemenet`;\n }\n };\n};\nfunction hu_default() {\n return {\n localeError: error14()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/id.js\nvar error15 = () => {\n const Sizable = {\n string: { unit: "karakter", verb: "memiliki" },\n file: { unit: "byte", verb: "memiliki" },\n array: { unit: "item", verb: "memiliki" },\n set: { unit: "item", verb: "memiliki" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "input",\n email: "alamat email",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "tanggal dan waktu format ISO",\n date: "tanggal format ISO",\n time: "jam format ISO",\n duration: "durasi format ISO",\n ipv4: "alamat IPv4",\n ipv6: "alamat IPv6",\n cidrv4: "rentang alamat IPv4",\n cidrv6: "rentang alamat IPv6",\n base64: "string dengan enkode base64",\n base64url: "string dengan enkode base64url",\n json_string: "string JSON",\n e164: "angka E.164",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Input tidak valid: diharapkan ${issue2.expected}, diterima ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Input tidak valid: diharapkan ${stringifyPrimitive(issue2.values[0])}`;\n return `Pilihan tidak valid: diharapkan salah satu dari ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} memiliki ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`;\n return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} menjadi ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Terlalu kecil: diharapkan ${issue2.origin} memiliki ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Terlalu kecil: diharapkan ${issue2.origin} menjadi ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `String tidak valid: harus menyertakan "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `String tidak valid: harus sesuai pola ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} tidak valid`;\n }\n case "not_multiple_of":\n return `Angka tidak valid: harus kelipatan dari ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Kunci tidak dikenali ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Kunci tidak valid di ${issue2.origin}`;\n case "invalid_union":\n return "Input tidak valid";\n case "invalid_element":\n return `Nilai tidak valid di ${issue2.origin}`;\n default:\n return `Input tidak valid`;\n }\n };\n};\nfunction id_default() {\n return {\n localeError: error15()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/it.js\nvar error16 = () => {\n const Sizable = {\n string: { unit: "caratteri", verb: "avere" },\n file: { unit: "byte", verb: "avere" },\n array: { unit: "elementi", verb: "avere" },\n set: { unit: "elementi", verb: "avere" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "numero";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "vettore";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "input",\n email: "indirizzo email",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "data e ora ISO",\n date: "data ISO",\n time: "ora ISO",\n duration: "durata ISO",\n ipv4: "indirizzo IPv4",\n ipv6: "indirizzo IPv6",\n cidrv4: "intervallo IPv4",\n cidrv6: "intervallo IPv6",\n base64: "stringa codificata in base64",\n base64url: "URL codificata in base64",\n json_string: "stringa JSON",\n e164: "numero E.164",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Input non valido: atteso ${issue2.expected}, ricevuto ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Input non valido: atteso ${stringifyPrimitive(issue2.values[0])}`;\n return `Opzione non valida: atteso uno tra ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Troppo grande: ${issue2.origin ?? "valore"} deve avere ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementi"}`;\n return `Troppo grande: ${issue2.origin ?? "valore"} deve essere ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Troppo piccolo: ${issue2.origin} deve avere ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Troppo piccolo: ${issue2.origin} deve essere ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Stringa non valida: deve terminare con "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Stringa non valida: deve includere "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;\n return `Invalid ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Numero non valido: deve essere un multiplo di ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Chiav${issue2.keys.length > 1 ? "i" : "e"} non riconosciut${issue2.keys.length > 1 ? "e" : "a"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Chiave non valida in ${issue2.origin}`;\n case "invalid_union":\n return "Input non valido";\n case "invalid_element":\n return `Valore non valido in ${issue2.origin}`;\n default:\n return `Input non valido`;\n }\n };\n};\nfunction it_default() {\n return {\n localeError: error16()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ja.js\nvar error17 = () => {\n const Sizable = {\n string: { unit: "文字", verb: "である" },\n file: { unit: "バイト", verb: "である" },\n array: { unit: "要素", verb: "である" },\n set: { unit: "要素", verb: "である" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "数値";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "配列";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "入力値",\n email: "メールアドレス",\n url: "URL",\n emoji: "絵文字",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO日時",\n date: "ISO日付",\n time: "ISO時刻",\n duration: "ISO期間",\n ipv4: "IPv4アドレス",\n ipv6: "IPv6アドレス",\n cidrv4: "IPv4範囲",\n cidrv6: "IPv6範囲",\n base64: "base64エンコード文字列",\n base64url: "base64urlエンコード文字列",\n json_string: "JSON文字列",\n e164: "E.164番号",\n jwt: "JWT",\n template_literal: "入力値"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `無効な入力: ${issue2.expected}が期待されましたが、${parsedType2(issue2.input)}が入力されました`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `無効な入力: ${stringifyPrimitive(issue2.values[0])}が期待されました`;\n return `無効な選択: ${joinValues(issue2.values, "、")}のいずれかである必要があります`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `大きすぎる値: ${issue2.origin ?? "値"}は${issue2.maximum.toString()}${sizing.unit ?? "要素"}${adj}である必要があります`;\n return `大きすぎる値: ${issue2.origin ?? "値"}は${issue2.maximum.toString()}${adj}である必要があります`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `小さすぎる値: ${issue2.origin}は${issue2.minimum.toString()}${sizing.unit}${adj}である必要があります`;\n return `小さすぎる値: ${issue2.origin}は${issue2.minimum.toString()}${adj}である必要があります`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `無効な文字列: "${_issue.prefix}"で始まる必要があります`;\n if (_issue.format === "ends_with")\n return `無効な文字列: "${_issue.suffix}"で終わる必要があります`;\n if (_issue.format === "includes")\n return `無効な文字列: "${_issue.includes}"を含む必要があります`;\n if (_issue.format === "regex")\n return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`;\n return `無効な${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `無効な数値: ${issue2.divisor}の倍数である必要があります`;\n case "unrecognized_keys":\n return `認識されていないキー${issue2.keys.length > 1 ? "群" : ""}: ${joinValues(issue2.keys, "、")}`;\n case "invalid_key":\n return `${issue2.origin}内の無効なキー`;\n case "invalid_union":\n return "無効な入力";\n case "invalid_element":\n return `${issue2.origin}内の無効な値`;\n default:\n return `無効な入力`;\n }\n };\n};\nfunction ja_default() {\n return {\n localeError: error17()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/kh.js\nvar error18 = () => {\n const Sizable = {\n string: { unit: "តួអក្សរ", verb: "គួរមាន" },\n file: { unit: "បៃ", verb: "គួរមាន" },\n array: { unit: "ធាតុ", verb: "គួរមាន" },\n set: { unit: "ធាតុ", verb: "គួរមាន" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "មិនមែនជាលេខ (NaN)" : "លេខ";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "អារេ (Array)";\n }\n if (data === null) {\n return "គ្មានតម្លៃ (null)";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "ទិន្នន័យបញ្ចូល",\n email: "អាសយដ្ឋានអ៊ីមែល",\n url: "URL",\n emoji: "សញ្ញាអារម្មណ៍",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "កាលបរិច្ឆេទ និងម៉ោង ISO",\n date: "កាលបរិច្ឆេទ ISO",\n time: "ម៉ោង ISO",\n duration: "រយៈពេល ISO",\n ipv4: "អាសយដ្ឋាន IPv4",\n ipv6: "អាសយដ្ឋាន IPv6",\n cidrv4: "ដែនអាសយដ្ឋាន IPv4",\n cidrv6: "ដែនអាសយដ្ឋាន IPv6",\n base64: "ខ្សែអក្សរអ៊ិកូដ base64",\n base64url: "ខ្សែអក្សរអ៊ិកូដ base64url",\n json_string: "ខ្សែអក្សរ JSON",\n e164: "លេខ E.164",\n jwt: "JWT",\n template_literal: "ទិន្នន័យបញ្ចូល"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${issue2.expected} ប៉ុន្តែទទួលបាន ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${stringifyPrimitive(issue2.values[0])}`;\n return `ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `ធំពេក៖ ត្រូវការ ${issue2.origin ?? "តម្លៃ"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "ធាតុ"}`;\n return `ធំពេក៖ ត្រូវការ ${issue2.origin ?? "តម្លៃ"} ${adj} ${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `តូចពេក៖ ត្រូវការ ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `តូចពេក៖ ត្រូវការ ${issue2.origin} ${adj} ${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${_issue.pattern}`;\n return `មិនត្រឹមត្រូវ៖ ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${issue2.divisor}`;\n case "unrecognized_keys":\n return `រកឃើញសោមិនស្គាល់៖ ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `សោមិនត្រឹមត្រូវនៅក្នុង ${issue2.origin}`;\n case "invalid_union":\n return `ទិន្នន័យមិនត្រឹមត្រូវ`;\n case "invalid_element":\n return `ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${issue2.origin}`;\n default:\n return `ទិន្នន័យមិនត្រឹមត្រូវ`;\n }\n };\n};\nfunction kh_default() {\n return {\n localeError: error18()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ko.js\nvar error19 = () => {\n const Sizable = {\n string: { unit: "문자", verb: "to have" },\n file: { unit: "바이트", verb: "to have" },\n array: { unit: "개", verb: "to have" },\n set: { unit: "개", verb: "to have" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "입력",\n email: "이메일 주소",\n url: "URL",\n emoji: "이모지",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO 날짜시간",\n date: "ISO 날짜",\n time: "ISO 시간",\n duration: "ISO 기간",\n ipv4: "IPv4 주소",\n ipv6: "IPv6 주소",\n cidrv4: "IPv4 범위",\n cidrv6: "IPv6 범위",\n base64: "base64 인코딩 문자열",\n base64url: "base64url 인코딩 문자열",\n json_string: "JSON 문자열",\n e164: "E.164 번호",\n jwt: "JWT",\n template_literal: "입력"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `잘못된 입력: 예상 타입은 ${issue2.expected}, 받은 타입은 ${parsedType2(issue2.input)}입니다`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `잘못된 입력: 값은 ${stringifyPrimitive(issue2.values[0])} 이어야 합니다`;\n return `잘못된 옵션: ${joinValues(issue2.values, "또는 ")} 중 하나여야 합니다`;\n case "too_big": {\n const adj = issue2.inclusive ? "이하" : "미만";\n const suffix = adj === "미만" ? "이어야 합니다" : "여야 합니다";\n const sizing = getSizing(issue2.origin);\n const unit = sizing?.unit ?? "요소";\n if (sizing)\n return `${issue2.origin ?? "값"}이 너무 큽니다: ${issue2.maximum.toString()}${unit} ${adj}${suffix}`;\n return `${issue2.origin ?? "값"}이 너무 큽니다: ${issue2.maximum.toString()} ${adj}${suffix}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? "이상" : "초과";\n const suffix = adj === "이상" ? "이어야 합니다" : "여야 합니다";\n const sizing = getSizing(issue2.origin);\n const unit = sizing?.unit ?? "요소";\n if (sizing) {\n return `${issue2.origin ?? "값"}이 너무 작습니다: ${issue2.minimum.toString()}${unit} ${adj}${suffix}`;\n }\n return `${issue2.origin ?? "값"}이 너무 작습니다: ${issue2.minimum.toString()} ${adj}${suffix}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `잘못된 문자열: "${_issue.prefix}"(으)로 시작해야 합니다`;\n }\n if (_issue.format === "ends_with")\n return `잘못된 문자열: "${_issue.suffix}"(으)로 끝나야 합니다`;\n if (_issue.format === "includes")\n return `잘못된 문자열: "${_issue.includes}"을(를) 포함해야 합니다`;\n if (_issue.format === "regex")\n return `잘못된 문자열: 정규식 ${_issue.pattern} 패턴과 일치해야 합니다`;\n return `잘못된 ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `잘못된 숫자: ${issue2.divisor}의 배수여야 합니다`;\n case "unrecognized_keys":\n return `인식할 수 없는 키: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `잘못된 키: ${issue2.origin}`;\n case "invalid_union":\n return `잘못된 입력`;\n case "invalid_element":\n return `잘못된 값: ${issue2.origin}`;\n default:\n return `잘못된 입력`;\n }\n };\n};\nfunction ko_default() {\n return {\n localeError: error19()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/mk.js\nvar error20 = () => {\n const Sizable = {\n string: { unit: "знаци", verb: "да имаат" },\n file: { unit: "бајти", verb: "да имаат" },\n array: { unit: "ставки", verb: "да имаат" },\n set: { unit: "ставки", verb: "да имаат" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "број";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "низа";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "внес",\n email: "адреса на е-пошта",\n url: "URL",\n emoji: "емоџи",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO датум и време",\n date: "ISO датум",\n time: "ISO време",\n duration: "ISO времетраење",\n ipv4: "IPv4 адреса",\n ipv6: "IPv6 адреса",\n cidrv4: "IPv4 опсег",\n cidrv6: "IPv6 опсег",\n base64: "base64-енкодирана низа",\n base64url: "base64url-енкодирана низа",\n json_string: "JSON низа",\n e164: "E.164 број",\n jwt: "JWT",\n template_literal: "внес"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Грешен внес: се очекува ${issue2.expected}, примено ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;\n return `Грешана опција: се очекува една ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Премногу голем: се очекува ${issue2.origin ?? "вредноста"} да има ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "елементи"}`;\n return `Премногу голем: се очекува ${issue2.origin ?? "вредноста"} да биде ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Премногу мал: се очекува ${issue2.origin} да има ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Премногу мал: се очекува ${issue2.origin} да биде ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Неважечка низа: мора да започнува со "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `Неважечка низа: мора да завршува со "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Неважечка низа: мора да вклучува "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Неважечка низа: мора да одгоара на патернот ${_issue.pattern}`;\n return `Invalid ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Грешен број: мора да биде делив со ${issue2.divisor}`;\n case "unrecognized_keys":\n return `${issue2.keys.length > 1 ? "Непрепознаени клучеви" : "Непрепознаен клуч"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Грешен клуч во ${issue2.origin}`;\n case "invalid_union":\n return "Грешен внес";\n case "invalid_element":\n return `Грешна вредност во ${issue2.origin}`;\n default:\n return `Грешен внес`;\n }\n };\n};\nfunction mk_default() {\n return {\n localeError: error20()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ms.js\nvar error21 = () => {\n const Sizable = {\n string: { unit: "aksara", verb: "mempunyai" },\n file: { unit: "bait", verb: "mempunyai" },\n array: { unit: "elemen", verb: "mempunyai" },\n set: { unit: "elemen", verb: "mempunyai" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "nombor";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "input",\n email: "alamat e-mel",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "tarikh masa ISO",\n date: "tarikh ISO",\n time: "masa ISO",\n duration: "tempoh ISO",\n ipv4: "alamat IPv4",\n ipv6: "alamat IPv6",\n cidrv4: "julat IPv4",\n cidrv6: "julat IPv6",\n base64: "string dikodkan base64",\n base64url: "string dikodkan base64url",\n json_string: "string JSON",\n e164: "nombor E.164",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Input tidak sah: dijangka ${issue2.expected}, diterima ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Input tidak sah: dijangka ${stringifyPrimitive(issue2.values[0])}`;\n return `Pilihan tidak sah: dijangka salah satu daripada ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`;\n return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} adalah ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Terlalu kecil: dijangka ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Terlalu kecil: dijangka ${issue2.origin} adalah ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `String tidak sah: mesti mengandungi "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} tidak sah`;\n }\n case "not_multiple_of":\n return `Nombor tidak sah: perlu gandaan ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Kunci tidak dikenali: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Kunci tidak sah dalam ${issue2.origin}`;\n case "invalid_union":\n return "Input tidak sah";\n case "invalid_element":\n return `Nilai tidak sah dalam ${issue2.origin}`;\n default:\n return `Input tidak sah`;\n }\n };\n};\nfunction ms_default() {\n return {\n localeError: error21()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/nl.js\nvar error22 = () => {\n const Sizable = {\n string: { unit: "tekens" },\n file: { unit: "bytes" },\n array: { unit: "elementen" },\n set: { unit: "elementen" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "getal";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "invoer",\n email: "emailadres",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO datum en tijd",\n date: "ISO datum",\n time: "ISO tijd",\n duration: "ISO duur",\n ipv4: "IPv4-adres",\n ipv6: "IPv6-adres",\n cidrv4: "IPv4-bereik",\n cidrv6: "IPv6-bereik",\n base64: "base64-gecodeerde tekst",\n base64url: "base64 URL-gecodeerde tekst",\n json_string: "JSON string",\n e164: "E.164-nummer",\n jwt: "JWT",\n template_literal: "invoer"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Ongeldige invoer: verwacht ${issue2.expected}, ontving ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Ongeldige invoer: verwacht ${stringifyPrimitive(issue2.values[0])}`;\n return `Ongeldige optie: verwacht één van ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Te lang: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementen"} bevat`;\n return `Te lang: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} is`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Te kort: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} bevat`;\n }\n return `Te kort: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`;\n }\n if (_issue.format === "ends_with")\n return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`;\n if (_issue.format === "includes")\n return `Ongeldige tekst: moet "${_issue.includes}" bevatten`;\n if (_issue.format === "regex")\n return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`;\n return `Ongeldig: ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Ongeldig getal: moet een veelvoud van ${issue2.divisor} zijn`;\n case "unrecognized_keys":\n return `Onbekende key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Ongeldige key in ${issue2.origin}`;\n case "invalid_union":\n return "Ongeldige invoer";\n case "invalid_element":\n return `Ongeldige waarde in ${issue2.origin}`;\n default:\n return `Ongeldige invoer`;\n }\n };\n};\nfunction nl_default() {\n return {\n localeError: error22()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/no.js\nvar error23 = () => {\n const Sizable = {\n string: { unit: "tegn", verb: "å ha" },\n file: { unit: "bytes", verb: "å ha" },\n array: { unit: "elementer", verb: "å inneholde" },\n set: { unit: "elementer", verb: "å inneholde" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "tall";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "liste";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "input",\n email: "e-postadresse",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO dato- og klokkeslett",\n date: "ISO-dato",\n time: "ISO-klokkeslett",\n duration: "ISO-varighet",\n ipv4: "IPv4-område",\n ipv6: "IPv6-område",\n cidrv4: "IPv4-spekter",\n cidrv6: "IPv6-spekter",\n base64: "base64-enkodet streng",\n base64url: "base64url-enkodet streng",\n json_string: "JSON-streng",\n e164: "E.164-nummer",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Ugyldig input: forventet ${issue2.expected}, fikk ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`;\n return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `For stor(t): forventet ${issue2.origin ?? "value"} til å ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`;\n return `For stor(t): forventet ${issue2.origin ?? "value"} til å ha ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `For lite(n): forventet ${issue2.origin} til å ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `For lite(n): forventet ${issue2.origin} til å ha ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Ugyldig streng: må starte med "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Ugyldig streng: må ende med "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Ugyldig streng: må inneholde "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Ugyldig streng: må matche mønsteret ${_issue.pattern}`;\n return `Ugyldig ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Ugyldig tall: må være et multiplum av ${issue2.divisor}`;\n case "unrecognized_keys":\n return `${issue2.keys.length > 1 ? "Ukjente nøkler" : "Ukjent nøkkel"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Ugyldig nøkkel i ${issue2.origin}`;\n case "invalid_union":\n return "Ugyldig input";\n case "invalid_element":\n return `Ugyldig verdi i ${issue2.origin}`;\n default:\n return `Ugyldig input`;\n }\n };\n};\nfunction no_default() {\n return {\n localeError: error23()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ota.js\nvar error24 = () => {\n const Sizable = {\n string: { unit: "harf", verb: "olmalıdır" },\n file: { unit: "bayt", verb: "olmalıdır" },\n array: { unit: "unsur", verb: "olmalıdır" },\n set: { unit: "unsur", verb: "olmalıdır" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "numara";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "saf";\n }\n if (data === null) {\n return "gayb";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "giren",\n email: "epostagâh",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO hengâmı",\n date: "ISO tarihi",\n time: "ISO zamanı",\n duration: "ISO müddeti",\n ipv4: "IPv4 nişânı",\n ipv6: "IPv6 nişânı",\n cidrv4: "IPv4 menzili",\n cidrv6: "IPv6 menzili",\n base64: "base64-şifreli metin",\n base64url: "base64url-şifreli metin",\n json_string: "JSON metin",\n e164: "E.164 sayısı",\n jwt: "JWT",\n template_literal: "giren"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Fâsit giren: umulan ${issue2.expected}, alınan ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Fâsit giren: umulan ${stringifyPrimitive(issue2.values[0])}`;\n return `Fâsit tercih: mûteberler ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Fazla büyük: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmalıydı.`;\n return `Fazla büyük: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmalıydı.`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Fazla küçük: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmalıydı.`;\n }\n return `Fazla küçük: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmalıydı.`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Fâsit metin: "${_issue.prefix}" ile başlamalı.`;\n if (_issue.format === "ends_with")\n return `Fâsit metin: "${_issue.suffix}" ile bitmeli.`;\n if (_issue.format === "includes")\n return `Fâsit metin: "${_issue.includes}" ihtivâ etmeli.`;\n if (_issue.format === "regex")\n return `Fâsit metin: ${_issue.pattern} nakşına uymalı.`;\n return `Fâsit ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Fâsit sayı: ${issue2.divisor} katı olmalıydı.`;\n case "unrecognized_keys":\n return `Tanınmayan anahtar ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `${issue2.origin} için tanınmayan anahtar var.`;\n case "invalid_union":\n return "Giren tanınamadı.";\n case "invalid_element":\n return `${issue2.origin} için tanınmayan kıymet var.`;\n default:\n return `Kıymet tanınamadı.`;\n }\n };\n};\nfunction ota_default() {\n return {\n localeError: error24()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/pl.js\nvar error25 = () => {\n const Sizable = {\n string: { unit: "znaków", verb: "mieć" },\n file: { unit: "bajtów", verb: "mieć" },\n array: { unit: "elementów", verb: "mieć" },\n set: { unit: "elementów", verb: "mieć" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "liczba";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "tablica";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "wyrażenie",\n email: "adres email",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "data i godzina w formacie ISO",\n date: "data w formacie ISO",\n time: "godzina w formacie ISO",\n duration: "czas trwania ISO",\n ipv4: "adres IPv4",\n ipv6: "adres IPv6",\n cidrv4: "zakres IPv4",\n cidrv6: "zakres IPv6",\n base64: "ciąg znaków zakodowany w formacie base64",\n base64url: "ciąg znaków zakodowany w formacie base64url",\n json_string: "ciąg znaków w formacie JSON",\n e164: "liczba E.164",\n jwt: "JWT",\n template_literal: "wejście"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Nieprawidłowe dane wejściowe: oczekiwano ${issue2.expected}, otrzymano ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Nieprawidłowe dane wejściowe: oczekiwano ${stringifyPrimitive(issue2.values[0])}`;\n return `Nieprawidłowa opcja: oczekiwano jednej z wartości ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Za duża wartość: oczekiwano, że ${issue2.origin ?? "wartość"} będzie mieć ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementów"}`;\n }\n return `Zbyt duż(y/a/e): oczekiwano, że ${issue2.origin ?? "wartość"} będzie wynosić ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Za mała wartość: oczekiwano, że ${issue2.origin ?? "wartość"} będzie mieć ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "elementów"}`;\n }\n return `Zbyt mał(y/a/e): oczekiwano, że ${issue2.origin ?? "wartość"} będzie wynosić ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Nieprawidłowy ciąg znaków: musi zaczynać się od "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Nieprawidłowy ciąg znaków: musi kończyć się na "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Nieprawidłowy ciąg znaków: musi zawierać "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${_issue.pattern}`;\n return `Nieprawidłow(y/a/e) ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Nieprawidłowa liczba: musi być wielokrotnością ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Nierozpoznane klucze${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Nieprawidłowy klucz w ${issue2.origin}`;\n case "invalid_union":\n return "Nieprawidłowe dane wejściowe";\n case "invalid_element":\n return `Nieprawidłowa wartość w ${issue2.origin}`;\n default:\n return `Nieprawidłowe dane wejściowe`;\n }\n };\n};\nfunction pl_default() {\n return {\n localeError: error25()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/pt.js\nvar error26 = () => {\n const Sizable = {\n string: { unit: "caracteres", verb: "ter" },\n file: { unit: "bytes", verb: "ter" },\n array: { unit: "itens", verb: "ter" },\n set: { unit: "itens", verb: "ter" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "número";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "nulo";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "padrão",\n email: "endereço de e-mail",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "data e hora ISO",\n date: "data ISO",\n time: "hora ISO",\n duration: "duração ISO",\n ipv4: "endereço IPv4",\n ipv6: "endereço IPv6",\n cidrv4: "faixa de IPv4",\n cidrv6: "faixa de IPv6",\n base64: "texto codificado em base64",\n base64url: "URL codificada em base64",\n json_string: "texto JSON",\n e164: "número E.164",\n jwt: "JWT",\n template_literal: "entrada"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Tipo inválido: esperado ${issue2.expected}, recebido ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Entrada inválida: esperado ${stringifyPrimitive(issue2.values[0])}`;\n return `Opção inválida: esperada uma das ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Muito grande: esperado que ${issue2.origin ?? "valor"} tivesse ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;\n return `Muito grande: esperado que ${issue2.origin ?? "valor"} fosse ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Muito pequeno: esperado que ${issue2.origin} tivesse ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Muito pequeno: esperado que ${issue2.origin} fosse ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Texto inválido: deve começar com "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Texto inválido: deve terminar com "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Texto inválido: deve incluir "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} inválido`;\n }\n case "not_multiple_of":\n return `Número inválido: deve ser múltiplo de ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Chave${issue2.keys.length > 1 ? "s" : ""} desconhecida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Chave inválida em ${issue2.origin}`;\n case "invalid_union":\n return "Entrada inválida";\n case "invalid_element":\n return `Valor inválido em ${issue2.origin}`;\n default:\n return `Campo inválido`;\n }\n };\n};\nfunction pt_default() {\n return {\n localeError: error26()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ru.js\nfunction getRussianPlural(count, one, few, many) {\n const absCount = Math.abs(count);\n const lastDigit = absCount % 10;\n const lastTwoDigits = absCount % 100;\n if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {\n return many;\n }\n if (lastDigit === 1) {\n return one;\n }\n if (lastDigit >= 2 && lastDigit <= 4) {\n return few;\n }\n return many;\n}\nvar error27 = () => {\n const Sizable = {\n string: {\n unit: {\n one: "символ",\n few: "символа",\n many: "символов"\n },\n verb: "иметь"\n },\n file: {\n unit: {\n one: "байт",\n few: "байта",\n many: "байт"\n },\n verb: "иметь"\n },\n array: {\n unit: {\n one: "элемент",\n few: "элемента",\n many: "элементов"\n },\n verb: "иметь"\n },\n set: {\n unit: {\n one: "элемент",\n few: "элемента",\n many: "элементов"\n },\n verb: "иметь"\n }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "число";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "массив";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "ввод",\n email: "email адрес",\n url: "URL",\n emoji: "эмодзи",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO дата и время",\n date: "ISO дата",\n time: "ISO время",\n duration: "ISO длительность",\n ipv4: "IPv4 адрес",\n ipv6: "IPv6 адрес",\n cidrv4: "IPv4 диапазон",\n cidrv6: "IPv6 диапазон",\n base64: "строка в формате base64",\n base64url: "строка в формате base64url",\n json_string: "JSON строка",\n e164: "номер E.164",\n jwt: "JWT",\n template_literal: "ввод"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Неверный ввод: ожидалось ${issue2.expected}, получено ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Неверный ввод: ожидалось ${stringifyPrimitive(issue2.values[0])}`;\n return `Неверный вариант: ожидалось одно из ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n const maxValue = Number(issue2.maximum);\n const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);\n return `Слишком большое значение: ожидалось, что ${issue2.origin ?? "значение"} будет иметь ${adj}${issue2.maximum.toString()} ${unit}`;\n }\n return `Слишком большое значение: ожидалось, что ${issue2.origin ?? "значение"} будет ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n const minValue = Number(issue2.minimum);\n const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);\n return `Слишком маленькое значение: ожидалось, что ${issue2.origin} будет иметь ${adj}${issue2.minimum.toString()} ${unit}`;\n }\n return `Слишком маленькое значение: ожидалось, что ${issue2.origin} будет ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Неверная строка: должна начинаться с "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Неверная строка: должна заканчиваться на "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Неверная строка: должна содержать "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Неверная строка: должна соответствовать шаблону ${_issue.pattern}`;\n return `Неверный ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Неверное число: должно быть кратным ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Нераспознанн${issue2.keys.length > 1 ? "ые" : "ый"} ключ${issue2.keys.length > 1 ? "и" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Неверный ключ в ${issue2.origin}`;\n case "invalid_union":\n return "Неверные входные данные";\n case "invalid_element":\n return `Неверное значение в ${issue2.origin}`;\n default:\n return `Неверные входные данные`;\n }\n };\n};\nfunction ru_default() {\n return {\n localeError: error27()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/sl.js\nvar error28 = () => {\n const Sizable = {\n string: { unit: "znakov", verb: "imeti" },\n file: { unit: "bajtov", verb: "imeti" },\n array: { unit: "elementov", verb: "imeti" },\n set: { unit: "elementov", verb: "imeti" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "število";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "tabela";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "vnos",\n email: "e-poštni naslov",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO datum in čas",\n date: "ISO datum",\n time: "ISO čas",\n duration: "ISO trajanje",\n ipv4: "IPv4 naslov",\n ipv6: "IPv6 naslov",\n cidrv4: "obseg IPv4",\n cidrv6: "obseg IPv6",\n base64: "base64 kodiran niz",\n base64url: "base64url kodiran niz",\n json_string: "JSON niz",\n e164: "E.164 številka",\n jwt: "JWT",\n template_literal: "vnos"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Neveljaven vnos: pričakovano ${issue2.expected}, prejeto ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Neveljaven vnos: pričakovano ${stringifyPrimitive(issue2.values[0])}`;\n return `Neveljavna možnost: pričakovano eno izmed ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Preveliko: pričakovano, da bo ${issue2.origin ?? "vrednost"} imelo ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementov"}`;\n return `Preveliko: pričakovano, da bo ${issue2.origin ?? "vrednost"} ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Premajhno: pričakovano, da bo ${issue2.origin} imelo ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Premajhno: pričakovano, da bo ${issue2.origin} ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Neveljaven niz: mora se začeti z "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `Neveljaven niz: mora se končati z "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Neveljaven niz: mora vsebovati "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`;\n return `Neveljaven ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Neveljavno število: mora biti večkratnik ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Neprepoznan${issue2.keys.length > 1 ? "i ključi" : " ključ"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Neveljaven ključ v ${issue2.origin}`;\n case "invalid_union":\n return "Neveljaven vnos";\n case "invalid_element":\n return `Neveljavna vrednost v ${issue2.origin}`;\n default:\n return "Neveljaven vnos";\n }\n };\n};\nfunction sl_default() {\n return {\n localeError: error28()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/sv.js\nvar error29 = () => {\n const Sizable = {\n string: { unit: "tecken", verb: "att ha" },\n file: { unit: "bytes", verb: "att ha" },\n array: { unit: "objekt", verb: "att innehålla" },\n set: { unit: "objekt", verb: "att innehålla" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "antal";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "lista";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "reguljärt uttryck",\n email: "e-postadress",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO-datum och tid",\n date: "ISO-datum",\n time: "ISO-tid",\n duration: "ISO-varaktighet",\n ipv4: "IPv4-intervall",\n ipv6: "IPv6-intervall",\n cidrv4: "IPv4-spektrum",\n cidrv6: "IPv6-spektrum",\n base64: "base64-kodad sträng",\n base64url: "base64url-kodad sträng",\n json_string: "JSON-sträng",\n e164: "E.164-nummer",\n jwt: "JWT",\n template_literal: "mall-literal"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Ogiltig inmatning: förväntat ${issue2.expected}, fick ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Ogiltig inmatning: förväntat ${stringifyPrimitive(issue2.values[0])}`;\n return `Ogiltigt val: förväntade en av ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `För stor(t): förväntade ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`;\n }\n return `För stor(t): förväntat ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `För lite(t): förväntade ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `För lite(t): förväntade ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `Ogiltig sträng: måste börja med "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `Ogiltig sträng: måste sluta med "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Ogiltig sträng: måste innehålla "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Ogiltig sträng: måste matcha mönstret "${_issue.pattern}"`;\n return `Ogiltig(t) ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Ogiltigt tal: måste vara en multipel av ${issue2.divisor}`;\n case "unrecognized_keys":\n return `${issue2.keys.length > 1 ? "Okända nycklar" : "Okänd nyckel"}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Ogiltig nyckel i ${issue2.origin ?? "värdet"}`;\n case "invalid_union":\n return "Ogiltig input";\n case "invalid_element":\n return `Ogiltigt värde i ${issue2.origin ?? "värdet"}`;\n default:\n return `Ogiltig input`;\n }\n };\n};\nfunction sv_default() {\n return {\n localeError: error29()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ta.js\nvar error30 = () => {\n const Sizable = {\n string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" },\n file: { unit: "பைட்டுகள்", verb: "கொண்டிருக்க வேண்டும்" },\n array: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },\n set: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "எண் அல்லாதது" : "எண்";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "அணி";\n }\n if (data === null) {\n return "வெறுமை";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "உள்ளீடு",\n email: "மின்னஞ்சல் முகவரி",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO தேதி நேரம்",\n date: "ISO தேதி",\n time: "ISO நேரம்",\n duration: "ISO கால அளவு",\n ipv4: "IPv4 முகவரி",\n ipv6: "IPv6 முகவரி",\n cidrv4: "IPv4 வரம்பு",\n cidrv6: "IPv6 வரம்பு",\n base64: "base64-encoded சரம்",\n base64url: "base64url-encoded சரம்",\n json_string: "JSON சரம்",\n e164: "E.164 எண்",\n jwt: "JWT",\n template_literal: "input"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${issue2.expected}, பெறப்பட்டது ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${stringifyPrimitive(issue2.values[0])}`;\n return `தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${joinValues(issue2.values, "|")} இல் ஒன்று`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue2.origin ?? "மதிப்பு"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "உறுப்புகள்"} ஆக இருக்க வேண்டும்`;\n }\n return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue2.origin ?? "மதிப்பு"} ${adj}${issue2.maximum.toString()} ஆக இருக்க வேண்டும்`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ஆக இருக்க வேண்டும்`;\n }\n return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue2.origin} ${adj}${issue2.minimum.toString()} ஆக இருக்க வேண்டும்`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `தவறான சரம்: "${_issue.prefix}" இல் தொடங்க வேண்டும்`;\n if (_issue.format === "ends_with")\n return `தவறான சரம்: "${_issue.suffix}" இல் முடிவடைய வேண்டும்`;\n if (_issue.format === "includes")\n return `தவறான சரம்: "${_issue.includes}" ஐ உள்ளடக்க வேண்டும்`;\n if (_issue.format === "regex")\n return `தவறான சரம்: ${_issue.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;\n return `தவறான ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `தவறான எண்: ${issue2.divisor} இன் பலமாக இருக்க வேண்டும்`;\n case "unrecognized_keys":\n return `அடையாளம் தெரியாத விசை${issue2.keys.length > 1 ? "கள்" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `${issue2.origin} இல் தவறான விசை`;\n case "invalid_union":\n return "தவறான உள்ளீடு";\n case "invalid_element":\n return `${issue2.origin} இல் தவறான மதிப்பு`;\n default:\n return `தவறான உள்ளீடு`;\n }\n };\n};\nfunction ta_default() {\n return {\n localeError: error30()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/th.js\nvar error31 = () => {\n const Sizable = {\n string: { unit: "ตัวอักษร", verb: "ควรมี" },\n file: { unit: "ไบต์", verb: "ควรมี" },\n array: { unit: "รายการ", verb: "ควรมี" },\n set: { unit: "รายการ", verb: "ควรมี" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "ไม่ใช่ตัวเลข (NaN)" : "ตัวเลข";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "อาร์เรย์ (Array)";\n }\n if (data === null) {\n return "ไม่มีค่า (null)";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "ข้อมูลที่ป้อน",\n email: "ที่อยู่อีเมล",\n url: "URL",\n emoji: "อิโมจิ",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "วันที่เวลาแบบ ISO",\n date: "วันที่แบบ ISO",\n time: "เวลาแบบ ISO",\n duration: "ช่วงเวลาแบบ ISO",\n ipv4: "ที่อยู่ IPv4",\n ipv6: "ที่อยู่ IPv6",\n cidrv4: "ช่วง IP แบบ IPv4",\n cidrv6: "ช่วง IP แบบ IPv6",\n base64: "ข้อความแบบ Base64",\n base64url: "ข้อความแบบ Base64 สำหรับ URL",\n json_string: "ข้อความแบบ JSON",\n e164: "เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",\n jwt: "โทเคน JWT",\n template_literal: "ข้อมูลที่ป้อน"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${issue2.expected} แต่ได้รับ ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `ค่าไม่ถูกต้อง: ควรเป็น ${stringifyPrimitive(issue2.values[0])}`;\n return `ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "ไม่เกิน" : "น้อยกว่า";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `เกินกำหนด: ${issue2.origin ?? "ค่า"} ควรมี${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "รายการ"}`;\n return `เกินกำหนด: ${issue2.origin ?? "ค่า"} ควรมี${adj} ${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? "อย่างน้อย" : "มากกว่า";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `น้อยกว่ากำหนด: ${issue2.origin} ควรมี${adj} ${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `น้อยกว่ากำหนด: ${issue2.origin} ควรมี${adj} ${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${_issue.prefix}"`;\n }\n if (_issue.format === "ends_with")\n return `รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${_issue.includes}" อยู่ในข้อความ`;\n if (_issue.format === "regex")\n return `รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${_issue.pattern}`;\n return `รูปแบบไม่ถูกต้อง: ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${issue2.divisor} ได้ลงตัว`;\n case "unrecognized_keys":\n return `พบคีย์ที่ไม่รู้จัก: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `คีย์ไม่ถูกต้องใน ${issue2.origin}`;\n case "invalid_union":\n return "ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";\n case "invalid_element":\n return `ข้อมูลไม่ถูกต้องใน ${issue2.origin}`;\n default:\n return `ข้อมูลไม่ถูกต้อง`;\n }\n };\n};\nfunction th_default() {\n return {\n localeError: error31()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/tr.js\nvar parsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n};\nvar error32 = () => {\n const Sizable = {\n string: { unit: "karakter", verb: "olmalı" },\n file: { unit: "bayt", verb: "olmalı" },\n array: { unit: "öğe", verb: "olmalı" },\n set: { unit: "öğe", verb: "olmalı" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const Nouns = {\n regex: "girdi",\n email: "e-posta adresi",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO tarih ve saat",\n date: "ISO tarih",\n time: "ISO saat",\n duration: "ISO süre",\n ipv4: "IPv4 adresi",\n ipv6: "IPv6 adresi",\n cidrv4: "IPv4 aralığı",\n cidrv6: "IPv6 aralığı",\n base64: "base64 ile şifrelenmiş metin",\n base64url: "base64url ile şifrelenmiş metin",\n json_string: "JSON dizesi",\n e164: "E.164 sayısı",\n jwt: "JWT",\n template_literal: "Şablon dizesi"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Geçersiz değer: beklenen ${issue2.expected}, alınan ${parsedType2(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Geçersiz değer: beklenen ${stringifyPrimitive(issue2.values[0])}`;\n return `Geçersiz seçenek: aşağıdakilerden biri olmalı: ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Çok büyük: beklenen ${issue2.origin ?? "değer"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "öğe"}`;\n return `Çok büyük: beklenen ${issue2.origin ?? "değer"} ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Çok küçük: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n return `Çok küçük: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Geçersiz metin: "${_issue.prefix}" ile başlamalı`;\n if (_issue.format === "ends_with")\n return `Geçersiz metin: "${_issue.suffix}" ile bitmeli`;\n if (_issue.format === "includes")\n return `Geçersiz metin: "${_issue.includes}" içermeli`;\n if (_issue.format === "regex")\n return `Geçersiz metin: ${_issue.pattern} desenine uymalı`;\n return `Geçersiz ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Geçersiz sayı: ${issue2.divisor} ile tam bölünebilmeli`;\n case "unrecognized_keys":\n return `Tanınmayan anahtar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `${issue2.origin} içinde geçersiz anahtar`;\n case "invalid_union":\n return "Geçersiz değer";\n case "invalid_element":\n return `${issue2.origin} içinde geçersiz değer`;\n default:\n return `Geçersiz değer`;\n }\n };\n};\nfunction tr_default() {\n return {\n localeError: error32()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ua.js\nvar error33 = () => {\n const Sizable = {\n string: { unit: "символів", verb: "матиме" },\n file: { unit: "байтів", verb: "матиме" },\n array: { unit: "елементів", verb: "матиме" },\n set: { unit: "елементів", verb: "матиме" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType3 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "число";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "масив";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "вхідні дані",\n email: "адреса електронної пошти",\n url: "URL",\n emoji: "емодзі",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "дата та час ISO",\n date: "дата ISO",\n time: "час ISO",\n duration: "тривалість ISO",\n ipv4: "адреса IPv4",\n ipv6: "адреса IPv6",\n cidrv4: "діапазон IPv4",\n cidrv6: "діапазон IPv6",\n base64: "рядок у кодуванні base64",\n base64url: "рядок у кодуванні base64url",\n json_string: "рядок JSON",\n e164: "номер E.164",\n jwt: "JWT",\n template_literal: "вхідні дані"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Неправильні вхідні дані: очікується ${issue2.expected}, отримано ${parsedType3(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Неправильні вхідні дані: очікується ${stringifyPrimitive(issue2.values[0])}`;\n return `Неправильна опція: очікується одне з ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Занадто велике: очікується, що ${issue2.origin ?? "значення"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "елементів"}`;\n return `Занадто велике: очікується, що ${issue2.origin ?? "значення"} буде ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Занадто мале: очікується, що ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Занадто мале: очікується, що ${issue2.origin} буде ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Неправильний рядок: повинен починатися з "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Неправильний рядок: повинен закінчуватися на "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Неправильний рядок: повинен містити "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Неправильний рядок: повинен відповідати шаблону ${_issue.pattern}`;\n return `Неправильний ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `Неправильне число: повинно бути кратним ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Нерозпізнаний ключ${issue2.keys.length > 1 ? "і" : ""}: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Неправильний ключ у ${issue2.origin}`;\n case "invalid_union":\n return "Неправильні вхідні дані";\n case "invalid_element":\n return `Неправильне значення у ${issue2.origin}`;\n default:\n return `Неправильні вхідні дані`;\n }\n };\n};\nfunction ua_default() {\n return {\n localeError: error33()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/ur.js\nvar error34 = () => {\n const Sizable = {\n string: { unit: "حروف", verb: "ہونا" },\n file: { unit: "بائٹس", verb: "ہونا" },\n array: { unit: "آئٹمز", verb: "ہونا" },\n set: { unit: "آئٹمز", verb: "ہونا" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType3 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "نمبر";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "آرے";\n }\n if (data === null) {\n return "نل";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "ان پٹ",\n email: "ای میل ایڈریس",\n url: "یو آر ایل",\n emoji: "ایموجی",\n uuid: "یو یو آئی ڈی",\n uuidv4: "یو یو آئی ڈی وی 4",\n uuidv6: "یو یو آئی ڈی وی 6",\n nanoid: "نینو آئی ڈی",\n guid: "جی یو آئی ڈی",\n cuid: "سی یو آئی ڈی",\n cuid2: "سی یو آئی ڈی 2",\n ulid: "یو ایل آئی ڈی",\n xid: "ایکس آئی ڈی",\n ksuid: "کے ایس یو آئی ڈی",\n datetime: "آئی ایس او ڈیٹ ٹائم",\n date: "آئی ایس او تاریخ",\n time: "آئی ایس او وقت",\n duration: "آئی ایس او مدت",\n ipv4: "آئی پی وی 4 ایڈریس",\n ipv6: "آئی پی وی 6 ایڈریس",\n cidrv4: "آئی پی وی 4 رینج",\n cidrv6: "آئی پی وی 6 رینج",\n base64: "بیس 64 ان کوڈڈ سٹرنگ",\n base64url: "بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",\n json_string: "جے ایس او این سٹرنگ",\n e164: "ای 164 نمبر",\n jwt: "جے ڈبلیو ٹی",\n template_literal: "ان پٹ"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `غلط ان پٹ: ${issue2.expected} متوقع تھا، ${parsedType3(issue2.input)} موصول ہوا`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `غلط ان پٹ: ${stringifyPrimitive(issue2.values[0])} متوقع تھا`;\n return `غلط آپشن: ${joinValues(issue2.values, "|")} میں سے ایک متوقع تھا`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `بہت بڑا: ${issue2.origin ?? "ویلیو"} کے ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "عناصر"} ہونے متوقع تھے`;\n return `بہت بڑا: ${issue2.origin ?? "ویلیو"} کا ${adj}${issue2.maximum.toString()} ہونا متوقع تھا`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `بہت چھوٹا: ${issue2.origin} کے ${adj}${issue2.minimum.toString()} ${sizing.unit} ہونے متوقع تھے`;\n }\n return `بہت چھوٹا: ${issue2.origin} کا ${adj}${issue2.minimum.toString()} ہونا متوقع تھا`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `غلط سٹرنگ: "${_issue.prefix}" سے شروع ہونا چاہیے`;\n }\n if (_issue.format === "ends_with")\n return `غلط سٹرنگ: "${_issue.suffix}" پر ختم ہونا چاہیے`;\n if (_issue.format === "includes")\n return `غلط سٹرنگ: "${_issue.includes}" شامل ہونا چاہیے`;\n if (_issue.format === "regex")\n return `غلط سٹرنگ: پیٹرن ${_issue.pattern} سے میچ ہونا چاہیے`;\n return `غلط ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `غلط نمبر: ${issue2.divisor} کا مضاعف ہونا چاہیے`;\n case "unrecognized_keys":\n return `غیر تسلیم شدہ کی${issue2.keys.length > 1 ? "ز" : ""}: ${joinValues(issue2.keys, "، ")}`;\n case "invalid_key":\n return `${issue2.origin} میں غلط کی`;\n case "invalid_union":\n return "غلط ان پٹ";\n case "invalid_element":\n return `${issue2.origin} میں غلط ویلیو`;\n default:\n return `غلط ان پٹ`;\n }\n };\n};\nfunction ur_default() {\n return {\n localeError: error34()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/vi.js\nvar error35 = () => {\n const Sizable = {\n string: { unit: "ký tự", verb: "có" },\n file: { unit: "byte", verb: "có" },\n array: { unit: "phần tử", verb: "có" },\n set: { unit: "phần tử", verb: "có" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType3 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "số";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "mảng";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "đầu vào",\n email: "địa chỉ email",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ngày giờ ISO",\n date: "ngày ISO",\n time: "giờ ISO",\n duration: "khoảng thời gian ISO",\n ipv4: "địa chỉ IPv4",\n ipv6: "địa chỉ IPv6",\n cidrv4: "dải IPv4",\n cidrv6: "dải IPv6",\n base64: "chuỗi mã hóa base64",\n base64url: "chuỗi mã hóa base64url",\n json_string: "chuỗi JSON",\n e164: "số E.164",\n jwt: "JWT",\n template_literal: "đầu vào"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `Đầu vào không hợp lệ: mong đợi ${issue2.expected}, nhận được ${parsedType3(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `Đầu vào không hợp lệ: mong đợi ${stringifyPrimitive(issue2.values[0])}`;\n return `Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `Quá lớn: mong đợi ${issue2.origin ?? "giá trị"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "phần tử"}`;\n return `Quá lớn: mong đợi ${issue2.origin ?? "giá trị"} ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `Quá nhỏ: mong đợi ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `Quá nhỏ: mong đợi ${issue2.origin} ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `Chuỗi không hợp lệ: phải bắt đầu bằng "${_issue.prefix}"`;\n if (_issue.format === "ends_with")\n return `Chuỗi không hợp lệ: phải kết thúc bằng "${_issue.suffix}"`;\n if (_issue.format === "includes")\n return `Chuỗi không hợp lệ: phải bao gồm "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `Chuỗi không hợp lệ: phải khớp với mẫu ${_issue.pattern}`;\n return `${Nouns[_issue.format] ?? issue2.format} không hợp lệ`;\n }\n case "not_multiple_of":\n return `Số không hợp lệ: phải là bội số của ${issue2.divisor}`;\n case "unrecognized_keys":\n return `Khóa không được nhận dạng: ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `Khóa không hợp lệ trong ${issue2.origin}`;\n case "invalid_union":\n return "Đầu vào không hợp lệ";\n case "invalid_element":\n return `Giá trị không hợp lệ trong ${issue2.origin}`;\n default:\n return `Đầu vào không hợp lệ`;\n }\n };\n};\nfunction vi_default() {\n return {\n localeError: error35()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/zh-CN.js\nvar error36 = () => {\n const Sizable = {\n string: { unit: "字符", verb: "包含" },\n file: { unit: "字节", verb: "包含" },\n array: { unit: "项", verb: "包含" },\n set: { unit: "项", verb: "包含" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType3 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "非数字(NaN)" : "数字";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "数组";\n }\n if (data === null) {\n return "空值(null)";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "输入",\n email: "电子邮件",\n url: "URL",\n emoji: "表情符号",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO日期时间",\n date: "ISO日期",\n time: "ISO时间",\n duration: "ISO时长",\n ipv4: "IPv4地址",\n ipv6: "IPv6地址",\n cidrv4: "IPv4网段",\n cidrv6: "IPv6网段",\n base64: "base64编码字符串",\n base64url: "base64url编码字符串",\n json_string: "JSON字符串",\n e164: "E.164号码",\n jwt: "JWT",\n template_literal: "输入"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `无效输入:期望 ${issue2.expected},实际接收 ${parsedType3(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `无效输入:期望 ${stringifyPrimitive(issue2.values[0])}`;\n return `无效选项:期望以下之一 ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `数值过大:期望 ${issue2.origin ?? "值"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "个元素"}`;\n return `数值过大:期望 ${issue2.origin ?? "值"} ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `数值过小:期望 ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `数值过小:期望 ${issue2.origin} ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with")\n return `无效字符串:必须以 "${_issue.prefix}" 开头`;\n if (_issue.format === "ends_with")\n return `无效字符串:必须以 "${_issue.suffix}" 结尾`;\n if (_issue.format === "includes")\n return `无效字符串:必须包含 "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;\n return `无效${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `无效数字:必须是 ${issue2.divisor} 的倍数`;\n case "unrecognized_keys":\n return `出现未知的键(key): ${joinValues(issue2.keys, ", ")}`;\n case "invalid_key":\n return `${issue2.origin} 中的键(key)无效`;\n case "invalid_union":\n return "无效输入";\n case "invalid_element":\n return `${issue2.origin} 中包含无效值(value)`;\n default:\n return `无效输入`;\n }\n };\n};\nfunction zh_CN_default() {\n return {\n localeError: error36()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/locales/zh-TW.js\nvar error37 = () => {\n const Sizable = {\n string: { unit: "字元", verb: "擁有" },\n file: { unit: "位元組", verb: "擁有" },\n array: { unit: "項目", verb: "擁有" },\n set: { unit: "項目", verb: "擁有" }\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const parsedType3 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "number": {\n return Number.isNaN(data) ? "NaN" : "number";\n }\n case "object": {\n if (Array.isArray(data)) {\n return "array";\n }\n if (data === null) {\n return "null";\n }\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t2;\n };\n const Nouns = {\n regex: "輸入",\n email: "郵件地址",\n url: "URL",\n emoji: "emoji",\n uuid: "UUID",\n uuidv4: "UUIDv4",\n uuidv6: "UUIDv6",\n nanoid: "nanoid",\n guid: "GUID",\n cuid: "cuid",\n cuid2: "cuid2",\n ulid: "ULID",\n xid: "XID",\n ksuid: "KSUID",\n datetime: "ISO 日期時間",\n date: "ISO 日期",\n time: "ISO 時間",\n duration: "ISO 期間",\n ipv4: "IPv4 位址",\n ipv6: "IPv6 位址",\n cidrv4: "IPv4 範圍",\n cidrv6: "IPv6 範圍",\n base64: "base64 編碼字串",\n base64url: "base64url 編碼字串",\n json_string: "JSON 字串",\n e164: "E.164 數值",\n jwt: "JWT",\n template_literal: "輸入"\n };\n return (issue2) => {\n switch (issue2.code) {\n case "invalid_type":\n return `無效的輸入值:預期為 ${issue2.expected},但收到 ${parsedType3(issue2.input)}`;\n case "invalid_value":\n if (issue2.values.length === 1)\n return `無效的輸入值:預期為 ${stringifyPrimitive(issue2.values[0])}`;\n return `無效的選項:預期為以下其中之一 ${joinValues(issue2.values, "|")}`;\n case "too_big": {\n const adj = issue2.inclusive ? "<=" : "<";\n const sizing = getSizing(issue2.origin);\n if (sizing)\n return `數值過大:預期 ${issue2.origin ?? "值"} 應為 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "個元素"}`;\n return `數值過大:預期 ${issue2.origin ?? "值"} 應為 ${adj}${issue2.maximum.toString()}`;\n }\n case "too_small": {\n const adj = issue2.inclusive ? ">=" : ">";\n const sizing = getSizing(issue2.origin);\n if (sizing) {\n return `數值過小:預期 ${issue2.origin} 應為 ${adj}${issue2.minimum.toString()} ${sizing.unit}`;\n }\n return `數值過小:預期 ${issue2.origin} 應為 ${adj}${issue2.minimum.toString()}`;\n }\n case "invalid_format": {\n const _issue = issue2;\n if (_issue.format === "starts_with") {\n return `無效的字串:必須以 "${_issue.prefix}" 開頭`;\n }\n if (_issue.format === "ends_with")\n return `無效的字串:必須以 "${_issue.suffix}" 結尾`;\n if (_issue.format === "includes")\n return `無效的字串:必須包含 "${_issue.includes}"`;\n if (_issue.format === "regex")\n return `無效的字串:必須符合格式 ${_issue.pattern}`;\n return `無效的 ${Nouns[_issue.format] ?? issue2.format}`;\n }\n case "not_multiple_of":\n return `無效的數字:必須為 ${issue2.divisor} 的倍數`;\n case "unrecognized_keys":\n return `無法識別的鍵值${issue2.keys.length > 1 ? "們" : ""}:${joinValues(issue2.keys, "、")}`;\n case "invalid_key":\n return `${issue2.origin} 中有無效的鍵值`;\n case "invalid_union":\n return "無效的輸入值";\n case "invalid_element":\n return `${issue2.origin} 中有無效的值`;\n default:\n return `無效的輸入值`;\n }\n };\n};\nfunction zh_TW_default() {\n return {\n localeError: error37()\n };\n}\n// ../../node_modules/zod/dist/esm/v4/core/registries.js\nvar $output = Symbol("ZodOutput");\nvar $input = Symbol("ZodInput");\n\nclass $ZodRegistry {\n constructor() {\n this._map = new WeakMap;\n this._idmap = new Map;\n }\n add(schema, ..._meta) {\n const meta = _meta[0];\n this._map.set(schema, meta);\n if (meta && typeof meta === "object" && "id" in meta) {\n if (this._idmap.has(meta.id)) {\n throw new Error(`ID ${meta.id} already exists in the registry`);\n }\n this._idmap.set(meta.id, schema);\n }\n return this;\n }\n remove(schema) {\n this._map.delete(schema);\n return this;\n }\n get(schema) {\n const p3 = schema._zod.parent;\n if (p3) {\n const pm = { ...this.get(p3) ?? {} };\n delete pm.id;\n return { ...pm, ...this._map.get(schema) };\n }\n return this._map.get(schema);\n }\n has(schema) {\n return this._map.has(schema);\n }\n}\nfunction registry() {\n return new $ZodRegistry;\n}\nvar globalRegistry = /* @__PURE__ */ registry();\n// ../../node_modules/zod/dist/esm/v4/core/api.js\nfunction _string(Class2, params) {\n return new Class2({\n type: "string",\n ...normalizeParams(params)\n });\n}\nfunction _coercedString(Class2, params) {\n return new Class2({\n type: "string",\n coerce: true,\n ...normalizeParams(params)\n });\n}\nfunction _email(Class2, params) {\n return new Class2({\n type: "string",\n format: "email",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _guid(Class2, params) {\n return new Class2({\n type: "string",\n format: "guid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _uuid(Class2, params) {\n return new Class2({\n type: "string",\n format: "uuid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _uuidv4(Class2, params) {\n return new Class2({\n type: "string",\n format: "uuid",\n check: "string_format",\n abort: false,\n version: "v4",\n ...normalizeParams(params)\n });\n}\nfunction _uuidv6(Class2, params) {\n return new Class2({\n type: "string",\n format: "uuid",\n check: "string_format",\n abort: false,\n version: "v6",\n ...normalizeParams(params)\n });\n}\nfunction _uuidv7(Class2, params) {\n return new Class2({\n type: "string",\n format: "uuid",\n check: "string_format",\n abort: false,\n version: "v7",\n ...normalizeParams(params)\n });\n}\nfunction _url(Class2, params) {\n return new Class2({\n type: "string",\n format: "url",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _emoji2(Class2, params) {\n return new Class2({\n type: "string",\n format: "emoji",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _nanoid(Class2, params) {\n return new Class2({\n type: "string",\n format: "nanoid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _cuid(Class2, params) {\n return new Class2({\n type: "string",\n format: "cuid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _cuid2(Class2, params) {\n return new Class2({\n type: "string",\n format: "cuid2",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _ulid(Class2, params) {\n return new Class2({\n type: "string",\n format: "ulid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _xid(Class2, params) {\n return new Class2({\n type: "string",\n format: "xid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _ksuid(Class2, params) {\n return new Class2({\n type: "string",\n format: "ksuid",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _ipv4(Class2, params) {\n return new Class2({\n type: "string",\n format: "ipv4",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _ipv6(Class2, params) {\n return new Class2({\n type: "string",\n format: "ipv6",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _cidrv4(Class2, params) {\n return new Class2({\n type: "string",\n format: "cidrv4",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _cidrv6(Class2, params) {\n return new Class2({\n type: "string",\n format: "cidrv6",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _base64(Class2, params) {\n return new Class2({\n type: "string",\n format: "base64",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _base64url(Class2, params) {\n return new Class2({\n type: "string",\n format: "base64url",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _e164(Class2, params) {\n return new Class2({\n type: "string",\n format: "e164",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _jwt(Class2, params) {\n return new Class2({\n type: "string",\n format: "jwt",\n check: "string_format",\n abort: false,\n ...normalizeParams(params)\n });\n}\nfunction _isoDateTime(Class2, params) {\n return new Class2({\n type: "string",\n format: "datetime",\n check: "string_format",\n offset: false,\n local: false,\n precision: null,\n ...normalizeParams(params)\n });\n}\nfunction _isoDate(Class2, params) {\n return new Class2({\n type: "string",\n format: "date",\n check: "string_format",\n ...normalizeParams(params)\n });\n}\nfunction _isoTime(Class2, params) {\n return new Class2({\n type: "string",\n format: "time",\n check: "string_format",\n precision: null,\n ...normalizeParams(params)\n });\n}\nfunction _isoDuration(Class2, params) {\n return new Class2({\n type: "string",\n format: "duration",\n check: "string_format",\n ...normalizeParams(params)\n });\n}\nfunction _number(Class2, params) {\n return new Class2({\n type: "number",\n checks: [],\n ...normalizeParams(params)\n });\n}\nfunction _coercedNumber(Class2, params) {\n return new Class2({\n type: "number",\n coerce: true,\n checks: [],\n ...normalizeParams(params)\n });\n}\nfunction _int(Class2, params) {\n return new Class2({\n type: "number",\n check: "number_format",\n abort: false,\n format: "safeint",\n ...normalizeParams(params)\n });\n}\nfunction _float32(Class2, params) {\n return new Class2({\n type: "number",\n check: "number_format",\n abort: false,\n format: "float32",\n ...normalizeParams(params)\n });\n}\nfunction _float64(Class2, params) {\n return new Class2({\n type: "number",\n check: "number_format",\n abort: false,\n format: "float64",\n ...normalizeParams(params)\n });\n}\nfunction _int32(Class2, params) {\n return new Class2({\n type: "number",\n check: "number_format",\n abort: false,\n format: "int32",\n ...normalizeParams(params)\n });\n}\nfunction _uint32(Class2, params) {\n return new Class2({\n type: "number",\n check: "number_format",\n abort: false,\n format: "uint32",\n ...normalizeParams(params)\n });\n}\nfunction _boolean(Class2, params) {\n return new Class2({\n type: "boolean",\n ...normalizeParams(params)\n });\n}\nfunction _coercedBoolean(Class2, params) {\n return new Class2({\n type: "boolean",\n coerce: true,\n ...normalizeParams(params)\n });\n}\nfunction _bigint(Class2, params) {\n return new Class2({\n type: "bigint",\n ...normalizeParams(params)\n });\n}\nfunction _coercedBigint(Class2, params) {\n return new Class2({\n type: "bigint",\n coerce: true,\n ...normalizeParams(params)\n });\n}\nfunction _int64(Class2, params) {\n return new Class2({\n type: "bigint",\n check: "bigint_format",\n abort: false,\n format: "int64",\n ...normalizeParams(params)\n });\n}\nfunction _uint64(Class2, params) {\n return new Class2({\n type: "bigint",\n check: "bigint_format",\n abort: false,\n format: "uint64",\n ...normalizeParams(params)\n });\n}\nfunction _symbol(Class2, params) {\n return new Class2({\n type: "symbol",\n ...normalizeParams(params)\n });\n}\nfunction _undefined2(Class2, params) {\n return new Class2({\n type: "undefined",\n ...normalizeParams(params)\n });\n}\nfunction _null2(Class2, params) {\n return new Class2({\n type: "null",\n ...normalizeParams(params)\n });\n}\nfunction _any(Class2) {\n return new Class2({\n type: "any"\n });\n}\nfunction _unknown(Class2) {\n return new Class2({\n type: "unknown"\n });\n}\nfunction _never(Class2, params) {\n return new Class2({\n type: "never",\n ...normalizeParams(params)\n });\n}\nfunction _void(Class2, params) {\n return new Class2({\n type: "void",\n ...normalizeParams(params)\n });\n}\nfunction _date(Class2, params) {\n return new Class2({\n type: "date",\n ...normalizeParams(params)\n });\n}\nfunction _coercedDate(Class2, params) {\n return new Class2({\n type: "date",\n coerce: true,\n ...normalizeParams(params)\n });\n}\nfunction _nan(Class2, params) {\n return new Class2({\n type: "nan",\n ...normalizeParams(params)\n });\n}\nfunction _lt(value, params) {\n return new $ZodCheckLessThan({\n check: "less_than",\n ...normalizeParams(params),\n value,\n inclusive: false\n });\n}\nfunction _lte(value, params) {\n return new $ZodCheckLessThan({\n check: "less_than",\n ...normalizeParams(params),\n value,\n inclusive: true\n });\n}\nfunction _gt(value, params) {\n return new $ZodCheckGreaterThan({\n check: "greater_than",\n ...normalizeParams(params),\n value,\n inclusive: false\n });\n}\nfunction _gte(value, params) {\n return new $ZodCheckGreaterThan({\n check: "greater_than",\n ...normalizeParams(params),\n value,\n inclusive: true\n });\n}\nfunction _positive(params) {\n return _gt(0, params);\n}\nfunction _negative(params) {\n return _lt(0, params);\n}\nfunction _nonpositive(params) {\n return _lte(0, params);\n}\nfunction _nonnegative(params) {\n return _gte(0, params);\n}\nfunction _multipleOf(value, params) {\n return new $ZodCheckMultipleOf({\n check: "multiple_of",\n ...normalizeParams(params),\n value\n });\n}\nfunction _maxSize(maximum, params) {\n return new $ZodCheckMaxSize({\n check: "max_size",\n ...normalizeParams(params),\n maximum\n });\n}\nfunction _minSize(minimum, params) {\n return new $ZodCheckMinSize({\n check: "min_size",\n ...normalizeParams(params),\n minimum\n });\n}\nfunction _size(size, params) {\n return new $ZodCheckSizeEquals({\n check: "size_equals",\n ...normalizeParams(params),\n size\n });\n}\nfunction _maxLength(maximum, params) {\n const ch = new $ZodCheckMaxLength({\n check: "max_length",\n ...normalizeParams(params),\n maximum\n });\n return ch;\n}\nfunction _minLength(minimum, params) {\n return new $ZodCheckMinLength({\n check: "min_length",\n ...normalizeParams(params),\n minimum\n });\n}\nfunction _length(length, params) {\n return new $ZodCheckLengthEquals({\n check: "length_equals",\n ...normalizeParams(params),\n length\n });\n}\nfunction _regex(pattern, params) {\n return new $ZodCheckRegex({\n check: "string_format",\n format: "regex",\n ...normalizeParams(params),\n pattern\n });\n}\nfunction _lowercase(params) {\n return new $ZodCheckLowerCase({\n check: "string_format",\n format: "lowercase",\n ...normalizeParams(params)\n });\n}\nfunction _uppercase(params) {\n return new $ZodCheckUpperCase({\n check: "string_format",\n format: "uppercase",\n ...normalizeParams(params)\n });\n}\nfunction _includes(includes, params) {\n return new $ZodCheckIncludes({\n check: "string_format",\n format: "includes",\n ...normalizeParams(params),\n includes\n });\n}\nfunction _startsWith(prefix, params) {\n return new $ZodCheckStartsWith({\n check: "string_format",\n format: "starts_with",\n ...normalizeParams(params),\n prefix\n });\n}\nfunction _endsWith(suffix, params) {\n return new $ZodCheckEndsWith({\n check: "string_format",\n format: "ends_with",\n ...normalizeParams(params),\n suffix\n });\n}\nfunction _property(property, schema, params) {\n return new $ZodCheckProperty({\n check: "property",\n property,\n schema,\n ...normalizeParams(params)\n });\n}\nfunction _mime(types, params) {\n return new $ZodCheckMimeType({\n check: "mime_type",\n mime: types,\n ...normalizeParams(params)\n });\n}\nfunction _overwrite(tx) {\n return new $ZodCheckOverwrite({\n check: "overwrite",\n tx\n });\n}\nfunction _normalize(form) {\n return _overwrite((input) => input.normalize(form));\n}\nfunction _trim() {\n return _overwrite((input) => input.trim());\n}\nfunction _toLowerCase() {\n return _overwrite((input) => input.toLowerCase());\n}\nfunction _toUpperCase() {\n return _overwrite((input) => input.toUpperCase());\n}\nfunction _array(Class2, element, params) {\n return new Class2({\n type: "array",\n element,\n ...normalizeParams(params)\n });\n}\nfunction _union(Class2, options, params) {\n return new Class2({\n type: "union",\n options,\n ...normalizeParams(params)\n });\n}\nfunction _discriminatedUnion(Class2, discriminator, options, params) {\n return new Class2({\n type: "union",\n options,\n discriminator,\n ...normalizeParams(params)\n });\n}\nfunction _intersection(Class2, left, right) {\n return new Class2({\n type: "intersection",\n left,\n right\n });\n}\nfunction _tuple(Class2, items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof $ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new Class2({\n type: "tuple",\n items,\n rest,\n ...normalizeParams(params)\n });\n}\nfunction _record(Class2, keyType, valueType, params) {\n return new Class2({\n type: "record",\n keyType,\n valueType,\n ...normalizeParams(params)\n });\n}\nfunction _map(Class2, keyType, valueType, params) {\n return new Class2({\n type: "map",\n keyType,\n valueType,\n ...normalizeParams(params)\n });\n}\nfunction _set(Class2, valueType, params) {\n return new Class2({\n type: "set",\n valueType,\n ...normalizeParams(params)\n });\n}\nfunction _enum(Class2, values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v3) => [v3, v3])) : values;\n return new Class2({\n type: "enum",\n entries,\n ...normalizeParams(params)\n });\n}\nfunction _nativeEnum(Class2, entries, params) {\n return new Class2({\n type: "enum",\n entries,\n ...normalizeParams(params)\n });\n}\nfunction _literal(Class2, value, params) {\n return new Class2({\n type: "literal",\n values: Array.isArray(value) ? value : [value],\n ...normalizeParams(params)\n });\n}\nfunction _file(Class2, params) {\n return new Class2({\n type: "file",\n ...normalizeParams(params)\n });\n}\nfunction _transform(Class2, fn) {\n return new Class2({\n type: "transform",\n transform: fn\n });\n}\nfunction _optional(Class2, innerType) {\n return new Class2({\n type: "optional",\n innerType\n });\n}\nfunction _nullable(Class2, innerType) {\n return new Class2({\n type: "nullable",\n innerType\n });\n}\nfunction _default(Class2, innerType, defaultValue) {\n return new Class2({\n type: "default",\n innerType,\n get defaultValue() {\n return typeof defaultValue === "function" ? defaultValue() : defaultValue;\n }\n });\n}\nfunction _nonoptional(Class2, innerType, params) {\n return new Class2({\n type: "nonoptional",\n innerType,\n ...normalizeParams(params)\n });\n}\nfunction _success(Class2, innerType) {\n return new Class2({\n type: "success",\n innerType\n });\n}\nfunction _catch(Class2, innerType, catchValue) {\n return new Class2({\n type: "catch",\n innerType,\n catchValue: typeof catchValue === "function" ? catchValue : () => catchValue\n });\n}\nfunction _pipe(Class2, in_, out) {\n return new Class2({\n type: "pipe",\n in: in_,\n out\n });\n}\nfunction _readonly(Class2, innerType) {\n return new Class2({\n type: "readonly",\n innerType\n });\n}\nfunction _templateLiteral(Class2, parts, params) {\n return new Class2({\n type: "template_literal",\n parts,\n ...normalizeParams(params)\n });\n}\nfunction _lazy(Class2, getter) {\n return new Class2({\n type: "lazy",\n getter\n });\n}\nfunction _promise(Class2, innerType) {\n return new Class2({\n type: "promise",\n innerType\n });\n}\nfunction _custom(Class2, fn, _params) {\n const norm = normalizeParams(_params);\n norm.abort ?? (norm.abort = true);\n const schema = new Class2({\n type: "custom",\n check: "custom",\n fn,\n ...norm\n });\n return schema;\n}\nfunction _refine(Class2, fn, _params) {\n const schema = new Class2({\n type: "custom",\n check: "custom",\n fn,\n ...normalizeParams(_params)\n });\n return schema;\n}\nfunction _stringbool(Classes, _params) {\n const { case: _case, error: error38, truthy, falsy } = normalizeParams(_params);\n const trueValues = new Set(truthy ?? ["true", "1", "yes", "on", "y", "enabled"]);\n const falseValues = new Set(falsy ?? ["false", "0", "no", "off", "n", "disabled"]);\n const _Pipe = Classes.Pipe ?? $ZodPipe;\n const _Boolean = Classes.Boolean ?? $ZodBoolean;\n const _Unknown = Classes.Unknown ?? $ZodUnknown;\n const inst = new _Unknown({\n type: "unknown",\n checks: [\n {\n _zod: {\n check: (ctx) => {\n if (typeof ctx.value === "string") {\n let data = ctx.value;\n if (_case !== "sensitive")\n data = data.toLowerCase();\n if (trueValues.has(data)) {\n ctx.value = true;\n } else if (falseValues.has(data)) {\n ctx.value = false;\n } else {\n ctx.issues.push({\n code: "invalid_value",\n expected: "stringbool",\n values: [...trueValues, ...falseValues],\n input: ctx.value,\n inst\n });\n }\n } else {\n ctx.issues.push({\n code: "invalid_type",\n expected: "string",\n input: ctx.value\n });\n }\n },\n def: {\n check: "custom"\n },\n onattach: []\n }\n }\n ],\n error: error38\n });\n return new _Pipe({\n type: "pipe",\n in: inst,\n out: new _Boolean({\n type: "boolean",\n error: error38\n }),\n error: error38\n });\n}\n\n// ../../node_modules/zod/dist/esm/v4/core/function.js\nclass $ZodFunction {\n constructor(def) {\n this._def = def;\n this.def = def;\n }\n implement(func) {\n if (typeof func !== "function") {\n throw new Error("implement() must be called with a function");\n }\n const impl = (...args) => {\n const parsedArgs = this._def.input ? parse(this._def.input, args, undefined, { callee: impl }) : args;\n if (!Array.isArray(parsedArgs)) {\n throw new Error("Invalid arguments schema: not an array or tuple schema.");\n }\n const output = func(...parsedArgs);\n return this._def.output ? parse(this._def.output, output, undefined, { callee: impl }) : output;\n };\n return impl;\n }\n implementAsync(func) {\n if (typeof func !== "function") {\n throw new Error("implement() must be called with a function");\n }\n const impl = async (...args) => {\n const parsedArgs = this._def.input ? await parseAsync(this._def.input, args, undefined, { callee: impl }) : args;\n if (!Array.isArray(parsedArgs)) {\n throw new Error("Invalid arguments schema: not an array or tuple schema.");\n }\n const output = await func(...parsedArgs);\n return this._def.output ? parseAsync(this._def.output, output, undefined, { callee: impl }) : output;\n };\n return impl;\n }\n input(...args) {\n const F2 = this.constructor;\n if (Array.isArray(args[0])) {\n return new F2({\n type: "function",\n input: new $ZodTuple({\n type: "tuple",\n items: args[0],\n rest: args[1]\n }),\n output: this._def.output\n });\n }\n return new F2({\n type: "function",\n input: args[0],\n output: this._def.output\n });\n }\n output(output) {\n const F2 = this.constructor;\n return new F2({\n type: "function",\n input: this._def.input,\n output\n });\n }\n}\nfunction _function(params) {\n return new $ZodFunction({\n type: "function",\n input: Array.isArray(params?.input) ? _tuple($ZodTuple, params?.input) : params?.input ?? _array($ZodArray, _unknown($ZodUnknown)),\n output: params?.output ?? _unknown($ZodUnknown)\n });\n}\n// ../../node_modules/zod/dist/esm/v4/core/to-json-schema.js\nclass JSONSchemaGenerator {\n constructor(params) {\n this.counter = 0;\n this.metadataRegistry = params?.metadata ?? globalRegistry;\n this.target = params?.target ?? "draft-2020-12";\n this.unrepresentable = params?.unrepresentable ?? "throw";\n this.override = params?.override ?? (() => {});\n this.io = params?.io ?? "output";\n this.seen = new Map;\n }\n process(schema, _params = { path: [], schemaPath: [] }) {\n var _a15;\n const def = schema._zod.def;\n const formatMap = {\n guid: "uuid",\n url: "uri",\n datetime: "date-time",\n json_string: "json-string",\n regex: ""\n };\n const seen = this.seen.get(schema);\n if (seen) {\n seen.count++;\n const isCycle = _params.schemaPath.includes(schema);\n if (isCycle) {\n seen.cycle = _params.path;\n }\n return seen.schema;\n }\n const result = { schema: {}, count: 1, cycle: undefined };\n this.seen.set(schema, result);\n if (schema._zod.toJSONSchema) {\n result.schema = schema._zod.toJSONSchema();\n }\n const params = {\n ..._params,\n schemaPath: [..._params.schemaPath, schema],\n path: _params.path\n };\n const parent = schema._zod.parent;\n if (parent) {\n result.ref = parent;\n this.process(parent, params);\n this.seen.get(parent).isParent = true;\n } else {\n const _json = result.schema;\n switch (def.type) {\n case "string": {\n const json = _json;\n json.type = "string";\n const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;\n if (typeof minimum === "number")\n json.minLength = minimum;\n if (typeof maximum === "number")\n json.maxLength = maximum;\n if (format) {\n json.format = formatMap[format] ?? format;\n if (json.format === "")\n delete json.format;\n }\n if (contentEncoding)\n json.contentEncoding = contentEncoding;\n if (patterns && patterns.size > 0) {\n const regexes = [...patterns];\n if (regexes.length === 1)\n json.pattern = regexes[0].source;\n else if (regexes.length > 1) {\n result.schema.allOf = [\n ...regexes.map((regex) => ({\n ...this.target === "draft-7" ? { type: "string" } : {},\n pattern: regex.source\n }))\n ];\n }\n }\n break;\n }\n case "number": {\n const json = _json;\n const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;\n if (typeof format === "string" && format.includes("int"))\n json.type = "integer";\n else\n json.type = "number";\n if (typeof exclusiveMinimum === "number")\n json.exclusiveMinimum = exclusiveMinimum;\n if (typeof minimum === "number") {\n json.minimum = minimum;\n if (typeof exclusiveMinimum === "number") {\n if (exclusiveMinimum >= minimum)\n delete json.minimum;\n else\n delete json.exclusiveMinimum;\n }\n }\n if (typeof exclusiveMaximum === "number")\n json.exclusiveMaximum = exclusiveMaximum;\n if (typeof maximum === "number") {\n json.maximum = maximum;\n if (typeof exclusiveMaximum === "number") {\n if (exclusiveMaximum <= maximum)\n delete json.maximum;\n else\n delete json.exclusiveMaximum;\n }\n }\n if (typeof multipleOf === "number")\n json.multipleOf = multipleOf;\n break;\n }\n case "boolean": {\n const json = _json;\n json.type = "boolean";\n break;\n }\n case "bigint": {\n if (this.unrepresentable === "throw") {\n throw new Error("BigInt cannot be represented in JSON Schema");\n }\n break;\n }\n case "symbol": {\n if (this.unrepresentable === "throw") {\n throw new Error("Symbols cannot be represented in JSON Schema");\n }\n break;\n }\n case "undefined": {\n const json = _json;\n json.type = "null";\n break;\n }\n case "null": {\n _json.type = "null";\n break;\n }\n case "any": {\n break;\n }\n case "unknown": {\n break;\n }\n case "never": {\n _json.not = {};\n break;\n }\n case "void": {\n if (this.unrepresentable === "throw") {\n throw new Error("Void cannot be represented in JSON Schema");\n }\n break;\n }\n case "date": {\n if (this.unrepresentable === "throw") {\n throw new Error("Date cannot be represented in JSON Schema");\n }\n break;\n }\n case "array": {\n const json = _json;\n const { minimum, maximum } = schema._zod.bag;\n if (typeof minimum === "number")\n json.minItems = minimum;\n if (typeof maximum === "number")\n json.maxItems = maximum;\n json.type = "array";\n json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });\n break;\n }\n case "object": {\n const json = _json;\n json.type = "object";\n json.properties = {};\n const shape = def.shape;\n for (const key in shape) {\n json.properties[key] = this.process(shape[key], {\n ...params,\n path: [...params.path, "properties", key]\n });\n }\n const allKeys = new Set(Object.keys(shape));\n const requiredKeys = new Set([...allKeys].filter((key) => {\n const v3 = def.shape[key]._zod;\n if (this.io === "input") {\n return v3.optin === undefined;\n } else {\n return v3.optout === undefined;\n }\n }));\n if (requiredKeys.size > 0) {\n json.required = Array.from(requiredKeys);\n }\n if (def.catchall?._zod.def.type === "never") {\n json.additionalProperties = false;\n } else if (!def.catchall) {\n if (this.io === "output")\n json.additionalProperties = false;\n } else if (def.catchall) {\n json.additionalProperties = this.process(def.catchall, {\n ...params,\n path: [...params.path, "additionalProperties"]\n });\n }\n break;\n }\n case "union": {\n const json = _json;\n json.anyOf = def.options.map((x2, i2) => this.process(x2, {\n ...params,\n path: [...params.path, "anyOf", i2]\n }));\n break;\n }\n case "intersection": {\n const json = _json;\n const a2 = this.process(def.left, {\n ...params,\n path: [...params.path, "allOf", 0]\n });\n const b2 = this.process(def.right, {\n ...params,\n path: [...params.path, "allOf", 1]\n });\n const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;\n const allOf = [\n ...isSimpleIntersection(a2) ? a2.allOf : [a2],\n ...isSimpleIntersection(b2) ? b2.allOf : [b2]\n ];\n json.allOf = allOf;\n break;\n }\n case "tuple": {\n const json = _json;\n json.type = "array";\n const prefixItems = def.items.map((x2, i2) => this.process(x2, { ...params, path: [...params.path, "prefixItems", i2] }));\n if (this.target === "draft-2020-12") {\n json.prefixItems = prefixItems;\n } else {\n json.items = prefixItems;\n }\n if (def.rest) {\n const rest = this.process(def.rest, {\n ...params,\n path: [...params.path, "items"]\n });\n if (this.target === "draft-2020-12") {\n json.items = rest;\n } else {\n json.additionalItems = rest;\n }\n }\n if (def.rest) {\n json.items = this.process(def.rest, {\n ...params,\n path: [...params.path, "items"]\n });\n }\n const { minimum, maximum } = schema._zod.bag;\n if (typeof minimum === "number")\n json.minItems = minimum;\n if (typeof maximum === "number")\n json.maxItems = maximum;\n break;\n }\n case "record": {\n const json = _json;\n json.type = "object";\n json.propertyNames = this.process(def.keyType, { ...params, path: [...params.path, "propertyNames"] });\n json.additionalProperties = this.process(def.valueType, {\n ...params,\n path: [...params.path, "additionalProperties"]\n });\n break;\n }\n case "map": {\n if (this.unrepresentable === "throw") {\n throw new Error("Map cannot be represented in JSON Schema");\n }\n break;\n }\n case "set": {\n if (this.unrepresentable === "throw") {\n throw new Error("Set cannot be represented in JSON Schema");\n }\n break;\n }\n case "enum": {\n const json = _json;\n const values = getEnumValues(def.entries);\n if (values.every((v3) => typeof v3 === "number"))\n json.type = "number";\n if (values.every((v3) => typeof v3 === "string"))\n json.type = "string";\n json.enum = values;\n break;\n }\n case "literal": {\n const json = _json;\n const vals = [];\n for (const val of def.values) {\n if (val === undefined) {\n if (this.unrepresentable === "throw") {\n throw new Error("Literal `undefined` cannot be represented in JSON Schema");\n } else {}\n } else if (typeof val === "bigint") {\n if (this.unrepresentable === "throw") {\n throw new Error("BigInt literals cannot be represented in JSON Schema");\n } else {\n vals.push(Number(val));\n }\n } else {\n vals.push(val);\n }\n }\n if (vals.length === 0) {} else if (vals.length === 1) {\n const val = vals[0];\n json.type = val === null ? "null" : typeof val;\n json.const = val;\n } else {\n if (vals.every((v3) => typeof v3 === "number"))\n json.type = "number";\n if (vals.every((v3) => typeof v3 === "string"))\n json.type = "string";\n if (vals.every((v3) => typeof v3 === "boolean"))\n json.type = "string";\n if (vals.every((v3) => v3 === null))\n json.type = "null";\n json.enum = vals;\n }\n break;\n }\n case "file": {\n const json = _json;\n const file = {\n type: "string",\n format: "binary",\n contentEncoding: "binary"\n };\n const { minimum, maximum, mime } = schema._zod.bag;\n if (minimum !== undefined)\n file.minLength = minimum;\n if (maximum !== undefined)\n file.maxLength = maximum;\n if (mime) {\n if (mime.length === 1) {\n file.contentMediaType = mime[0];\n Object.assign(json, file);\n } else {\n json.anyOf = mime.map((m3) => {\n const mFile = { ...file, contentMediaType: m3 };\n return mFile;\n });\n }\n } else {\n Object.assign(json, file);\n }\n break;\n }\n case "transform": {\n if (this.unrepresentable === "throw") {\n throw new Error("Transforms cannot be represented in JSON Schema");\n }\n break;\n }\n case "nullable": {\n const inner = this.process(def.innerType, params);\n _json.anyOf = [inner, { type: "null" }];\n break;\n }\n case "nonoptional": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n break;\n }\n case "success": {\n const json = _json;\n json.type = "boolean";\n break;\n }\n case "default": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n _json.default = def.defaultValue;\n break;\n }\n case "prefault": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n if (this.io === "input")\n _json._prefault = def.defaultValue;\n break;\n }\n case "catch": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n let catchValue;\n try {\n catchValue = def.catchValue(undefined);\n } catch {\n throw new Error("Dynamic catch values are not supported in JSON Schema");\n }\n _json.default = catchValue;\n break;\n }\n case "nan": {\n if (this.unrepresentable === "throw") {\n throw new Error("NaN cannot be represented in JSON Schema");\n }\n break;\n }\n case "template_literal": {\n const json = _json;\n const pattern = schema._zod.pattern;\n if (!pattern)\n throw new Error("Pattern not found in template literal");\n json.type = "string";\n json.pattern = pattern.source;\n break;\n }\n case "pipe": {\n const innerType = this.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;\n this.process(innerType, params);\n result.ref = innerType;\n break;\n }\n case "readonly": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n _json.readOnly = true;\n break;\n }\n case "promise": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n break;\n }\n case "optional": {\n this.process(def.innerType, params);\n result.ref = def.innerType;\n break;\n }\n case "lazy": {\n const innerType = schema._zod.innerType;\n this.process(innerType, params);\n result.ref = innerType;\n break;\n }\n case "custom": {\n if (this.unrepresentable === "throw") {\n throw new Error("Custom types cannot be represented in JSON Schema");\n }\n break;\n }\n default: {}\n }\n }\n const meta = this.metadataRegistry.get(schema);\n if (meta)\n Object.assign(result.schema, meta);\n if (this.io === "input" && isTransforming(schema)) {\n delete result.schema.examples;\n delete result.schema.default;\n }\n if (this.io === "input" && result.schema._prefault)\n (_a15 = result.schema).default ?? (_a15.default = result.schema._prefault);\n delete result.schema._prefault;\n const _result = this.seen.get(schema);\n return _result.schema;\n }\n emit(schema, _params) {\n const params = {\n cycles: _params?.cycles ?? "ref",\n reused: _params?.reused ?? "inline",\n external: _params?.external ?? undefined\n };\n const root = this.seen.get(schema);\n if (!root)\n throw new Error("Unprocessed schema. This is a bug in Zod.");\n const makeURI = (entry) => {\n const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";\n if (params.external) {\n const externalId = params.external.registry.get(entry[0])?.id;\n if (externalId)\n return { ref: params.external.uri(externalId) };\n const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;\n entry[1].defId = id;\n return { defId: id, ref: `${params.external.uri("__shared")}#/${defsSegment}/${id}` };\n }\n if (entry[1] === root) {\n return { ref: "#" };\n }\n const uriPrefix = `#`;\n const defUriPrefix = `${uriPrefix}/${defsSegment}/`;\n const defId = entry[1].schema.id ?? `__schema${this.counter++}`;\n return { defId, ref: defUriPrefix + defId };\n };\n const extractToDef = (entry) => {\n if (entry[1].schema.$ref) {\n return;\n }\n const seen = entry[1];\n const { ref, defId } = makeURI(entry);\n seen.def = { ...seen.schema };\n if (defId)\n seen.defId = defId;\n const schema2 = seen.schema;\n for (const key in schema2) {\n delete schema2[key];\n }\n schema2.$ref = ref;\n };\n for (const entry of this.seen.entries()) {\n const seen = entry[1];\n if (schema === entry[0]) {\n extractToDef(entry);\n continue;\n }\n if (params.external) {\n const ext = params.external.registry.get(entry[0])?.id;\n if (schema !== entry[0] && ext) {\n extractToDef(entry);\n continue;\n }\n }\n const id = this.metadataRegistry.get(entry[0])?.id;\n if (id) {\n extractToDef(entry);\n continue;\n }\n if (seen.cycle) {\n if (params.cycles === "throw") {\n throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/` + \'\\n\\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.\');\n } else if (params.cycles === "ref") {\n extractToDef(entry);\n }\n continue;\n }\n if (seen.count > 1) {\n if (params.reused === "ref") {\n extractToDef(entry);\n continue;\n }\n }\n }\n const flattenRef = (zodSchema, params2) => {\n const seen = this.seen.get(zodSchema);\n const schema2 = seen.def ?? seen.schema;\n const _cached = { ...schema2 };\n if (seen.ref === null) {\n return;\n }\n const ref = seen.ref;\n seen.ref = null;\n if (ref) {\n flattenRef(ref, params2);\n const refSchema = this.seen.get(ref).schema;\n if (refSchema.$ref && params2.target === "draft-7") {\n schema2.allOf = schema2.allOf ?? [];\n schema2.allOf.push(refSchema);\n } else {\n Object.assign(schema2, refSchema);\n Object.assign(schema2, _cached);\n }\n }\n if (!seen.isParent)\n this.override({\n zodSchema,\n jsonSchema: schema2\n });\n };\n for (const entry of [...this.seen.entries()].reverse()) {\n flattenRef(entry[0], { target: this.target });\n }\n const result = {};\n if (this.target === "draft-2020-12") {\n result.$schema = "https://json-schema.org/draft/2020-12/schema";\n } else if (this.target === "draft-7") {\n result.$schema = "http://json-schema.org/draft-07/schema#";\n } else {\n console.warn(`Invalid target: ${this.target}`);\n }\n Object.assign(result, root.def);\n const defs = params.external?.defs ?? {};\n for (const entry of this.seen.entries()) {\n const seen = entry[1];\n if (seen.def && seen.defId) {\n defs[seen.defId] = seen.def;\n }\n }\n if (!params.external && Object.keys(defs).length > 0) {\n if (this.target === "draft-2020-12") {\n result.$defs = defs;\n } else {\n result.definitions = defs;\n }\n }\n try {\n return JSON.parse(JSON.stringify(result));\n } catch (_err) {\n throw new Error("Error converting schema to JSON.");\n }\n }\n}\nfunction toJSONSchema(input, _params) {\n if (input instanceof $ZodRegistry) {\n const gen2 = new JSONSchemaGenerator(_params);\n const defs = {};\n for (const entry of input._idmap.entries()) {\n const [_3, schema] = entry;\n gen2.process(schema);\n }\n const schemas = {};\n const external = {\n registry: input,\n uri: _params?.uri || ((id) => id),\n defs\n };\n for (const entry of input._idmap.entries()) {\n const [key, schema] = entry;\n schemas[key] = gen2.emit(schema, {\n ..._params,\n external\n });\n }\n if (Object.keys(defs).length > 0) {\n const defsSegment = gen2.target === "draft-2020-12" ? "$defs" : "definitions";\n schemas.__shared = {\n [defsSegment]: defs\n };\n }\n return { schemas };\n }\n const gen = new JSONSchemaGenerator(_params);\n gen.process(input);\n return gen.emit(input, _params);\n}\nfunction isTransforming(_schema, _ctx) {\n const ctx = _ctx ?? { seen: new Set };\n if (ctx.seen.has(_schema))\n return false;\n ctx.seen.add(_schema);\n const schema = _schema;\n const def = schema._zod.def;\n switch (def.type) {\n case "string":\n case "number":\n case "bigint":\n case "boolean":\n case "date":\n case "symbol":\n case "undefined":\n case "null":\n case "any":\n case "unknown":\n case "never":\n case "void":\n case "literal":\n case "enum":\n case "nan":\n case "file":\n case "template_literal":\n return false;\n case "array": {\n return isTransforming(def.element, ctx);\n }\n case "object": {\n for (const key in def.shape) {\n if (isTransforming(def.shape[key], ctx))\n return true;\n }\n return false;\n }\n case "union": {\n for (const option of def.options) {\n if (isTransforming(option, ctx))\n return true;\n }\n return false;\n }\n case "intersection": {\n return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);\n }\n case "tuple": {\n for (const item of def.items) {\n if (isTransforming(item, ctx))\n return true;\n }\n if (def.rest && isTransforming(def.rest, ctx))\n return true;\n return false;\n }\n case "record": {\n return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);\n }\n case "map": {\n return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);\n }\n case "set": {\n return isTransforming(def.valueType, ctx);\n }\n case "promise":\n case "optional":\n case "nonoptional":\n case "nullable":\n case "readonly":\n return isTransforming(def.innerType, ctx);\n case "lazy":\n return isTransforming(def.getter(), ctx);\n case "default": {\n return isTransforming(def.innerType, ctx);\n }\n case "prefault": {\n return isTransforming(def.innerType, ctx);\n }\n case "custom": {\n return false;\n }\n case "transform": {\n return true;\n }\n case "pipe": {\n return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);\n }\n case "success": {\n return false;\n }\n case "catch": {\n return false;\n }\n default:\n }\n throw new Error(`Unknown schema type: ${def.type}`);\n}\n// ../../node_modules/zod/dist/esm/v4/core/json-schema.js\nvar exports_json_schema = {};\n// ../../node_modules/zod/dist/esm/v4/classic/iso.js\nvar exports_iso = {};\n__export(exports_iso, {\n time: () => time2,\n duration: () => duration2,\n datetime: () => datetime2,\n date: () => date2,\n ZodISOTime: () => ZodISOTime,\n ZodISODuration: () => ZodISODuration,\n ZodISODateTime: () => ZodISODateTime,\n ZodISODate: () => ZodISODate\n});\nvar ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {\n $ZodISODateTime.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction datetime2(params) {\n return _isoDateTime(ZodISODateTime, params);\n}\nvar ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {\n $ZodISODate.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction date2(params) {\n return _isoDate(ZodISODate, params);\n}\nvar ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {\n $ZodISOTime.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction time2(params) {\n return _isoTime(ZodISOTime, params);\n}\nvar ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {\n $ZodISODuration.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction duration2(params) {\n return _isoDuration(ZodISODuration, params);\n}\n\n// ../../node_modules/zod/dist/esm/v4/classic/errors.js\nvar initializer2 = (inst, issues) => {\n $ZodError.init(inst, issues);\n inst.name = "ZodError";\n Object.defineProperties(inst, {\n format: {\n value: (mapper) => formatError(inst, mapper)\n },\n flatten: {\n value: (mapper) => flattenError(inst, mapper)\n },\n addIssue: {\n value: (issue2) => inst.issues.push(issue2)\n },\n addIssues: {\n value: (issues2) => inst.issues.push(...issues2)\n },\n isEmpty: {\n get() {\n return inst.issues.length === 0;\n }\n }\n });\n};\nvar ZodError = $constructor("ZodError", initializer2);\nvar ZodRealError = $constructor("ZodError", initializer2, {\n Parent: Error\n});\n\n// ../../node_modules/zod/dist/esm/v4/classic/parse.js\nvar parse3 = /* @__PURE__ */ _parse(ZodRealError);\nvar parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);\nvar safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);\nvar safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);\n\n// ../../node_modules/zod/dist/esm/v4/classic/schemas.js\nvar ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {\n $ZodType.init(inst, def);\n inst.def = def;\n Object.defineProperty(inst, "_def", { value: def });\n inst.check = (...checks2) => {\n return inst.clone({\n ...def,\n checks: [\n ...def.checks ?? [],\n ...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)\n ]\n });\n };\n inst.clone = (def2, params) => clone(inst, def2, params);\n inst.brand = () => inst;\n inst.register = (reg, meta) => {\n reg.add(inst, meta);\n return inst;\n };\n inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });\n inst.safeParse = (data, params) => safeParse2(inst, data, params);\n inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });\n inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);\n inst.spa = inst.safeParseAsync;\n inst.refine = (check, params) => inst.check(refine(check, params));\n inst.superRefine = (refinement) => inst.check(superRefine(refinement));\n inst.overwrite = (fn) => inst.check(_overwrite(fn));\n inst.optional = () => optional(inst);\n inst.nullable = () => nullable(inst);\n inst.nullish = () => optional(nullable(inst));\n inst.nonoptional = (params) => nonoptional(inst, params);\n inst.array = () => array(inst);\n inst.or = (arg) => union([inst, arg]);\n inst.and = (arg) => intersection(inst, arg);\n inst.transform = (tx) => pipe(inst, transform(tx));\n inst.default = (def2) => _default2(inst, def2);\n inst.prefault = (def2) => prefault(inst, def2);\n inst.catch = (params) => _catch2(inst, params);\n inst.pipe = (target) => pipe(inst, target);\n inst.readonly = () => readonly(inst);\n inst.describe = (description) => {\n const cl = inst.clone();\n globalRegistry.add(cl, { description });\n return cl;\n };\n Object.defineProperty(inst, "description", {\n get() {\n return globalRegistry.get(inst)?.description;\n },\n configurable: true\n });\n inst.meta = (...args) => {\n if (args.length === 0) {\n return globalRegistry.get(inst);\n }\n const cl = inst.clone();\n globalRegistry.add(cl, args[0]);\n return cl;\n };\n inst.isOptional = () => inst.safeParse(undefined).success;\n inst.isNullable = () => inst.safeParse(null).success;\n return inst;\n});\nvar _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {\n $ZodString.init(inst, def);\n ZodType.init(inst, def);\n const bag = inst._zod.bag;\n inst.format = bag.format ?? null;\n inst.minLength = bag.minimum ?? null;\n inst.maxLength = bag.maximum ?? null;\n inst.regex = (...args) => inst.check(_regex(...args));\n inst.includes = (...args) => inst.check(_includes(...args));\n inst.startsWith = (...args) => inst.check(_startsWith(...args));\n inst.endsWith = (...args) => inst.check(_endsWith(...args));\n inst.min = (...args) => inst.check(_minLength(...args));\n inst.max = (...args) => inst.check(_maxLength(...args));\n inst.length = (...args) => inst.check(_length(...args));\n inst.nonempty = (...args) => inst.check(_minLength(1, ...args));\n inst.lowercase = (params) => inst.check(_lowercase(params));\n inst.uppercase = (params) => inst.check(_uppercase(params));\n inst.trim = () => inst.check(_trim());\n inst.normalize = (...args) => inst.check(_normalize(...args));\n inst.toLowerCase = () => inst.check(_toLowerCase());\n inst.toUpperCase = () => inst.check(_toUpperCase());\n});\nvar ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {\n $ZodString.init(inst, def);\n _ZodString.init(inst, def);\n inst.email = (params) => inst.check(_email(ZodEmail, params));\n inst.url = (params) => inst.check(_url(ZodURL, params));\n inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));\n inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));\n inst.guid = (params) => inst.check(_guid(ZodGUID, params));\n inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));\n inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));\n inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));\n inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));\n inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));\n inst.guid = (params) => inst.check(_guid(ZodGUID, params));\n inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));\n inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));\n inst.ulid = (params) => inst.check(_ulid(ZodULID, params));\n inst.base64 = (params) => inst.check(_base64(ZodBase64, params));\n inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));\n inst.xid = (params) => inst.check(_xid(ZodXID, params));\n inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));\n inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));\n inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));\n inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));\n inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));\n inst.e164 = (params) => inst.check(_e164(ZodE164, params));\n inst.datetime = (params) => inst.check(datetime2(params));\n inst.date = (params) => inst.check(date2(params));\n inst.time = (params) => inst.check(time2(params));\n inst.duration = (params) => inst.check(duration2(params));\n});\nfunction string2(params) {\n return _string(ZodString, params);\n}\nvar ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n _ZodString.init(inst, def);\n});\nvar ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {\n $ZodEmail.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction email2(params) {\n return _email(ZodEmail, params);\n}\nvar ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {\n $ZodGUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction guid2(params) {\n return _guid(ZodGUID, params);\n}\nvar ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {\n $ZodUUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction uuid2(params) {\n return _uuid(ZodUUID, params);\n}\nfunction uuidv4(params) {\n return _uuidv4(ZodUUID, params);\n}\nfunction uuidv6(params) {\n return _uuidv6(ZodUUID, params);\n}\nfunction uuidv7(params) {\n return _uuidv7(ZodUUID, params);\n}\nvar ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {\n $ZodURL.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction url(params) {\n return _url(ZodURL, params);\n}\nvar ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {\n $ZodEmoji.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction emoji2(params) {\n return _emoji2(ZodEmoji, params);\n}\nvar ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {\n $ZodNanoID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction nanoid2(params) {\n return _nanoid(ZodNanoID, params);\n}\nvar ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {\n $ZodCUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction cuid3(params) {\n return _cuid(ZodCUID, params);\n}\nvar ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {\n $ZodCUID2.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction cuid22(params) {\n return _cuid2(ZodCUID2, params);\n}\nvar ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {\n $ZodULID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction ulid2(params) {\n return _ulid(ZodULID, params);\n}\nvar ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {\n $ZodXID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction xid2(params) {\n return _xid(ZodXID, params);\n}\nvar ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {\n $ZodKSUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction ksuid2(params) {\n return _ksuid(ZodKSUID, params);\n}\nvar ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {\n $ZodIPv4.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction ipv42(params) {\n return _ipv4(ZodIPv4, params);\n}\nvar ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {\n $ZodIPv6.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction ipv62(params) {\n return _ipv6(ZodIPv6, params);\n}\nvar ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {\n $ZodCIDRv4.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction cidrv42(params) {\n return _cidrv4(ZodCIDRv4, params);\n}\nvar ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {\n $ZodCIDRv6.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction cidrv62(params) {\n return _cidrv6(ZodCIDRv6, params);\n}\nvar ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {\n $ZodBase64.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction base642(params) {\n return _base64(ZodBase64, params);\n}\nvar ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {\n $ZodBase64URL.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction base64url2(params) {\n return _base64url(ZodBase64URL, params);\n}\nvar ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {\n $ZodE164.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction e1642(params) {\n return _e164(ZodE164, params);\n}\nvar ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {\n $ZodJWT.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nfunction jwt(params) {\n return _jwt(ZodJWT, params);\n}\nvar ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {\n $ZodNumber.init(inst, def);\n ZodType.init(inst, def);\n inst.gt = (value, params) => inst.check(_gt(value, params));\n inst.gte = (value, params) => inst.check(_gte(value, params));\n inst.min = (value, params) => inst.check(_gte(value, params));\n inst.lt = (value, params) => inst.check(_lt(value, params));\n inst.lte = (value, params) => inst.check(_lte(value, params));\n inst.max = (value, params) => inst.check(_lte(value, params));\n inst.int = (params) => inst.check(int(params));\n inst.safe = (params) => inst.check(int(params));\n inst.positive = (params) => inst.check(_gt(0, params));\n inst.nonnegative = (params) => inst.check(_gte(0, params));\n inst.negative = (params) => inst.check(_lt(0, params));\n inst.nonpositive = (params) => inst.check(_lte(0, params));\n inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));\n inst.step = (value, params) => inst.check(_multipleOf(value, params));\n inst.finite = () => inst;\n const bag = inst._zod.bag;\n inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;\n inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;\n inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);\n inst.isFinite = true;\n inst.format = bag.format ?? null;\n});\nfunction number2(params) {\n return _number(ZodNumber, params);\n}\nvar ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {\n $ZodNumberFormat.init(inst, def);\n ZodNumber.init(inst, def);\n});\nfunction int(params) {\n return _int(ZodNumberFormat, params);\n}\nfunction float32(params) {\n return _float32(ZodNumberFormat, params);\n}\nfunction float64(params) {\n return _float64(ZodNumberFormat, params);\n}\nfunction int32(params) {\n return _int32(ZodNumberFormat, params);\n}\nfunction uint32(params) {\n return _uint32(ZodNumberFormat, params);\n}\nvar ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {\n $ZodBoolean.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction boolean2(params) {\n return _boolean(ZodBoolean, params);\n}\nvar ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {\n $ZodBigInt.init(inst, def);\n ZodType.init(inst, def);\n inst.gte = (value, params) => inst.check(_gte(value, params));\n inst.min = (value, params) => inst.check(_gte(value, params));\n inst.gt = (value, params) => inst.check(_gt(value, params));\n inst.gte = (value, params) => inst.check(_gte(value, params));\n inst.min = (value, params) => inst.check(_gte(value, params));\n inst.lt = (value, params) => inst.check(_lt(value, params));\n inst.lte = (value, params) => inst.check(_lte(value, params));\n inst.max = (value, params) => inst.check(_lte(value, params));\n inst.positive = (params) => inst.check(_gt(BigInt(0), params));\n inst.negative = (params) => inst.check(_lt(BigInt(0), params));\n inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));\n inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));\n inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));\n const bag = inst._zod.bag;\n inst.minValue = bag.minimum ?? null;\n inst.maxValue = bag.maximum ?? null;\n inst.format = bag.format ?? null;\n});\nfunction bigint2(params) {\n return _bigint(ZodBigInt, params);\n}\nvar ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {\n $ZodBigIntFormat.init(inst, def);\n ZodBigInt.init(inst, def);\n});\nfunction int64(params) {\n return _int64(ZodBigIntFormat, params);\n}\nfunction uint64(params) {\n return _uint64(ZodBigIntFormat, params);\n}\nvar ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {\n $ZodSymbol.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction symbol15(params) {\n return _symbol(ZodSymbol, params);\n}\nvar ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {\n $ZodUndefined.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction _undefined3(params) {\n return _undefined2(ZodUndefined, params);\n}\nvar ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {\n $ZodNull.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction _null3(params) {\n return _null2(ZodNull, params);\n}\nvar ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {\n $ZodAny.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction any() {\n return _any(ZodAny);\n}\nvar ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {\n $ZodUnknown.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction unknown() {\n return _unknown(ZodUnknown);\n}\nvar ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {\n $ZodNever.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction never(params) {\n return _never(ZodNever, params);\n}\nvar ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {\n $ZodVoid.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction _void2(params) {\n return _void(ZodVoid, params);\n}\nvar ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {\n $ZodDate.init(inst, def);\n ZodType.init(inst, def);\n inst.min = (value, params) => inst.check(_gte(value, params));\n inst.max = (value, params) => inst.check(_lte(value, params));\n const c2 = inst._zod.bag;\n inst.minDate = c2.minimum ? new Date(c2.minimum) : null;\n inst.maxDate = c2.maximum ? new Date(c2.maximum) : null;\n});\nfunction date3(params) {\n return _date(ZodDate, params);\n}\nvar ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {\n $ZodArray.init(inst, def);\n ZodType.init(inst, def);\n inst.element = def.element;\n inst.min = (minLength, params) => inst.check(_minLength(minLength, params));\n inst.nonempty = (params) => inst.check(_minLength(1, params));\n inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));\n inst.length = (len, params) => inst.check(_length(len, params));\n inst.unwrap = () => inst.element;\n});\nfunction array(element, params) {\n return _array(ZodArray, element, params);\n}\nfunction keyof(schema) {\n const shape = schema._zod.def.shape;\n return literal(Object.keys(shape));\n}\nvar ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {\n $ZodObject.init(inst, def);\n ZodType.init(inst, def);\n exports_util.defineLazy(inst, "shape", () => {\n return Object.fromEntries(Object.entries(inst._zod.def.shape));\n });\n inst.keyof = () => _enum2(Object.keys(inst._zod.def.shape));\n inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });\n inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });\n inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });\n inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });\n inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });\n inst.extend = (incoming) => {\n return exports_util.extend(inst, incoming);\n };\n inst.merge = (other) => exports_util.merge(inst, other);\n inst.pick = (mask) => exports_util.pick(inst, mask);\n inst.omit = (mask) => exports_util.omit(inst, mask);\n inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);\n inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);\n});\nfunction object(shape, params) {\n const def = {\n type: "object",\n get shape() {\n exports_util.assignProp(this, "shape", { ...shape });\n return this.shape;\n },\n ...exports_util.normalizeParams(params)\n };\n return new ZodObject(def);\n}\nfunction strictObject(shape, params) {\n return new ZodObject({\n type: "object",\n get shape() {\n exports_util.assignProp(this, "shape", { ...shape });\n return this.shape;\n },\n catchall: never(),\n ...exports_util.normalizeParams(params)\n });\n}\nfunction looseObject(shape, params) {\n return new ZodObject({\n type: "object",\n get shape() {\n exports_util.assignProp(this, "shape", { ...shape });\n return this.shape;\n },\n catchall: unknown(),\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {\n $ZodUnion.init(inst, def);\n ZodType.init(inst, def);\n inst.options = def.options;\n});\nfunction union(options, params) {\n return new ZodUnion({\n type: "union",\n options,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {\n ZodUnion.init(inst, def);\n $ZodDiscriminatedUnion.init(inst, def);\n});\nfunction discriminatedUnion(discriminator, options, params) {\n return new ZodDiscriminatedUnion({\n type: "union",\n options,\n discriminator,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {\n $ZodIntersection.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction intersection(left, right) {\n return new ZodIntersection({\n type: "intersection",\n left,\n right\n });\n}\nvar ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {\n $ZodTuple.init(inst, def);\n ZodType.init(inst, def);\n inst.rest = (rest) => inst.clone({\n ...inst._zod.def,\n rest\n });\n});\nfunction tuple(items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof $ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new ZodTuple({\n type: "tuple",\n items,\n rest,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {\n $ZodRecord.init(inst, def);\n ZodType.init(inst, def);\n inst.keyType = def.keyType;\n inst.valueType = def.valueType;\n});\nfunction record(keyType, valueType, params) {\n return new ZodRecord({\n type: "record",\n keyType,\n valueType,\n ...exports_util.normalizeParams(params)\n });\n}\nfunction partialRecord(keyType, valueType, params) {\n return new ZodRecord({\n type: "record",\n keyType: union([keyType, never()]),\n valueType,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {\n $ZodMap.init(inst, def);\n ZodType.init(inst, def);\n inst.keyType = def.keyType;\n inst.valueType = def.valueType;\n});\nfunction map(keyType, valueType, params) {\n return new ZodMap({\n type: "map",\n keyType,\n valueType,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {\n $ZodSet.init(inst, def);\n ZodType.init(inst, def);\n inst.min = (...args) => inst.check(_minSize(...args));\n inst.nonempty = (params) => inst.check(_minSize(1, params));\n inst.max = (...args) => inst.check(_maxSize(...args));\n inst.size = (...args) => inst.check(_size(...args));\n});\nfunction set(valueType, params) {\n return new ZodSet({\n type: "set",\n valueType,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {\n $ZodEnum.init(inst, def);\n ZodType.init(inst, def);\n inst.enum = def.entries;\n inst.options = Object.values(def.entries);\n const keys = new Set(Object.keys(def.entries));\n inst.extract = (values, params) => {\n const newEntries = {};\n for (const value of values) {\n if (keys.has(value)) {\n newEntries[value] = def.entries[value];\n } else\n throw new Error(`Key ${value} not found in enum`);\n }\n return new ZodEnum({\n ...def,\n checks: [],\n ...exports_util.normalizeParams(params),\n entries: newEntries\n });\n };\n inst.exclude = (values, params) => {\n const newEntries = { ...def.entries };\n for (const value of values) {\n if (keys.has(value)) {\n delete newEntries[value];\n } else\n throw new Error(`Key ${value} not found in enum`);\n }\n return new ZodEnum({\n ...def,\n checks: [],\n ...exports_util.normalizeParams(params),\n entries: newEntries\n });\n };\n});\nfunction _enum2(values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v3) => [v3, v3])) : values;\n return new ZodEnum({\n type: "enum",\n entries,\n ...exports_util.normalizeParams(params)\n });\n}\nfunction nativeEnum(entries, params) {\n return new ZodEnum({\n type: "enum",\n entries,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {\n $ZodLiteral.init(inst, def);\n ZodType.init(inst, def);\n inst.values = new Set(def.values);\n Object.defineProperty(inst, "value", {\n get() {\n if (def.values.length > 1) {\n throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");\n }\n return def.values[0];\n }\n });\n});\nfunction literal(value, params) {\n return new ZodLiteral({\n type: "literal",\n values: Array.isArray(value) ? value : [value],\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {\n $ZodFile.init(inst, def);\n ZodType.init(inst, def);\n inst.min = (size, params) => inst.check(_minSize(size, params));\n inst.max = (size, params) => inst.check(_maxSize(size, params));\n inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));\n});\nfunction file(params) {\n return _file(ZodFile, params);\n}\nvar ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {\n $ZodTransform.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n payload.addIssue = (issue2) => {\n if (typeof issue2 === "string") {\n payload.issues.push(exports_util.issue(issue2, payload.value, def));\n } else {\n const _issue = issue2;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = "custom");\n _issue.input ?? (_issue.input = payload.value);\n _issue.inst ?? (_issue.inst = inst);\n _issue.continue ?? (_issue.continue = true);\n payload.issues.push(exports_util.issue(_issue));\n }\n };\n const output = def.transform(payload.value, payload);\n if (output instanceof Promise) {\n return output.then((output2) => {\n payload.value = output2;\n return payload;\n });\n }\n payload.value = output;\n return payload;\n };\n});\nfunction transform(fn) {\n return new ZodTransform({\n type: "transform",\n transform: fn\n });\n}\nvar ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {\n $ZodOptional.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nfunction optional(innerType) {\n return new ZodOptional({\n type: "optional",\n innerType\n });\n}\nvar ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {\n $ZodNullable.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nfunction nullable(innerType) {\n return new ZodNullable({\n type: "nullable",\n innerType\n });\n}\nfunction nullish2(innerType) {\n return optional(nullable(innerType));\n}\nvar ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {\n $ZodDefault.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n inst.removeDefault = inst.unwrap;\n});\nfunction _default2(innerType, defaultValue) {\n return new ZodDefault({\n type: "default",\n innerType,\n get defaultValue() {\n return typeof defaultValue === "function" ? defaultValue() : defaultValue;\n }\n });\n}\nvar ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {\n $ZodPrefault.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nfunction prefault(innerType, defaultValue) {\n return new ZodPrefault({\n type: "prefault",\n innerType,\n get defaultValue() {\n return typeof defaultValue === "function" ? defaultValue() : defaultValue;\n }\n });\n}\nvar ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {\n $ZodNonOptional.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nfunction nonoptional(innerType, params) {\n return new ZodNonOptional({\n type: "nonoptional",\n innerType,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {\n $ZodSuccess.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nfunction success(innerType) {\n return new ZodSuccess({\n type: "success",\n innerType\n });\n}\nvar ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {\n $ZodCatch.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n inst.removeCatch = inst.unwrap;\n});\nfunction _catch2(innerType, catchValue) {\n return new ZodCatch({\n type: "catch",\n innerType,\n catchValue: typeof catchValue === "function" ? catchValue : () => catchValue\n });\n}\nvar ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {\n $ZodNaN.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction nan(params) {\n return _nan(ZodNaN, params);\n}\nvar ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {\n $ZodPipe.init(inst, def);\n ZodType.init(inst, def);\n inst.in = def.in;\n inst.out = def.out;\n});\nfunction pipe(in_, out) {\n return new ZodPipe({\n type: "pipe",\n in: in_,\n out\n });\n}\nvar ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {\n $ZodReadonly.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction readonly(innerType) {\n return new ZodReadonly({\n type: "readonly",\n innerType\n });\n}\nvar ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {\n $ZodTemplateLiteral.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction templateLiteral(parts, params) {\n return new ZodTemplateLiteral({\n type: "template_literal",\n parts,\n ...exports_util.normalizeParams(params)\n });\n}\nvar ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {\n $ZodLazy.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.getter();\n});\nfunction lazy(getter) {\n return new ZodLazy({\n type: "lazy",\n getter\n });\n}\nvar ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {\n $ZodPromise.init(inst, def);\n ZodType.init(inst, def);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nfunction promise(innerType) {\n return new ZodPromise({\n type: "promise",\n innerType\n });\n}\nvar ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {\n $ZodCustom.init(inst, def);\n ZodType.init(inst, def);\n});\nfunction check(fn, params) {\n const ch = new $ZodCheck({\n check: "custom",\n ...exports_util.normalizeParams(params)\n });\n ch._zod.check = fn;\n return ch;\n}\nfunction custom(fn, _params) {\n return _custom(ZodCustom, fn ?? (() => true), _params);\n}\nfunction refine(fn, _params = {}) {\n return _refine(ZodCustom, fn, _params);\n}\nfunction superRefine(fn, params) {\n const ch = check((payload) => {\n payload.addIssue = (issue2) => {\n if (typeof issue2 === "string") {\n payload.issues.push(exports_util.issue(issue2, payload.value, ch._zod.def));\n } else {\n const _issue = issue2;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = "custom");\n _issue.input ?? (_issue.input = payload.value);\n _issue.inst ?? (_issue.inst = ch);\n _issue.continue ?? (_issue.continue = !ch._zod.def.abort);\n payload.issues.push(exports_util.issue(_issue));\n }\n };\n return fn(payload.value, payload);\n }, params);\n return ch;\n}\nfunction _instanceof(cls, params = {\n error: `Input not instance of ${cls.name}`\n}) {\n const inst = new ZodCustom({\n type: "custom",\n check: "custom",\n fn: (data) => data instanceof cls,\n abort: true,\n ...exports_util.normalizeParams(params)\n });\n inst._zod.bag.Class = cls;\n return inst;\n}\nvar stringbool = (...args) => _stringbool({\n Pipe: ZodPipe,\n Boolean: ZodBoolean,\n Unknown: ZodUnknown\n}, ...args);\nfunction json(params) {\n const jsonSchema = lazy(() => {\n return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);\n });\n return jsonSchema;\n}\nfunction preprocess(fn, schema) {\n return pipe(transform(fn), schema);\n}\n// ../../node_modules/zod/dist/esm/v4/classic/compat.js\nvar ZodIssueCode = {\n invalid_type: "invalid_type",\n too_big: "too_big",\n too_small: "too_small",\n invalid_format: "invalid_format",\n not_multiple_of: "not_multiple_of",\n unrecognized_keys: "unrecognized_keys",\n invalid_union: "invalid_union",\n invalid_key: "invalid_key",\n invalid_element: "invalid_element",\n invalid_value: "invalid_value",\n custom: "custom"\n};\nvar INVALID = Object.freeze({\n status: "aborted"\n});\nvar NEVER = INVALID;\nfunction setErrorMap(map2) {\n config({\n customError: map2\n });\n}\nfunction getErrorMap() {\n return config().customError;\n}\n// ../../node_modules/zod/dist/esm/v4/classic/coerce.js\nvar exports_coerce = {};\n__export(exports_coerce, {\n string: () => string3,\n number: () => number3,\n date: () => date4,\n boolean: () => boolean3,\n bigint: () => bigint3\n});\nfunction string3(params) {\n return _coercedString(ZodString, params);\n}\nfunction number3(params) {\n return _coercedNumber(ZodNumber, params);\n}\nfunction boolean3(params) {\n return _coercedBoolean(ZodBoolean, params);\n}\nfunction bigint3(params) {\n return _coercedBigint(ZodBigInt, params);\n}\nfunction date4(params) {\n return _coercedDate(ZodDate, params);\n}\n\n// ../../node_modules/zod/dist/esm/v4/classic/external.js\nconfig(en_default());\n// ../../node_modules/zod/dist/esm/v4/classic/index.js\nvar classic_default = exports_external;\n\n// ../../node_modules/zod/dist/esm/v4/index.js\nvar v4_default = classic_default;\n\n// ../../node_modules/zod/dist/esm/v3/helpers/util.js\nvar util;\n(function(util2) {\n util2.assertEqual = (_3) => {};\n function assertIs2(_arg) {}\n util2.assertIs = assertIs2;\n function assertNever2(_x) {\n throw new Error;\n }\n util2.assertNever = assertNever2;\n util2.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util2.getValidEnumValues = (obj) => {\n const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");\n const filtered = {};\n for (const k2 of validKeys) {\n filtered[k2] = obj[k2];\n }\n return util2.objectValues(filtered);\n };\n util2.objectValues = (obj) => {\n return util2.objectKeys(obj).map(function(e2) {\n return obj[e2];\n });\n };\n util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object2) => {\n const keys = [];\n for (const key in object2) {\n if (Object.prototype.hasOwnProperty.call(object2, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util2.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return;\n };\n util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues2(array2, separator = " | ") {\n return array2.map((val) => typeof val === "string" ? `\'${val}\'` : val).join(separator);\n }\n util2.joinValues = joinValues2;\n util2.jsonStringifyReplacer = (_3, value) => {\n if (typeof value === "bigint") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nvar objectUtil;\n(function(objectUtil2) {\n objectUtil2.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second\n };\n };\n})(objectUtil || (objectUtil = {}));\nvar ZodParsedType = util.arrayToEnum([\n "string",\n "nan",\n "number",\n "integer",\n "float",\n "boolean",\n "date",\n "bigint",\n "symbol",\n "function",\n "undefined",\n "null",\n "array",\n "object",\n "unknown",\n "promise",\n "void",\n "never",\n "map",\n "set"\n]);\nvar getParsedType2 = (data) => {\n const t2 = typeof data;\n switch (t2) {\n case "undefined":\n return ZodParsedType.undefined;\n case "string":\n return ZodParsedType.string;\n case "number":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case "boolean":\n return ZodParsedType.boolean;\n case "function":\n return ZodParsedType.function;\n case "bigint":\n return ZodParsedType.bigint;\n case "symbol":\n return ZodParsedType.symbol;\n case "object":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== "undefined" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== "undefined" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== "undefined" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n\n// ../../node_modules/zod/dist/esm/v3/ZodError.js\nvar ZodIssueCode2 = util.arrayToEnum([\n "invalid_type",\n "invalid_literal",\n "custom",\n "invalid_union",\n "invalid_union_discriminator",\n "invalid_enum_value",\n "unrecognized_keys",\n "invalid_arguments",\n "invalid_return_type",\n "invalid_date",\n "invalid_string",\n "too_small",\n "too_big",\n "invalid_intersection_types",\n "not_multiple_of",\n "not_finite"\n]);\nclass ZodError2 extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(this, actualProto);\n } else {\n this.__proto__ = actualProto;\n }\n this.name = "ZodError";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper || function(issue2) {\n return issue2.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error38) => {\n for (const issue2 of error38.issues) {\n if (issue2.code === "invalid_union") {\n issue2.unionErrors.map(processError);\n } else if (issue2.code === "invalid_return_type") {\n processError(issue2.returnTypeError);\n } else if (issue2.code === "invalid_arguments") {\n processError(issue2.argumentsError);\n } else if (issue2.path.length === 0) {\n fieldErrors._errors.push(mapper(issue2));\n } else {\n let curr = fieldErrors;\n let i2 = 0;\n while (i2 < issue2.path.length) {\n const el = issue2.path[i2];\n const terminal = i2 === issue2.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n } else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue2));\n }\n curr = curr[el];\n i2++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError2)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue2) => issue2.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n } else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError2.create = (issues) => {\n const error38 = new ZodError2(issues);\n return error38;\n};\n\n// ../../node_modules/zod/dist/esm/v3/locales/en.js\nvar errorMap = (issue2, _ctx) => {\n let message;\n switch (issue2.code) {\n case ZodIssueCode2.invalid_type:\n if (issue2.received === ZodParsedType.undefined) {\n message = "Required";\n } else {\n message = `Expected ${issue2.expected}, received ${issue2.received}`;\n }\n break;\n case ZodIssueCode2.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue2.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode2.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue2.keys, ", ")}`;\n break;\n case ZodIssueCode2.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode2.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue2.options)}`;\n break;\n case ZodIssueCode2.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue2.options)}, received \'${issue2.received}\'`;\n break;\n case ZodIssueCode2.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode2.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode2.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode2.invalid_string:\n if (typeof issue2.validation === "object") {\n if ("includes" in issue2.validation) {\n message = `Invalid input: must include "${issue2.validation.includes}"`;\n if (typeof issue2.validation.position === "number") {\n message = `${message} at one or more positions greater than or equal to ${issue2.validation.position}`;\n }\n } else if ("startsWith" in issue2.validation) {\n message = `Invalid input: must start with "${issue2.validation.startsWith}"`;\n } else if ("endsWith" in issue2.validation) {\n message = `Invalid input: must end with "${issue2.validation.endsWith}"`;\n } else {\n util.assertNever(issue2.validation);\n }\n } else if (issue2.validation !== "regex") {\n message = `Invalid ${issue2.validation}`;\n } else {\n message = "Invalid";\n }\n break;\n case ZodIssueCode2.too_small:\n if (issue2.type === "array")\n message = `Array must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `more than`} ${issue2.minimum} element(s)`;\n else if (issue2.type === "string")\n message = `String must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `over`} ${issue2.minimum} character(s)`;\n else if (issue2.type === "number")\n message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;\n else if (issue2.type === "date")\n message = `Date must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue2.minimum))}`;\n else\n message = "Invalid input";\n break;\n case ZodIssueCode2.too_big:\n if (issue2.type === "array")\n message = `Array must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `less than`} ${issue2.maximum} element(s)`;\n else if (issue2.type === "string")\n message = `String must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `under`} ${issue2.maximum} character(s)`;\n else if (issue2.type === "number")\n message = `Number must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;\n else if (issue2.type === "bigint")\n message = `BigInt must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;\n else if (issue2.type === "date")\n message = `Date must be ${issue2.exact ? `exactly` : issue2.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue2.maximum))}`;\n else\n message = "Invalid input";\n break;\n case ZodIssueCode2.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode2.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode2.not_multiple_of:\n message = `Number must be a multiple of ${issue2.multipleOf}`;\n break;\n case ZodIssueCode2.not_finite:\n message = "Number must be finite";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue2);\n }\n return { message };\n};\nvar en_default2 = errorMap;\n\n// ../../node_modules/zod/dist/esm/v3/errors.js\nvar overrideErrorMap = en_default2;\nfunction getErrorMap2() {\n return overrideErrorMap;\n}\n\n// ../../node_modules/zod/dist/esm/v3/helpers/parseUtil.js\nvar makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...issueData.path || []];\n const fullIssue = {\n ...issueData,\n path: fullPath\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message\n };\n }\n let errorMessage = "";\n const maps = errorMaps.filter((m3) => !!m3).slice().reverse();\n for (const map2 of maps) {\n errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage\n };\n};\nfunction addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap2();\n const issue2 = makeIssue({\n issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n overrideMap,\n overrideMap === en_default2 ? undefined : en_default2\n ].filter((x2) => !!x2)\n });\n ctx.common.issues.push(issue2);\n}\n\nclass ParseStatus {\n constructor() {\n this.value = "valid";\n }\n dirty() {\n if (this.value === "valid")\n this.value = "dirty";\n }\n abort() {\n if (this.value !== "aborted")\n this.value = "aborted";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s2 of results) {\n if (s2.status === "aborted")\n return INVALID2;\n if (s2.status === "dirty")\n status.dirty();\n arrayValue.push(s2.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === "aborted")\n return INVALID2;\n if (value.status === "aborted")\n return INVALID2;\n if (key.status === "dirty")\n status.dirty();\n if (value.status === "dirty")\n status.dirty();\n if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nvar INVALID2 = Object.freeze({\n status: "aborted"\n});\nvar DIRTY = (value) => ({ status: "dirty", value });\nvar OK = (value) => ({ status: "valid", value });\nvar isAborted = (x2) => x2.status === "aborted";\nvar isDirty = (x2) => x2.status === "dirty";\nvar isValid = (x2) => x2.status === "valid";\nvar isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;\n\n// ../../node_modules/zod/dist/esm/v3/helpers/errorUtil.js\nvar errorUtil;\n(function(errorUtil2) {\n errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};\n errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n\n// ../../node_modules/zod/dist/esm/v3/types.js\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n } else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nvar handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n } else {\n if (!ctx.common.issues.length) {\n throw new Error("Validation failed but no issues detected.");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error38 = new ZodError2(ctx.common.issues);\n this._error = error38;\n return this._error;\n }\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;\n if (errorMap2 && (invalid_type_error || required_error)) {\n throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);\n }\n if (errorMap2)\n return { errorMap: errorMap2, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === "invalid_enum_value") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === "undefined") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== "invalid_type")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\n\nclass ZodType2 {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType2(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType2(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent\n };\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus,\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType2(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent\n }\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error("Synchronous parse encountered promise.");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType2(data)\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n "~validate"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this["~standard"].async\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType2(data)\n };\n if (!this["~standard"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result) ? {\n value: result.value\n } : {\n issues: ctx.common.issues\n };\n } catch (err) {\n if (err?.message?.toLowerCase()?.includes("encountered")) {\n this["~standard"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {\n value: result.value\n } : {\n issues: ctx.common.issues\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType2(data)\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check2, message) {\n const getIssueProperties = (val) => {\n if (typeof message === "string" || typeof message === "undefined") {\n return { message };\n } else if (typeof message === "function") {\n return message(val);\n } else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check2(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode2.custom,\n ...getIssueProperties(val)\n });\n if (typeof Promise !== "undefined" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n } else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n } else {\n return true;\n }\n });\n }\n refinement(check2, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check2(val)) {\n ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);\n return false;\n } else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: "refinement", refinement }\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this["~standard"] = {\n version: 1,\n vendor: "zod",\n validate: (data) => this["~validate"](data)\n };\n }\n optional() {\n return ZodOptional2.create(this, this._def);\n }\n nullable() {\n return ZodNullable2.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray2.create(this);\n }\n promise() {\n return ZodPromise2.create(this, this._def);\n }\n or(option) {\n return ZodUnion2.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection2.create(this, incoming, this._def);\n }\n transform(transform2) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: "transform", transform: transform2 }\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === "function" ? def : () => def;\n return new ZodDefault2({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def)\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === "function" ? def : () => def;\n return new ZodCatch2({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly2.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nvar cuidRegex = /^c[^\\s-]{8,}$/i;\nvar cuid2Regex = /^[0-9a-z]+$/;\nvar ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\nvar uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nvar nanoidRegex = /^[a-z0-9_-]{21}$/i;\nvar jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nvar durationRegex = /^[-+]?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)?)??$/;\nvar emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\nvar _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nvar emojiRegex;\nvar ipv4Regex = /^(?:(?: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])$/;\nvar ipv4CidrRegex = /^(?:(?: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])\\/(3[0-2]|[12]?[0-9])$/;\nvar ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nvar ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\nvar base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\nvar base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\nvar dateRegexSource = `((\\\\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])))`;\nvar dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n } else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? "+" : "?";\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\nfunction datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join("|")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version2) {\n if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT2(jwt2, alg) {\n if (!jwtRegex.test(jwt2))\n return false;\n try {\n const [header] = jwt2.split(".");\n const base643 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");\n const decoded = JSON.parse(atob(base643));\n if (typeof decoded !== "object" || decoded === null)\n return false;\n if ("typ" in decoded && decoded?.typ !== "JWT")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n } catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version2) {\n if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\n\nclass ZodString2 extends ZodType2 {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.string) {\n const ctx2 = this._getOrReturnCtx(input);\n addIssueToContext(ctx2, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.string,\n received: ctx2.parsedType\n });\n return INVALID2;\n }\n const status = new ParseStatus;\n let ctx = undefined;\n for (const check2 of this._def.checks) {\n if (check2.kind === "min") {\n if (input.data.length < check2.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n minimum: check2.value,\n type: "string",\n inclusive: true,\n exact: false,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "max") {\n if (input.data.length > check2.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n maximum: check2.value,\n type: "string",\n inclusive: true,\n exact: false,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "length") {\n const tooBig = input.data.length > check2.value;\n const tooSmall = input.data.length < check2.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n maximum: check2.value,\n type: "string",\n inclusive: true,\n exact: true,\n message: check2.message\n });\n } else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n minimum: check2.value,\n type: "string",\n inclusive: true,\n exact: true,\n message: check2.message\n });\n }\n status.dirty();\n }\n } else if (check2.kind === "email") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "email",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "emoji") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, "u");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "emoji",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "uuid") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "uuid",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "nanoid") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "nanoid",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "cuid") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "cuid",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "cuid2") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "cuid2",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "ulid") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "ulid",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "url") {\n try {\n new URL(input.data);\n } catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "url",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "regex") {\n check2.regex.lastIndex = 0;\n const testResult = check2.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "regex",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "trim") {\n input.data = input.data.trim();\n } else if (check2.kind === "includes") {\n if (!input.data.includes(check2.value, check2.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_string,\n validation: { includes: check2.value, position: check2.position },\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "toLowerCase") {\n input.data = input.data.toLowerCase();\n } else if (check2.kind === "toUpperCase") {\n input.data = input.data.toUpperCase();\n } else if (check2.kind === "startsWith") {\n if (!input.data.startsWith(check2.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_string,\n validation: { startsWith: check2.value },\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "endsWith") {\n if (!input.data.endsWith(check2.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_string,\n validation: { endsWith: check2.value },\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "datetime") {\n const regex = datetimeRegex(check2);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_string,\n validation: "datetime",\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "date") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_string,\n validation: "date",\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "time") {\n const regex = timeRegex(check2);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_string,\n validation: "time",\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "duration") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "duration",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "ip") {\n if (!isValidIP(input.data, check2.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "ip",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "jwt") {\n if (!isValidJWT2(input.data, check2.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "jwt",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "cidr") {\n if (!isValidCidr(input.data, check2.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "cidr",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "base64") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "base64",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "base64url") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: "base64url",\n code: ZodIssueCode2.invalid_string,\n message: check2.message\n });\n status.dirty();\n }\n } else {\n util.assertNever(check2);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode2.invalid_string,\n ...errorUtil.errToObj(message)\n });\n }\n _addCheck(check2) {\n return new ZodString2({\n ...this._def,\n checks: [...this._def.checks, check2]\n });\n }\n email(message) {\n return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n return this._addCheck({\n kind: "base64url",\n ...errorUtil.errToObj(message)\n });\n }\n jwt(options) {\n return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === "string") {\n return this._addCheck({\n kind: "datetime",\n precision: null,\n offset: false,\n local: false,\n message: options\n });\n }\n return this._addCheck({\n kind: "datetime",\n precision: typeof options?.precision === "undefined" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message)\n });\n }\n date(message) {\n return this._addCheck({ kind: "date", message });\n }\n time(options) {\n if (typeof options === "string") {\n return this._addCheck({\n kind: "time",\n precision: null,\n message: options\n });\n }\n return this._addCheck({\n kind: "time",\n precision: typeof options?.precision === "undefined" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message)\n });\n }\n duration(message) {\n return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: "regex",\n regex,\n ...errorUtil.errToObj(message)\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: "includes",\n value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message)\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: "startsWith",\n value,\n ...errorUtil.errToObj(message)\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: "endsWith",\n value,\n ...errorUtil.errToObj(message)\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: "min",\n value: minLength,\n ...errorUtil.errToObj(message)\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: "max",\n value: maxLength,\n ...errorUtil.errToObj(message)\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: "length",\n value: len,\n ...errorUtil.errToObj(message)\n });\n }\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString2({\n ...this._def,\n checks: [...this._def.checks, { kind: "trim" }]\n });\n }\n toLowerCase() {\n return new ZodString2({\n ...this._def,\n checks: [...this._def.checks, { kind: "toLowerCase" }]\n });\n }\n toUpperCase() {\n return new ZodString2({\n ...this._def,\n checks: [...this._def.checks, { kind: "toUpperCase" }]\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === "datetime");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === "date");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === "time");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === "duration");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === "email");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === "url");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === "emoji");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === "uuid");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === "nanoid");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === "cuid");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === "cuid2");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === "ulid");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === "ip");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === "cidr");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === "base64");\n }\n get isBase64url() {\n return !!this._def.checks.find((ch) => ch.kind === "base64url");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "min") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "max") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString2.create = (params) => {\n return new ZodString2({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params)\n });\n};\nfunction floatSafeRemainder2(val, step) {\n const valDecCount = (val.toString().split(".")[1] || "").length;\n const stepDecCount = (step.toString().split(".")[1] || "").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));\n return valInt % stepInt / 10 ** decCount;\n}\n\nclass ZodNumber2 extends ZodType2 {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.number) {\n const ctx2 = this._getOrReturnCtx(input);\n addIssueToContext(ctx2, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.number,\n received: ctx2.parsedType\n });\n return INVALID2;\n }\n let ctx = undefined;\n const status = new ParseStatus;\n for (const check2 of this._def.checks) {\n if (check2.kind === "int") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: "integer",\n received: "float",\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "min") {\n const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n minimum: check2.value,\n type: "number",\n inclusive: check2.inclusive,\n exact: false,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "max") {\n const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n maximum: check2.value,\n type: "number",\n inclusive: check2.inclusive,\n exact: false,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "multipleOf") {\n if (floatSafeRemainder2(input.data, check2.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.not_multiple_of,\n multipleOf: check2.value,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "finite") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.not_finite,\n message: check2.message\n });\n status.dirty();\n }\n } else {\n util.assertNever(check2);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit("min", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit("min", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit("max", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit("max", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber2({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message)\n }\n ]\n });\n }\n _addCheck(check2) {\n return new ZodNumber2({\n ...this._def,\n checks: [...this._def.checks, check2]\n });\n }\n int(message) {\n return this._addCheck({\n kind: "int",\n message: errorUtil.toString(message)\n });\n }\n positive(message) {\n return this._addCheck({\n kind: "min",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message)\n });\n }\n negative(message) {\n return this._addCheck({\n kind: "max",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message)\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: "max",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message)\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: "min",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message)\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: "multipleOf",\n value,\n message: errorUtil.toString(message)\n });\n }\n finite(message) {\n return this._addCheck({\n kind: "finite",\n message: errorUtil.toString(message)\n });\n }\n safe(message) {\n return this._addCheck({\n kind: "min",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message)\n })._addCheck({\n kind: "max",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message)\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "min") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "max") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {\n return true;\n } else if (ch.kind === "min") {\n if (min === null || ch.value > min)\n min = ch.value;\n } else if (ch.kind === "max") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber2.create = (params) => {\n return new ZodNumber2({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params)\n });\n};\n\nclass ZodBigInt2 extends ZodType2 {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n } catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus;\n for (const check2 of this._def.checks) {\n if (check2.kind === "min") {\n const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n type: "bigint",\n minimum: check2.value,\n inclusive: check2.inclusive,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "max") {\n const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n type: "bigint",\n maximum: check2.value,\n inclusive: check2.inclusive,\n message: check2.message\n });\n status.dirty();\n }\n } else if (check2.kind === "multipleOf") {\n if (input.data % check2.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.not_multiple_of,\n multipleOf: check2.value,\n message: check2.message\n });\n status.dirty();\n }\n } else {\n util.assertNever(check2);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n gte(value, message) {\n return this.setLimit("min", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit("min", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit("max", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit("max", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt2({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message)\n }\n ]\n });\n }\n _addCheck(check2) {\n return new ZodBigInt2({\n ...this._def,\n checks: [...this._def.checks, check2]\n });\n }\n positive(message) {\n return this._addCheck({\n kind: "min",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message)\n });\n }\n negative(message) {\n return this._addCheck({\n kind: "max",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message)\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: "max",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message)\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: "min",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message)\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: "multipleOf",\n value,\n message: errorUtil.toString(message)\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "min") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "max") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt2.create = (params) => {\n return new ZodBigInt2({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params)\n });\n};\n\nclass ZodBoolean2 extends ZodType2 {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n}\nZodBoolean2.create = (params) => {\n return new ZodBoolean2({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params)\n });\n};\n\nclass ZodDate2 extends ZodType2 {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.date) {\n const ctx2 = this._getOrReturnCtx(input);\n addIssueToContext(ctx2, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.date,\n received: ctx2.parsedType\n });\n return INVALID2;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx2 = this._getOrReturnCtx(input);\n addIssueToContext(ctx2, {\n code: ZodIssueCode2.invalid_date\n });\n return INVALID2;\n }\n const status = new ParseStatus;\n let ctx = undefined;\n for (const check2 of this._def.checks) {\n if (check2.kind === "min") {\n if (input.data.getTime() < check2.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n message: check2.message,\n inclusive: true,\n exact: false,\n minimum: check2.value,\n type: "date"\n });\n status.dirty();\n }\n } else if (check2.kind === "max") {\n if (input.data.getTime() > check2.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n message: check2.message,\n inclusive: true,\n exact: false,\n maximum: check2.value,\n type: "date"\n });\n status.dirty();\n }\n } else {\n util.assertNever(check2);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime())\n };\n }\n _addCheck(check2) {\n return new ZodDate2({\n ...this._def,\n checks: [...this._def.checks, check2]\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: "min",\n value: minDate.getTime(),\n message: errorUtil.toString(message)\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: "max",\n value: maxDate.getTime(),\n message: errorUtil.toString(message)\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "min") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === "max") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate2.create = (params) => {\n return new ZodDate2({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params)\n });\n};\n\nclass ZodSymbol2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n}\nZodSymbol2.create = (params) => {\n return new ZodSymbol2({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params)\n });\n};\n\nclass ZodUndefined2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n}\nZodUndefined2.create = (params) => {\n return new ZodUndefined2({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params)\n });\n};\n\nclass ZodNull2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n}\nZodNull2.create = (params) => {\n return new ZodNull2({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params)\n });\n};\n\nclass ZodAny2 extends ZodType2 {\n constructor() {\n super(...arguments);\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny2.create = (params) => {\n return new ZodAny2({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params)\n });\n};\n\nclass ZodUnknown2 extends ZodType2 {\n constructor() {\n super(...arguments);\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown2.create = (params) => {\n return new ZodUnknown2({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params)\n });\n};\n\nclass ZodNever2 extends ZodType2 {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n}\nZodNever2.create = (params) => {\n return new ZodNever2({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params)\n });\n};\n\nclass ZodVoid2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n}\nZodVoid2.create = (params) => {\n return new ZodVoid2({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params)\n });\n};\n\nclass ZodArray2 extends ZodType2 {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode2.too_big : ZodIssueCode2.too_small,\n minimum: tooSmall ? def.exactLength.value : undefined,\n maximum: tooBig ? def.exactLength.value : undefined,\n type: "array",\n inclusive: true,\n exact: true,\n message: def.exactLength.message\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n minimum: def.minLength.value,\n type: "array",\n inclusive: true,\n exact: false,\n message: def.minLength.message\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n maximum: def.maxLength.value,\n type: "array",\n inclusive: true,\n exact: false,\n message: def.maxLength.message\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i2) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));\n })).then((result2) => {\n return ParseStatus.mergeArray(status, result2);\n });\n }\n const result = [...ctx.data].map((item, i2) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray2({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) }\n });\n }\n max(maxLength, message) {\n return new ZodArray2({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) }\n });\n }\n length(len, message) {\n return new ZodArray2({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) }\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray2.create = (schema, params) => {\n return new ZodArray2({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params)\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject2) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional2.create(deepPartialify(fieldSchema));\n }\n return new ZodObject2({\n ...schema._def,\n shape: () => newShape\n });\n } else if (schema instanceof ZodArray2) {\n return new ZodArray2({\n ...schema._def,\n type: deepPartialify(schema.element)\n });\n } else if (schema instanceof ZodOptional2) {\n return ZodOptional2.create(deepPartialify(schema.unwrap()));\n } else if (schema instanceof ZodNullable2) {\n return ZodNullable2.create(deepPartialify(schema.unwrap()));\n } else if (schema instanceof ZodTuple2) {\n return ZodTuple2.create(schema.items.map((item) => deepPartialify(item)));\n } else {\n return schema;\n }\n}\n\nclass ZodObject2 extends ZodType2 {\n constructor() {\n super(...arguments);\n this._cached = null;\n this.nonstrict = this.passthrough;\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.object) {\n const ctx2 = this._getOrReturnCtx(input);\n addIssueToContext(ctx2, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.object,\n received: ctx2.parsedType\n });\n return INVALID2;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever2 && this._def.unknownKeys === "strip")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: "valid", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data\n });\n }\n if (this._def.catchall instanceof ZodNever2) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === "passthrough") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: "valid", value: key },\n value: { status: "valid", value: ctx.data[key] }\n });\n }\n } else if (unknownKeys === "strict") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.unrecognized_keys,\n keys: extraKeys\n });\n status.dirty();\n }\n } else if (unknownKeys === "strip") {} else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n } else {\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: "valid", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve().then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet\n });\n }\n return syncPairs;\n }).then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n } else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject2({\n ...this._def,\n unknownKeys: "strict",\n ...message !== undefined ? {\n errorMap: (issue2, ctx) => {\n const defaultError = this._def.errorMap?.(issue2, ctx).message ?? ctx.defaultError;\n if (issue2.code === "unrecognized_keys")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError\n };\n return {\n message: defaultError\n };\n }\n } : {}\n });\n }\n strip() {\n return new ZodObject2({\n ...this._def,\n unknownKeys: "strip"\n });\n }\n passthrough() {\n return new ZodObject2({\n ...this._def,\n unknownKeys: "passthrough"\n });\n }\n extend(augmentation) {\n return new ZodObject2({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation\n })\n });\n }\n merge(merging) {\n const merged = new ZodObject2({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape()\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject\n });\n return merged;\n }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n catchall(index) {\n return new ZodObject2({\n ...this._def,\n catchall: index\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject2({\n ...this._def,\n shape: () => shape\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject2({\n ...this._def,\n shape: () => shape\n });\n }\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n } else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject2({\n ...this._def,\n shape: () => newShape\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n } else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional2) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject2({\n ...this._def,\n shape: () => newShape\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject2.create = (shape, params) => {\n return new ZodObject2({\n shape: () => shape,\n unknownKeys: "strip",\n catchall: ZodNever2.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params)\n });\n};\nZodObject2.strictCreate = (shape, params) => {\n return new ZodObject2({\n shape: () => shape,\n unknownKeys: "strict",\n catchall: ZodNever2.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params)\n });\n};\nZodObject2.lazycreate = (shape, params) => {\n return new ZodObject2({\n shape,\n unknownKeys: "strip",\n catchall: ZodNever2.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params)\n });\n};\n\nclass ZodUnion2 extends ZodType2 {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n for (const result of results) {\n if (result.result.status === "valid") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === "dirty") {\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n const unionErrors = results.map((result) => new ZodError2(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_union,\n unionErrors\n });\n return INVALID2;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: []\n },\n parent: null\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx\n }),\n ctx: childCtx\n };\n })).then(handleResults);\n } else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: []\n },\n parent: null\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx\n });\n if (result.status === "valid") {\n return result;\n } else if (result.status === "dirty" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues2) => new ZodError2(issues2));\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_union,\n unionErrors\n });\n return INVALID2;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion2.create = (types, params) => {\n return new ZodUnion2({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params)\n });\n};\nvar getDiscriminator = (type) => {\n if (type instanceof ZodLazy2) {\n return getDiscriminator(type.schema);\n } else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n } else if (type instanceof ZodLiteral2) {\n return [type.value];\n } else if (type instanceof ZodEnum2) {\n return type.options;\n } else if (type instanceof ZodNativeEnum) {\n return util.objectValues(type.enum);\n } else if (type instanceof ZodDefault2) {\n return getDiscriminator(type._def.innerType);\n } else if (type instanceof ZodUndefined2) {\n return [undefined];\n } else if (type instanceof ZodNull2) {\n return [null];\n } else if (type instanceof ZodOptional2) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n } else if (type instanceof ZodNullable2) {\n return [null, ...getDiscriminator(type.unwrap())];\n } else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n } else if (type instanceof ZodReadonly2) {\n return getDiscriminator(type.unwrap());\n } else if (type instanceof ZodCatch2) {\n return getDiscriminator(type._def.innerType);\n } else {\n return [];\n }\n};\n\nclass ZodDiscriminatedUnion2 extends ZodType2 {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator]\n });\n return INVALID2;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n });\n } else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n static create(discriminator, options, params) {\n const optionsMap = new Map;\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion2({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params)\n });\n }\n}\nfunction mergeValues2(a2, b2) {\n const aType = getParsedType2(a2);\n const bType = getParsedType2(b2);\n if (a2 === b2) {\n return { valid: true, data: a2 };\n } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b2);\n const sharedKeys = util.objectKeys(a2).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a2, ...b2 };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues2(a2[key], b2[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a2.length !== b2.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0;index < a2.length; index++) {\n const itemA = a2[index];\n const itemB = b2[index];\n const sharedValue = mergeValues2(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a2 === +b2) {\n return { valid: true, data: a2 };\n } else {\n return { valid: false };\n }\n}\n\nclass ZodIntersection2 extends ZodType2 {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID2;\n }\n const merged = mergeValues2(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_intersection_types\n });\n return INVALID2;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n })\n ]).then(([left, right]) => handleParsed(left, right));\n } else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n }));\n }\n }\n}\nZodIntersection2.create = (left, right, params) => {\n return new ZodIntersection2({\n left,\n right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params)\n });\n};\n\nclass ZodTuple2 extends ZodType2 {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: "array"\n });\n return INVALID2;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: "array"\n });\n status.dirty();\n }\n const items = [...ctx.data].map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n }).filter((x2) => !!x2);\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n } else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple2({\n ...this._def,\n rest\n });\n }\n}\nZodTuple2.create = (schemas3, params) => {\n if (!Array.isArray(schemas3)) {\n throw new Error("You must pass an array of schemas to z.tuple([ ... ])");\n }\n return new ZodTuple2({\n items: schemas3,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params)\n });\n};\n\nclass ZodRecord2 extends ZodType2 {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n } else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType2) {\n return new ZodRecord2({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third)\n });\n }\n return new ZodRecord2({\n keyType: ZodString2.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second)\n });\n }\n}\n\nclass ZodMap2 extends ZodType2 {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map;\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === "aborted" || value.status === "aborted") {\n return INVALID2;\n }\n if (key.status === "dirty" || value.status === "dirty") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n } else {\n const finalMap = new Map;\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === "aborted" || value.status === "aborted") {\n return INVALID2;\n }\n if (key.status === "dirty" || value.status === "dirty") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap2.create = (keyType, valueType, params) => {\n return new ZodMap2({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params)\n });\n};\n\nclass ZodSet2 extends ZodType2 {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_small,\n minimum: def.minSize.value,\n type: "set",\n inclusive: true,\n exact: false,\n message: def.minSize.message\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.too_big,\n maximum: def.maxSize.value,\n type: "set",\n inclusive: true,\n exact: false,\n message: def.maxSize.message\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements2) {\n const parsedSet = new Set;\n for (const element of elements2) {\n if (element.status === "aborted")\n return INVALID2;\n if (element.status === "dirty")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements2) => finalizeSet(elements2));\n } else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet2({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) }\n });\n }\n max(maxSize, message) {\n return new ZodSet2({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) }\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet2.create = (valueType, params) => {\n return new ZodSet2({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params)\n });\n};\n\nclass ZodFunction extends ZodType2 {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n function makeArgsIssue(args, error38) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap2(), en_default2].filter((x2) => !!x2),\n issueData: {\n code: ZodIssueCode2.invalid_arguments,\n argumentsError: error38\n }\n });\n }\n function makeReturnsIssue(returns, error38) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap2(), en_default2].filter((x2) => !!x2),\n issueData: {\n code: ZodIssueCode2.invalid_return_type,\n returnTypeError: error38\n }\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise2) {\n const me2 = this;\n return OK(async function(...args) {\n const error38 = new ZodError2([]);\n const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e2) => {\n error38.addIssue(makeArgsIssue(args, e2));\n throw error38;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e2) => {\n error38.addIssue(makeReturnsIssue(result, e2));\n throw error38;\n });\n return parsedReturns;\n });\n } else {\n const me2 = this;\n return OK(function(...args) {\n const parsedArgs = me2._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError2([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me2._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError2([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple2.create(items).rest(ZodUnknown2.create())\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),\n returns: returns || ZodUnknown2.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params)\n });\n }\n}\n\nclass ZodLazy2 extends ZodType2 {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy2.create = (getter, params) => {\n return new ZodLazy2({\n getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params)\n });\n};\n\nclass ZodLiteral2 extends ZodType2 {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode2.invalid_literal,\n expected: this._def.value\n });\n return INVALID2;\n }\n return { status: "valid", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral2.create = (value, params) => {\n return new ZodLiteral2({\n value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params)\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum2({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params)\n });\n}\n\nclass ZodEnum2 extends ZodType2 {\n _parse(input) {\n if (typeof input.data !== "string") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode2.invalid_type\n });\n return INVALID2;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode2.invalid_enum_value,\n options: expectedValues\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum2.create(values, {\n ...this._def,\n ...newDef\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef\n });\n }\n}\nZodEnum2.create = createZodEnum;\n\nclass ZodNativeEnum extends ZodType2 {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode2.invalid_type\n });\n return INVALID2;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode2.invalid_enum_value,\n options: expectedValues\n });\n return INVALID2;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params)\n });\n};\n\nclass ZodPromise2 extends ZodType2 {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap\n });\n }));\n }\n}\nZodPromise2.create = (schema, params) => {\n return new ZodPromise2({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params)\n });\n};\n\nclass ZodEffects extends ZodType2 {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n } else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n }\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === "preprocess") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed2) => {\n if (status.value === "aborted")\n return INVALID2;\n const result = await this._def.schema._parseAsync({\n data: processed2,\n path: ctx.path,\n parent: ctx\n });\n if (result.status === "aborted")\n return INVALID2;\n if (result.status === "dirty")\n return DIRTY(result.value);\n if (status.value === "dirty")\n return DIRTY(result.value);\n return result;\n });\n } else {\n if (status.value === "aborted")\n return INVALID2;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx\n });\n if (result.status === "aborted")\n return INVALID2;\n if (result.status === "dirty")\n return DIRTY(result.value);\n if (status.value === "dirty")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === "refinement") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n });\n if (inner.status === "aborted")\n return INVALID2;\n if (inner.status === "dirty")\n status.dirty();\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n } else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === "aborted")\n return INVALID2;\n if (inner.status === "dirty")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === "transform") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n });\n if (!isValid(base))\n return INVALID2;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n } else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID2;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params)\n });\n};\nZodEffects.createWithPreprocess = (preprocess2, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: "preprocess", transform: preprocess2 },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params)\n });\n};\nclass ZodOptional2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional2.create = (type, params) => {\n return new ZodOptional2({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params)\n });\n};\n\nclass ZodNullable2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable2.create = (type, params) => {\n return new ZodNullable2({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params)\n });\n};\n\nclass ZodDefault2 extends ZodType2 {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault2.create = (type, params) => {\n return new ZodDefault2({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === "function" ? params.default : () => params.default,\n ...processCreateParams(params)\n });\n};\n\nclass ZodCatch2 extends ZodType2 {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: []\n }\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx\n }\n });\n if (isAsync(result)) {\n return result.then((result2) => {\n return {\n status: "valid",\n value: result2.status === "valid" ? result2.value : this._def.catchValue({\n get error() {\n return new ZodError2(newCtx.common.issues);\n },\n input: newCtx.data\n })\n };\n });\n } else {\n return {\n status: "valid",\n value: result.status === "valid" ? result.value : this._def.catchValue({\n get error() {\n return new ZodError2(newCtx.common.issues);\n },\n input: newCtx.data\n })\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch2.create = (type, params) => {\n return new ZodCatch2({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,\n ...processCreateParams(params)\n });\n};\n\nclass ZodNaN2 extends ZodType2 {\n _parse(input) {\n const parsedType3 = this._getType(input);\n if (parsedType3 !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode2.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType\n });\n return INVALID2;\n }\n return { status: "valid", value: input.data };\n }\n}\nZodNaN2.create = (params) => {\n return new ZodNaN2({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params)\n });\n};\nvar BRAND = Symbol("zod_brand");\n\nclass ZodBranded extends ZodType2 {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\n\nclass ZodPipeline extends ZodType2 {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n });\n if (inResult.status === "aborted")\n return INVALID2;\n if (inResult.status === "dirty") {\n status.dirty();\n return DIRTY(inResult.value);\n } else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx\n });\n }\n };\n return handleAsync();\n } else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx\n });\n if (inResult.status === "aborted")\n return INVALID2;\n if (inResult.status === "dirty") {\n status.dirty();\n return {\n status: "dirty",\n value: inResult.value\n };\n } else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx\n });\n }\n }\n }\n static create(a2, b2) {\n return new ZodPipeline({\n in: a2,\n out: b2,\n typeName: ZodFirstPartyTypeKind.ZodPipeline\n });\n }\n}\n\nclass ZodReadonly2 extends ZodType2 {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly2.create = (type, params) => {\n return new ZodReadonly2({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params)\n });\n};\nvar late = {\n object: ZodObject2.lazycreate\n};\nvar ZodFirstPartyTypeKind;\n(function(ZodFirstPartyTypeKind2) {\n ZodFirstPartyTypeKind2["ZodString"] = "ZodString";\n ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";\n ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";\n ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";\n ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";\n ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";\n ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";\n ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";\n ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";\n ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";\n ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";\n ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";\n ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";\n ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";\n ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";\n ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";\n ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";\n ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";\n ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";\n ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";\n ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";\n ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";\n ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";\n ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";\n ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";\n ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";\n ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";\n ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";\n ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";\n ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";\n ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";\n ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";\n ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";\n ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";\n ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";\n ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\nvar stringType = ZodString2.create;\nvar numberType = ZodNumber2.create;\nvar nanType = ZodNaN2.create;\nvar bigIntType = ZodBigInt2.create;\nvar booleanType = ZodBoolean2.create;\nvar dateType = ZodDate2.create;\nvar symbolType = ZodSymbol2.create;\nvar undefinedType = ZodUndefined2.create;\nvar nullType = ZodNull2.create;\nvar anyType = ZodAny2.create;\nvar unknownType = ZodUnknown2.create;\nvar neverType = ZodNever2.create;\nvar voidType = ZodVoid2.create;\nvar arrayType = ZodArray2.create;\nvar objectType = ZodObject2.create;\nvar strictObjectType = ZodObject2.strictCreate;\nvar unionType = ZodUnion2.create;\nvar discriminatedUnionType = ZodDiscriminatedUnion2.create;\nvar intersectionType = ZodIntersection2.create;\nvar tupleType = ZodTuple2.create;\nvar recordType = ZodRecord2.create;\nvar mapType = ZodMap2.create;\nvar setType = ZodSet2.create;\nvar functionType = ZodFunction.create;\nvar lazyType = ZodLazy2.create;\nvar literalType = ZodLiteral2.create;\nvar enumType = ZodEnum2.create;\nvar nativeEnumType = ZodNativeEnum.create;\nvar promiseType = ZodPromise2.create;\nvar effectsType = ZodEffects.create;\nvar optionalType = ZodOptional2.create;\nvar nullableType = ZodNullable2.create;\nvar preprocessType = ZodEffects.createWithPreprocess;\nvar pipelineType = ZodPipeline.create;\n// ../../node_modules/@ai-sdk/provider-utils/dist/index.mjs\nvar createIdGenerator = ({\n prefix,\n size = 16,\n alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",\n separator = "-"\n} = {}) => {\n const generator = () => {\n const alphabetLength = alphabet.length;\n const chars = new Array(size);\n for (let i2 = 0;i2 < size; i2++) {\n chars[i2] = alphabet[Math.random() * alphabetLength | 0];\n }\n return chars.join("");\n };\n if (prefix == null) {\n return generator;\n }\n if (alphabet.includes(separator)) {\n throw new InvalidArgumentError({\n argument: "separator",\n message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`\n });\n }\n return () => `${prefix}${separator}${generator()}`;\n};\nvar generateId = createIdGenerator();\nfunction getErrorMessage2(error38) {\n if (error38 == null) {\n return "unknown error";\n }\n if (typeof error38 === "string") {\n return error38;\n }\n if (error38 instanceof Error) {\n return error38.message;\n }\n return JSON.stringify(error38);\n}\nvar suspectProtoRx = /"__proto__"\\s*:/;\nvar suspectConstructorRx = /"constructor"\\s*:/;\nfunction _parse2(text) {\n const obj = JSON.parse(text);\n if (obj === null || typeof obj !== "object") {\n return obj;\n }\n if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {\n return obj;\n }\n return filter(obj);\n}\nfunction filter(obj) {\n let next = [obj];\n while (next.length) {\n const nodes = next;\n next = [];\n for (const node of nodes) {\n if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {\n throw new SyntaxError("Object contains forbidden prototype property");\n }\n if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {\n throw new SyntaxError("Object contains forbidden prototype property");\n }\n for (const key in node) {\n const value = node[key];\n if (value && typeof value === "object") {\n next.push(value);\n }\n }\n }\n }\n return obj;\n}\nfunction secureJsonParse(text) {\n const { stackTraceLimit } = Error;\n Error.stackTraceLimit = 0;\n try {\n return _parse2(text);\n } finally {\n Error.stackTraceLimit = stackTraceLimit;\n }\n}\nvar validatorSymbol = Symbol.for("vercel.ai.validator");\nfunction validator(validate) {\n return { [validatorSymbol]: true, validate };\n}\nfunction isValidator(value) {\n return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;\n}\nfunction asValidator(value) {\n return isValidator(value) ? value : standardSchemaValidator(value);\n}\nfunction standardSchemaValidator(standardSchema) {\n return validator(async (value) => {\n const result = await standardSchema["~standard"].validate(value);\n return result.issues == null ? { success: true, value: result.value } : {\n success: false,\n error: new TypeValidationError({\n value,\n cause: result.issues\n })\n };\n });\n}\nasync function validateTypes({\n value,\n schema\n}) {\n const result = await safeValidateTypes({ value, schema });\n if (!result.success) {\n throw TypeValidationError.wrap({ value, cause: result.error });\n }\n return result.value;\n}\nasync function safeValidateTypes({\n value,\n schema\n}) {\n const validator2 = asValidator(schema);\n try {\n if (validator2.validate == null) {\n return { success: true, value, rawValue: value };\n }\n const result = await validator2.validate(value);\n if (result.success) {\n return { success: true, value: result.value, rawValue: value };\n }\n return {\n success: false,\n error: TypeValidationError.wrap({ value, cause: result.error }),\n rawValue: value\n };\n } catch (error38) {\n return {\n success: false,\n error: TypeValidationError.wrap({ value, cause: error38 }),\n rawValue: value\n };\n }\n}\nasync function safeParseJSON({\n text,\n schema\n}) {\n try {\n const value = secureJsonParse(text);\n if (schema == null) {\n return { success: true, value, rawValue: value };\n }\n return await safeValidateTypes({ value, schema });\n } catch (error38) {\n return {\n success: false,\n error: JSONParseError.isInstance(error38) ? error38 : new JSONParseError({ text, cause: error38 }),\n rawValue: undefined\n };\n }\n}\nvar getRelativePath = (pathA, pathB) => {\n let i2 = 0;\n for (;i2 < pathA.length && i2 < pathB.length; i2++) {\n if (pathA[i2] !== pathB[i2])\n break;\n }\n return [(pathA.length - i2).toString(), ...pathB.slice(i2)].join("/");\n};\nvar ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");\nvar defaultOptions = {\n name: undefined,\n $refStrategy: "root",\n basePath: ["#"],\n effectStrategy: "input",\n pipeStrategy: "all",\n dateStrategy: "format:date-time",\n mapStrategy: "entries",\n removeAdditionalStrategy: "passthrough",\n allowedAdditionalProperties: true,\n rejectedAdditionalProperties: false,\n definitionPath: "definitions",\n strictUnions: false,\n definitions: {},\n errorMessages: false,\n patternStrategy: "escape",\n applyRegexFlags: false,\n emailStrategy: "format:email",\n base64Strategy: "contentEncoding:base64",\n nameStrategy: "ref"\n};\nvar getDefaultOptions = (options) => typeof options === "string" ? {\n ...defaultOptions,\n name: options\n} : {\n ...defaultOptions,\n ...options\n};\nfunction parseAnyDef() {\n return {};\n}\nfunction parseArrayDef(def, refs) {\n var _a15, _b, _c;\n const res = {\n type: "array"\n };\n if (((_a15 = def.type) == null ? undefined : _a15._def) && ((_c = (_b = def.type) == null ? undefined : _b._def) == null ? undefined : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {\n res.items = parseDef(def.type._def, {\n ...refs,\n currentPath: [...refs.currentPath, "items"]\n });\n }\n if (def.minLength) {\n res.minItems = def.minLength.value;\n }\n if (def.maxLength) {\n res.maxItems = def.maxLength.value;\n }\n if (def.exactLength) {\n res.minItems = def.exactLength.value;\n res.maxItems = def.exactLength.value;\n }\n return res;\n}\nfunction parseBigintDef(def) {\n const res = {\n type: "integer",\n format: "int64"\n };\n if (!def.checks)\n return res;\n for (const check2 of def.checks) {\n switch (check2.kind) {\n case "min":\n if (check2.inclusive) {\n res.minimum = check2.value;\n } else {\n res.exclusiveMinimum = check2.value;\n }\n break;\n case "max":\n if (check2.inclusive) {\n res.maximum = check2.value;\n } else {\n res.exclusiveMaximum = check2.value;\n }\n break;\n case "multipleOf":\n res.multipleOf = check2.value;\n break;\n }\n }\n return res;\n}\nfunction parseBooleanDef() {\n return { type: "boolean" };\n}\nfunction parseBrandedDef(_def, refs) {\n return parseDef(_def.type._def, refs);\n}\nvar parseCatchDef = (def, refs) => {\n return parseDef(def.innerType._def, refs);\n};\nfunction parseDateDef(def, refs, overrideDateStrategy) {\n const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;\n if (Array.isArray(strategy)) {\n return {\n anyOf: strategy.map((item, i2) => parseDateDef(def, refs, item))\n };\n }\n switch (strategy) {\n case "string":\n case "format:date-time":\n return {\n type: "string",\n format: "date-time"\n };\n case "format:date":\n return {\n type: "string",\n format: "date"\n };\n case "integer":\n return integerDateParser(def);\n }\n}\nvar integerDateParser = (def) => {\n const res = {\n type: "integer",\n format: "unix-time"\n };\n for (const check2 of def.checks) {\n switch (check2.kind) {\n case "min":\n res.minimum = check2.value;\n break;\n case "max":\n res.maximum = check2.value;\n break;\n }\n }\n return res;\n};\nfunction parseDefaultDef(_def, refs) {\n return {\n ...parseDef(_def.innerType._def, refs),\n default: _def.defaultValue()\n };\n}\nfunction parseEffectsDef(_def, refs) {\n return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef();\n}\nfunction parseEnumDef(def) {\n return {\n type: "string",\n enum: Array.from(def.values)\n };\n}\nvar isJsonSchema7AllOfType = (type) => {\n if ("type" in type && type.type === "string")\n return false;\n return "allOf" in type;\n};\nfunction parseIntersectionDef(def, refs) {\n const allOf = [\n parseDef(def.left._def, {\n ...refs,\n currentPath: [...refs.currentPath, "allOf", "0"]\n }),\n parseDef(def.right._def, {\n ...refs,\n currentPath: [...refs.currentPath, "allOf", "1"]\n })\n ].filter((x2) => !!x2);\n const mergedAllOf = [];\n allOf.forEach((schema) => {\n if (isJsonSchema7AllOfType(schema)) {\n mergedAllOf.push(...schema.allOf);\n } else {\n let nestedSchema = schema;\n if ("additionalProperties" in schema && schema.additionalProperties === false) {\n const { additionalProperties, ...rest } = schema;\n nestedSchema = rest;\n }\n mergedAllOf.push(nestedSchema);\n }\n });\n return mergedAllOf.length ? { allOf: mergedAllOf } : undefined;\n}\nfunction parseLiteralDef(def) {\n const parsedType3 = typeof def.value;\n if (parsedType3 !== "bigint" && parsedType3 !== "number" && parsedType3 !== "boolean" && parsedType3 !== "string") {\n return {\n type: Array.isArray(def.value) ? "array" : "object"\n };\n }\n return {\n type: parsedType3 === "bigint" ? "integer" : parsedType3,\n const: def.value\n };\n}\nvar emojiRegex2 = undefined;\nvar zodPatterns = {\n cuid: /^[cC][^\\s-]{8,}$/,\n cuid2: /^[0-9a-z]+$/,\n ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,\n email: /^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_\'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,\n emoji: () => {\n if (emojiRegex2 === undefined) {\n emojiRegex2 = RegExp("^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$", "u");\n }\n return emojiRegex2;\n },\n uuid: /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,\n ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,\n ipv4Cidr: /^(?:(?: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])\\/(3[0-2]|[12]?[0-9])$/,\n ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,\n ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,\n base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,\n base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,\n nanoid: /^[a-zA-Z0-9_-]{21}$/,\n jwt: /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/\n};\nfunction parseStringDef(def, refs) {\n const res = {\n type: "string"\n };\n if (def.checks) {\n for (const check2 of def.checks) {\n switch (check2.kind) {\n case "min":\n res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check2.value) : check2.value;\n break;\n case "max":\n res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check2.value) : check2.value;\n break;\n case "email":\n switch (refs.emailStrategy) {\n case "format:email":\n addFormat(res, "email", check2.message, refs);\n break;\n case "format:idn-email":\n addFormat(res, "idn-email", check2.message, refs);\n break;\n case "pattern:zod":\n addPattern(res, zodPatterns.email, check2.message, refs);\n break;\n }\n break;\n case "url":\n addFormat(res, "uri", check2.message, refs);\n break;\n case "uuid":\n addFormat(res, "uuid", check2.message, refs);\n break;\n case "regex":\n addPattern(res, check2.regex, check2.message, refs);\n break;\n case "cuid":\n addPattern(res, zodPatterns.cuid, check2.message, refs);\n break;\n case "cuid2":\n addPattern(res, zodPatterns.cuid2, check2.message, refs);\n break;\n case "startsWith":\n addPattern(res, RegExp(`^${escapeLiteralCheckValue(check2.value, refs)}`), check2.message, refs);\n break;\n case "endsWith":\n addPattern(res, RegExp(`${escapeLiteralCheckValue(check2.value, refs)}$`), check2.message, refs);\n break;\n case "datetime":\n addFormat(res, "date-time", check2.message, refs);\n break;\n case "date":\n addFormat(res, "date", check2.message, refs);\n break;\n case "time":\n addFormat(res, "time", check2.message, refs);\n break;\n case "duration":\n addFormat(res, "duration", check2.message, refs);\n break;\n case "length":\n res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check2.value) : check2.value;\n res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check2.value) : check2.value;\n break;\n case "includes": {\n addPattern(res, RegExp(escapeLiteralCheckValue(check2.value, refs)), check2.message, refs);\n break;\n }\n case "ip": {\n if (check2.version !== "v6") {\n addFormat(res, "ipv4", check2.message, refs);\n }\n if (check2.version !== "v4") {\n addFormat(res, "ipv6", check2.message, refs);\n }\n break;\n }\n case "base64url":\n addPattern(res, zodPatterns.base64url, check2.message, refs);\n break;\n case "jwt":\n addPattern(res, zodPatterns.jwt, check2.message, refs);\n break;\n case "cidr": {\n if (check2.version !== "v6") {\n addPattern(res, zodPatterns.ipv4Cidr, check2.message, refs);\n }\n if (check2.version !== "v4") {\n addPattern(res, zodPatterns.ipv6Cidr, check2.message, refs);\n }\n break;\n }\n case "emoji":\n addPattern(res, zodPatterns.emoji(), check2.message, refs);\n break;\n case "ulid": {\n addPattern(res, zodPatterns.ulid, check2.message, refs);\n break;\n }\n case "base64": {\n switch (refs.base64Strategy) {\n case "format:binary": {\n addFormat(res, "binary", check2.message, refs);\n break;\n }\n case "contentEncoding:base64": {\n res.contentEncoding = "base64";\n break;\n }\n case "pattern:zod": {\n addPattern(res, zodPatterns.base64, check2.message, refs);\n break;\n }\n }\n break;\n }\n case "nanoid": {\n addPattern(res, zodPatterns.nanoid, check2.message, refs);\n }\n case "toLowerCase":\n case "toUpperCase":\n case "trim":\n break;\n default:\n }\n }\n }\n return res;\n}\nfunction escapeLiteralCheckValue(literal2, refs) {\n return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal2) : literal2;\n}\nvar ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");\nfunction escapeNonAlphaNumeric(source) {\n let result = "";\n for (let i2 = 0;i2 < source.length; i2++) {\n if (!ALPHA_NUMERIC.has(source[i2])) {\n result += "\\\\";\n }\n result += source[i2];\n }\n return result;\n}\nfunction addFormat(schema, value, message, refs) {\n var _a15;\n if (schema.format || ((_a15 = schema.anyOf) == null ? undefined : _a15.some((x2) => x2.format))) {\n if (!schema.anyOf) {\n schema.anyOf = [];\n }\n if (schema.format) {\n schema.anyOf.push({\n format: schema.format\n });\n delete schema.format;\n }\n schema.anyOf.push({\n format: value,\n ...message && refs.errorMessages && { errorMessage: { format: message } }\n });\n } else {\n schema.format = value;\n }\n}\nfunction addPattern(schema, regex, message, refs) {\n var _a15;\n if (schema.pattern || ((_a15 = schema.allOf) == null ? undefined : _a15.some((x2) => x2.pattern))) {\n if (!schema.allOf) {\n schema.allOf = [];\n }\n if (schema.pattern) {\n schema.allOf.push({\n pattern: schema.pattern\n });\n delete schema.pattern;\n }\n schema.allOf.push({\n pattern: stringifyRegExpWithFlags(regex, refs),\n ...message && refs.errorMessages && { errorMessage: { pattern: message } }\n });\n } else {\n schema.pattern = stringifyRegExpWithFlags(regex, refs);\n }\n}\nfunction stringifyRegExpWithFlags(regex, refs) {\n var _a15;\n if (!refs.applyRegexFlags || !regex.flags) {\n return regex.source;\n }\n const flags = {\n i: regex.flags.includes("i"),\n m: regex.flags.includes("m"),\n s: regex.flags.includes("s")\n };\n const source = flags.i ? regex.source.toLowerCase() : regex.source;\n let pattern = "";\n let isEscaped = false;\n let inCharGroup = false;\n let inCharRange = false;\n for (let i2 = 0;i2 < source.length; i2++) {\n if (isEscaped) {\n pattern += source[i2];\n isEscaped = false;\n continue;\n }\n if (flags.i) {\n if (inCharGroup) {\n if (source[i2].match(/[a-z]/)) {\n if (inCharRange) {\n pattern += source[i2];\n pattern += `${source[i2 - 2]}-${source[i2]}`.toUpperCase();\n inCharRange = false;\n } else if (source[i2 + 1] === "-" && ((_a15 = source[i2 + 2]) == null ? undefined : _a15.match(/[a-z]/))) {\n pattern += source[i2];\n inCharRange = true;\n } else {\n pattern += `${source[i2]}${source[i2].toUpperCase()}`;\n }\n continue;\n }\n } else if (source[i2].match(/[a-z]/)) {\n pattern += `[${source[i2]}${source[i2].toUpperCase()}]`;\n continue;\n }\n }\n if (flags.m) {\n if (source[i2] === "^") {\n pattern += `(^|(?<=[\\r\n]))`;\n continue;\n } else if (source[i2] === "$") {\n pattern += `($|(?=[\\r\n]))`;\n continue;\n }\n }\n if (flags.s && source[i2] === ".") {\n pattern += inCharGroup ? `${source[i2]}\\r\n` : `[${source[i2]}\\r\n]`;\n continue;\n }\n pattern += source[i2];\n if (source[i2] === "\\\\") {\n isEscaped = true;\n } else if (inCharGroup && source[i2] === "]") {\n inCharGroup = false;\n } else if (!inCharGroup && source[i2] === "[") {\n inCharGroup = true;\n }\n }\n try {\n new RegExp(pattern);\n } catch (e2) {\n console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);\n return regex.source;\n }\n return pattern;\n}\nfunction parseRecordDef(def, refs) {\n var _a15, _b, _c, _d, _e2, _f;\n const schema = {\n type: "object",\n additionalProperties: (_a15 = parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, "additionalProperties"]\n })) != null ? _a15 : refs.allowedAdditionalProperties\n };\n if (((_b = def.keyType) == null ? undefined : _b._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? undefined : _c.length)) {\n const { type, ...keyType } = parseStringDef(def.keyType._def, refs);\n return {\n ...schema,\n propertyNames: keyType\n };\n } else if (((_d = def.keyType) == null ? undefined : _d._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {\n return {\n ...schema,\n propertyNames: {\n enum: def.keyType._def.values\n }\n };\n } else if (((_e2 = def.keyType) == null ? undefined : _e2._def.typeName) === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? undefined : _f.length)) {\n const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);\n return {\n ...schema,\n propertyNames: keyType\n };\n }\n return schema;\n}\nfunction parseMapDef(def, refs) {\n if (refs.mapStrategy === "record") {\n return parseRecordDef(def, refs);\n }\n const keys = parseDef(def.keyType._def, {\n ...refs,\n currentPath: [...refs.currentPath, "items", "items", "0"]\n }) || parseAnyDef();\n const values = parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, "items", "items", "1"]\n }) || parseAnyDef();\n return {\n type: "array",\n maxItems: 125,\n items: {\n type: "array",\n items: [keys, values],\n minItems: 2,\n maxItems: 2\n }\n };\n}\nfunction parseNativeEnumDef(def) {\n const object2 = def.values;\n const actualKeys = Object.keys(def.values).filter((key) => {\n return typeof object2[object2[key]] !== "number";\n });\n const actualValues = actualKeys.map((key) => object2[key]);\n const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));\n return {\n type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],\n enum: actualValues\n };\n}\nfunction parseNeverDef() {\n return { not: parseAnyDef() };\n}\nfunction parseNullDef() {\n return {\n type: "null"\n };\n}\nvar primitiveMappings = {\n ZodString: "string",\n ZodNumber: "number",\n ZodBigInt: "integer",\n ZodBoolean: "boolean",\n ZodNull: "null"\n};\nfunction parseUnionDef(def, refs) {\n const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;\n if (options.every((x2) => (x2._def.typeName in primitiveMappings) && (!x2._def.checks || !x2._def.checks.length))) {\n const types = options.reduce((types2, x2) => {\n const type = primitiveMappings[x2._def.typeName];\n return type && !types2.includes(type) ? [...types2, type] : types2;\n }, []);\n return {\n type: types.length > 1 ? types : types[0]\n };\n } else if (options.every((x2) => x2._def.typeName === "ZodLiteral" && !x2.description)) {\n const types = options.reduce((acc, x2) => {\n const type = typeof x2._def.value;\n switch (type) {\n case "string":\n case "number":\n case "boolean":\n return [...acc, type];\n case "bigint":\n return [...acc, "integer"];\n case "object":\n if (x2._def.value === null)\n return [...acc, "null"];\n case "symbol":\n case "undefined":\n case "function":\n default:\n return acc;\n }\n }, []);\n if (types.length === options.length) {\n const uniqueTypes = types.filter((x2, i2, a2) => a2.indexOf(x2) === i2);\n return {\n type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],\n enum: options.reduce((acc, x2) => {\n return acc.includes(x2._def.value) ? acc : [...acc, x2._def.value];\n }, [])\n };\n }\n } else if (options.every((x2) => x2._def.typeName === "ZodEnum")) {\n return {\n type: "string",\n enum: options.reduce((acc, x2) => [\n ...acc,\n ...x2._def.values.filter((x22) => !acc.includes(x22))\n ], [])\n };\n }\n return asAnyOf(def, refs);\n}\nvar asAnyOf = (def, refs) => {\n const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x2, i2) => parseDef(x2._def, {\n ...refs,\n currentPath: [...refs.currentPath, "anyOf", `${i2}`]\n })).filter((x2) => !!x2 && (!refs.strictUnions || typeof x2 === "object" && Object.keys(x2).length > 0));\n return anyOf.length ? { anyOf } : undefined;\n};\nfunction parseNullableDef(def, refs) {\n if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {\n return {\n type: [\n primitiveMappings[def.innerType._def.typeName],\n "null"\n ]\n };\n }\n const base = parseDef(def.innerType._def, {\n ...refs,\n currentPath: [...refs.currentPath, "anyOf", "0"]\n });\n return base && { anyOf: [base, { type: "null" }] };\n}\nfunction parseNumberDef(def) {\n const res = {\n type: "number"\n };\n if (!def.checks)\n return res;\n for (const check2 of def.checks) {\n switch (check2.kind) {\n case "int":\n res.type = "integer";\n break;\n case "min":\n if (check2.inclusive) {\n res.minimum = check2.value;\n } else {\n res.exclusiveMinimum = check2.value;\n }\n break;\n case "max":\n if (check2.inclusive) {\n res.maximum = check2.value;\n } else {\n res.exclusiveMaximum = check2.value;\n }\n break;\n case "multipleOf":\n res.multipleOf = check2.value;\n break;\n }\n }\n return res;\n}\nfunction parseObjectDef(def, refs) {\n const result = {\n type: "object",\n properties: {}\n };\n const required2 = [];\n const shape = def.shape();\n for (const propName in shape) {\n let propDef = shape[propName];\n if (propDef === undefined || propDef._def === undefined) {\n continue;\n }\n const propOptional = safeIsOptional(propDef);\n const parsedDef = parseDef(propDef._def, {\n ...refs,\n currentPath: [...refs.currentPath, "properties", propName],\n propertyPath: [...refs.currentPath, "properties", propName]\n });\n if (parsedDef === undefined) {\n continue;\n }\n result.properties[propName] = parsedDef;\n if (!propOptional) {\n required2.push(propName);\n }\n }\n if (required2.length) {\n result.required = required2;\n }\n const additionalProperties = decideAdditionalProperties(def, refs);\n if (additionalProperties !== undefined) {\n result.additionalProperties = additionalProperties;\n }\n return result;\n}\nfunction decideAdditionalProperties(def, refs) {\n if (def.catchall._def.typeName !== "ZodNever") {\n return parseDef(def.catchall._def, {\n ...refs,\n currentPath: [...refs.currentPath, "additionalProperties"]\n });\n }\n switch (def.unknownKeys) {\n case "passthrough":\n return refs.allowedAdditionalProperties;\n case "strict":\n return refs.rejectedAdditionalProperties;\n case "strip":\n return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;\n }\n}\nfunction safeIsOptional(schema) {\n try {\n return schema.isOptional();\n } catch (e2) {\n return true;\n }\n}\nvar parseOptionalDef = (def, refs) => {\n var _a15;\n if (refs.currentPath.toString() === ((_a15 = refs.propertyPath) == null ? undefined : _a15.toString())) {\n return parseDef(def.innerType._def, refs);\n }\n const innerSchema = parseDef(def.innerType._def, {\n ...refs,\n currentPath: [...refs.currentPath, "anyOf", "1"]\n });\n return innerSchema ? { anyOf: [{ not: parseAnyDef() }, innerSchema] } : parseAnyDef();\n};\nvar parsePipelineDef = (def, refs) => {\n if (refs.pipeStrategy === "input") {\n return parseDef(def.in._def, refs);\n } else if (refs.pipeStrategy === "output") {\n return parseDef(def.out._def, refs);\n }\n const a2 = parseDef(def.in._def, {\n ...refs,\n currentPath: [...refs.currentPath, "allOf", "0"]\n });\n const b2 = parseDef(def.out._def, {\n ...refs,\n currentPath: [...refs.currentPath, "allOf", a2 ? "1" : "0"]\n });\n return {\n allOf: [a2, b2].filter((x2) => x2 !== undefined)\n };\n};\nfunction parsePromiseDef(def, refs) {\n return parseDef(def.type._def, refs);\n}\nfunction parseSetDef(def, refs) {\n const items = parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, "items"]\n });\n const schema = {\n type: "array",\n uniqueItems: true,\n items\n };\n if (def.minSize) {\n schema.minItems = def.minSize.value;\n }\n if (def.maxSize) {\n schema.maxItems = def.maxSize.value;\n }\n return schema;\n}\nfunction parseTupleDef(def, refs) {\n if (def.rest) {\n return {\n type: "array",\n minItems: def.items.length,\n items: def.items.map((x2, i2) => parseDef(x2._def, {\n ...refs,\n currentPath: [...refs.currentPath, "items", `${i2}`]\n })).reduce((acc, x2) => x2 === undefined ? acc : [...acc, x2], []),\n additionalItems: parseDef(def.rest._def, {\n ...refs,\n currentPath: [...refs.currentPath, "additionalItems"]\n })\n };\n } else {\n return {\n type: "array",\n minItems: def.items.length,\n maxItems: def.items.length,\n items: def.items.map((x2, i2) => parseDef(x2._def, {\n ...refs,\n currentPath: [...refs.currentPath, "items", `${i2}`]\n })).reduce((acc, x2) => x2 === undefined ? acc : [...acc, x2], [])\n };\n }\n}\nfunction parseUndefinedDef() {\n return {\n not: parseAnyDef()\n };\n}\nfunction parseUnknownDef() {\n return parseAnyDef();\n}\nvar parseReadonlyDef = (def, refs) => {\n return parseDef(def.innerType._def, refs);\n};\nvar selectParser = (def, typeName, refs) => {\n switch (typeName) {\n case ZodFirstPartyTypeKind.ZodString:\n return parseStringDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNumber:\n return parseNumberDef(def);\n case ZodFirstPartyTypeKind.ZodObject:\n return parseObjectDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBigInt:\n return parseBigintDef(def);\n case ZodFirstPartyTypeKind.ZodBoolean:\n return parseBooleanDef();\n case ZodFirstPartyTypeKind.ZodDate:\n return parseDateDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUndefined:\n return parseUndefinedDef();\n case ZodFirstPartyTypeKind.ZodNull:\n return parseNullDef();\n case ZodFirstPartyTypeKind.ZodArray:\n return parseArrayDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUnion:\n case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:\n return parseUnionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodIntersection:\n return parseIntersectionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodTuple:\n return parseTupleDef(def, refs);\n case ZodFirstPartyTypeKind.ZodRecord:\n return parseRecordDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLiteral:\n return parseLiteralDef(def);\n case ZodFirstPartyTypeKind.ZodEnum:\n return parseEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNativeEnum:\n return parseNativeEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNullable:\n return parseNullableDef(def, refs);\n case ZodFirstPartyTypeKind.ZodOptional:\n return parseOptionalDef(def, refs);\n case ZodFirstPartyTypeKind.ZodMap:\n return parseMapDef(def, refs);\n case ZodFirstPartyTypeKind.ZodSet:\n return parseSetDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLazy:\n return () => def.getter()._def;\n case ZodFirstPartyTypeKind.ZodPromise:\n return parsePromiseDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNaN:\n case ZodFirstPartyTypeKind.ZodNever:\n return parseNeverDef();\n case ZodFirstPartyTypeKind.ZodEffects:\n return parseEffectsDef(def, refs);\n case ZodFirstPartyTypeKind.ZodAny:\n return parseAnyDef();\n case ZodFirstPartyTypeKind.ZodUnknown:\n return parseUnknownDef();\n case ZodFirstPartyTypeKind.ZodDefault:\n return parseDefaultDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBranded:\n return parseBrandedDef(def, refs);\n case ZodFirstPartyTypeKind.ZodReadonly:\n return parseReadonlyDef(def, refs);\n case ZodFirstPartyTypeKind.ZodCatch:\n return parseCatchDef(def, refs);\n case ZodFirstPartyTypeKind.ZodPipeline:\n return parsePipelineDef(def, refs);\n case ZodFirstPartyTypeKind.ZodFunction:\n case ZodFirstPartyTypeKind.ZodVoid:\n case ZodFirstPartyTypeKind.ZodSymbol:\n return;\n default:\n return /* @__PURE__ */ ((_3) => {\n return;\n })(typeName);\n }\n};\nfunction parseDef(def, refs, forceResolution = false) {\n var _a15;\n const seenItem = refs.seen.get(def);\n if (refs.override) {\n const overrideResult = (_a15 = refs.override) == null ? undefined : _a15.call(refs, def, refs, seenItem, forceResolution);\n if (overrideResult !== ignoreOverride) {\n return overrideResult;\n }\n }\n if (seenItem && !forceResolution) {\n const seenSchema = get$ref(seenItem, refs);\n if (seenSchema !== undefined) {\n return seenSchema;\n }\n }\n const newItem = { def, path: refs.currentPath, jsonSchema: undefined };\n refs.seen.set(def, newItem);\n const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);\n const jsonSchema2 = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;\n if (jsonSchema2) {\n addMeta(def, refs, jsonSchema2);\n }\n if (refs.postProcess) {\n const postProcessResult = refs.postProcess(jsonSchema2, def, refs);\n newItem.jsonSchema = jsonSchema2;\n return postProcessResult;\n }\n newItem.jsonSchema = jsonSchema2;\n return jsonSchema2;\n}\nvar get$ref = (item, refs) => {\n switch (refs.$refStrategy) {\n case "root":\n return { $ref: item.path.join("/") };\n case "relative":\n return { $ref: getRelativePath(refs.currentPath, item.path) };\n case "none":\n case "seen": {\n if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {\n console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);\n return parseAnyDef();\n }\n return refs.$refStrategy === "seen" ? parseAnyDef() : undefined;\n }\n }\n};\nvar addMeta = (def, refs, jsonSchema2) => {\n if (def.description) {\n jsonSchema2.description = def.description;\n }\n return jsonSchema2;\n};\nvar getRefs = (options) => {\n const _options = getDefaultOptions(options);\n const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;\n return {\n ..._options,\n currentPath,\n propertyPath: undefined,\n seen: new Map(Object.entries(_options.definitions).map(([name14, def]) => [\n def._def,\n {\n def: def._def,\n path: [..._options.basePath, _options.definitionPath, name14],\n jsonSchema: undefined\n }\n ]))\n };\n};\nvar zodToJsonSchema = (schema, options) => {\n var _a15;\n const refs = getRefs(options);\n let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name22, schema2]) => {\n var _a22;\n return {\n ...acc,\n [name22]: (_a22 = parseDef(schema2._def, {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name22]\n }, true)) != null ? _a22 : parseAnyDef()\n };\n }, {}) : undefined;\n const name14 = typeof options === "string" ? options : (options == null ? undefined : options.nameStrategy) === "title" ? undefined : options == null ? undefined : options.name;\n const main = (_a15 = parseDef(schema._def, name14 === undefined ? refs : {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name14]\n }, false)) != null ? _a15 : parseAnyDef();\n const title = typeof options === "object" && options.name !== undefined && options.nameStrategy === "title" ? options.name : undefined;\n if (title !== undefined) {\n main.title = title;\n }\n const combined = name14 === undefined ? definitions ? {\n ...main,\n [refs.definitionPath]: definitions\n } : main : {\n $ref: [\n ...refs.$refStrategy === "relative" ? [] : refs.basePath,\n refs.definitionPath,\n name14\n ].join("/"),\n [refs.definitionPath]: {\n ...definitions,\n [name14]: main\n }\n };\n combined.$schema = "http://json-schema.org/draft-07/schema#";\n return combined;\n};\nvar zod_to_json_schema_default = zodToJsonSchema;\nfunction zod3Schema(zodSchema2, options) {\n var _a15;\n const useReferences = (_a15 = options == null ? undefined : options.useReferences) != null ? _a15 : false;\n return jsonSchema(zod_to_json_schema_default(zodSchema2, {\n $refStrategy: useReferences ? "root" : "none"\n }), {\n validate: async (value) => {\n const result = await zodSchema2.safeParseAsync(value);\n return result.success ? { success: true, value: result.data } : { success: false, error: result.error };\n }\n });\n}\nfunction zod4Schema(zodSchema2, options) {\n var _a15;\n const useReferences = (_a15 = options == null ? undefined : options.useReferences) != null ? _a15 : false;\n const z4JSONSchema = toJSONSchema(zodSchema2, {\n target: "draft-7",\n io: "output",\n reused: useReferences ? "ref" : "inline"\n });\n return jsonSchema(z4JSONSchema, {\n validate: async (value) => {\n const result = await safeParseAsync2(zodSchema2, value);\n return result.success ? { success: true, value: result.data } : { success: false, error: result.error };\n }\n });\n}\nfunction isZod4Schema(zodSchema2) {\n return "_zod" in zodSchema2;\n}\nfunction zodSchema(zodSchema2, options) {\n if (isZod4Schema(zodSchema2)) {\n return zod4Schema(zodSchema2, options);\n } else {\n return zod3Schema(zodSchema2, options);\n }\n}\nvar schemaSymbol = Symbol.for("vercel.ai.schema");\nfunction jsonSchema(jsonSchema2, {\n validate\n} = {}) {\n return {\n [schemaSymbol]: true,\n _type: undefined,\n [validatorSymbol]: true,\n jsonSchema: jsonSchema2,\n validate\n };\n}\nfunction isSchema(value) {\n return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;\n}\nfunction asSchema(schema) {\n return schema == null ? jsonSchema({\n properties: {},\n additionalProperties: false\n }) : isSchema(schema) ? schema : zodSchema(schema);\n}\n\n// ../../node_modules/ai/dist/index.mjs\nvar __defProp2 = Object.defineProperty;\nvar __export2 = (target, all) => {\n for (var name17 in all)\n __defProp2(target, name17, { get: all[name17], enumerable: true });\n};\nvar name14 = "AI_NoOutputSpecifiedError";\nvar marker15 = `vercel.ai.error.${name14}`;\nvar symbol17 = Symbol.for(marker15);\nvar _a15;\n_a15 = symbol17;\nvar name22 = "AI_InvalidArgumentError";\nvar marker22 = `vercel.ai.error.${name22}`;\nvar symbol22 = Symbol.for(marker22);\nvar _a22;\n_a22 = symbol22;\nvar name32 = "AI_InvalidStreamPartError";\nvar marker32 = `vercel.ai.error.${name32}`;\nvar symbol32 = Symbol.for(marker32);\nvar _a32;\n_a32 = symbol32;\nvar name42 = "AI_InvalidToolInputError";\nvar marker42 = `vercel.ai.error.${name42}`;\nvar symbol42 = Symbol.for(marker42);\nvar _a42;\n_a42 = symbol42;\nvar name52 = "AI_MCPClientError";\nvar marker52 = `vercel.ai.error.${name52}`;\nvar symbol52 = Symbol.for(marker52);\nvar _a52;\n_a52 = symbol52;\nvar name62 = "AI_NoImageGeneratedError";\nvar marker62 = `vercel.ai.error.${name62}`;\nvar symbol62 = Symbol.for(marker62);\nvar _a62;\n_a62 = symbol62;\nvar name72 = "AI_NoObjectGeneratedError";\nvar marker72 = `vercel.ai.error.${name72}`;\nvar symbol72 = Symbol.for(marker72);\nvar _a72;\nvar NoObjectGeneratedError = class extends AISDKError {\n constructor({\n message = "No object generated.",\n cause,\n text: text2,\n response,\n usage,\n finishReason\n }) {\n super({ name: name72, message, cause });\n this[_a72] = true;\n this.text = text2;\n this.response = response;\n this.usage = usage;\n this.finishReason = finishReason;\n }\n static isInstance(error38) {\n return AISDKError.hasMarker(error38, marker72);\n }\n};\n_a72 = symbol72;\nvar name82 = "AI_NoOutputGeneratedError";\nvar marker82 = `vercel.ai.error.${name82}`;\nvar symbol82 = Symbol.for(marker82);\nvar _a82;\n_a82 = symbol82;\nvar name92 = "AI_NoSuchToolError";\nvar marker92 = `vercel.ai.error.${name92}`;\nvar symbol92 = Symbol.for(marker92);\nvar _a92;\n_a92 = symbol92;\nvar name102 = "AI_ToolCallRepairError";\nvar marker102 = `vercel.ai.error.${name102}`;\nvar symbol102 = Symbol.for(marker102);\nvar _a102;\n_a102 = symbol102;\nvar name112 = "AI_InvalidDataContentError";\nvar marker112 = `vercel.ai.error.${name112}`;\nvar symbol112 = Symbol.for(marker112);\nvar _a112;\n_a112 = symbol112;\nvar name122 = "AI_InvalidMessageRoleError";\nvar marker122 = `vercel.ai.error.${name122}`;\nvar symbol122 = Symbol.for(marker122);\nvar _a122;\n_a122 = symbol122;\nvar name132 = "AI_MessageConversionError";\nvar marker132 = `vercel.ai.error.${name132}`;\nvar symbol132 = Symbol.for(marker132);\nvar _a132;\nvar MessageConversionError = class extends AISDKError {\n constructor({\n originalMessage,\n message\n }) {\n super({ name: name132, message });\n this[_a132] = true;\n this.originalMessage = originalMessage;\n }\n static isInstance(error38) {\n return AISDKError.hasMarker(error38, marker132);\n }\n};\n_a132 = symbol132;\nvar name142 = "AI_DownloadError";\nvar marker142 = `vercel.ai.error.${name142}`;\nvar symbol142 = Symbol.for(marker142);\nvar _a142;\n_a142 = symbol142;\nvar name15 = "AI_RetryError";\nvar marker152 = `vercel.ai.error.${name15}`;\nvar symbol152 = Symbol.for(marker152);\nvar _a152;\n_a152 = symbol152;\nvar dataContentSchema = exports_external.union([\n exports_external.string(),\n exports_external.instanceof(Uint8Array),\n exports_external.instanceof(ArrayBuffer),\n exports_external.custom((value) => {\n var _a17, _b;\n return (_b = (_a17 = globalThis.Buffer) == null ? undefined : _a17.isBuffer(value)) != null ? _b : false;\n }, { message: "Must be a Buffer" })\n]);\nvar jsonValueSchema = exports_external.lazy(() => exports_external.union([\n exports_external.null(),\n exports_external.string(),\n exports_external.number(),\n exports_external.boolean(),\n exports_external.record(exports_external.string(), jsonValueSchema),\n exports_external.array(jsonValueSchema)\n]));\nvar providerMetadataSchema = exports_external.record(exports_external.string(), exports_external.record(exports_external.string(), jsonValueSchema));\nvar textPartSchema = exports_external.object({\n type: exports_external.literal("text"),\n text: exports_external.string(),\n providerOptions: providerMetadataSchema.optional()\n});\nvar imagePartSchema = exports_external.object({\n type: exports_external.literal("image"),\n image: exports_external.union([dataContentSchema, exports_external.instanceof(URL)]),\n mediaType: exports_external.string().optional(),\n providerOptions: providerMetadataSchema.optional()\n});\nvar filePartSchema = exports_external.object({\n type: exports_external.literal("file"),\n data: exports_external.union([dataContentSchema, exports_external.instanceof(URL)]),\n filename: exports_external.string().optional(),\n mediaType: exports_external.string(),\n providerOptions: providerMetadataSchema.optional()\n});\nvar reasoningPartSchema = exports_external.object({\n type: exports_external.literal("reasoning"),\n text: exports_external.string(),\n providerOptions: providerMetadataSchema.optional()\n});\nvar toolCallPartSchema = exports_external.object({\n type: exports_external.literal("tool-call"),\n toolCallId: exports_external.string(),\n toolName: exports_external.string(),\n input: exports_external.unknown(),\n providerOptions: providerMetadataSchema.optional(),\n providerExecuted: exports_external.boolean().optional()\n});\nvar outputSchema = exports_external.discriminatedUnion("type", [\n exports_external.object({\n type: exports_external.literal("text"),\n value: exports_external.string()\n }),\n exports_external.object({\n type: exports_external.literal("json"),\n value: jsonValueSchema\n }),\n exports_external.object({\n type: exports_external.literal("error-text"),\n value: exports_external.string()\n }),\n exports_external.object({\n type: exports_external.literal("error-json"),\n value: jsonValueSchema\n }),\n exports_external.object({\n type: exports_external.literal("content"),\n value: exports_external.array(exports_external.union([\n exports_external.object({\n type: exports_external.literal("text"),\n text: exports_external.string()\n }),\n exports_external.object({\n type: exports_external.literal("media"),\n data: exports_external.string(),\n mediaType: exports_external.string()\n })\n ]))\n })\n]);\nvar toolResultPartSchema = exports_external.object({\n type: exports_external.literal("tool-result"),\n toolCallId: exports_external.string(),\n toolName: exports_external.string(),\n output: outputSchema,\n providerOptions: providerMetadataSchema.optional()\n});\nvar systemModelMessageSchema = exports_external.object({\n role: exports_external.literal("system"),\n content: exports_external.string(),\n providerOptions: providerMetadataSchema.optional()\n});\nvar userModelMessageSchema = exports_external.object({\n role: exports_external.literal("user"),\n content: exports_external.union([\n exports_external.string(),\n exports_external.array(exports_external.union([textPartSchema, imagePartSchema, filePartSchema]))\n ]),\n providerOptions: providerMetadataSchema.optional()\n});\nvar assistantModelMessageSchema = exports_external.object({\n role: exports_external.literal("assistant"),\n content: exports_external.union([\n exports_external.string(),\n exports_external.array(exports_external.union([\n textPartSchema,\n filePartSchema,\n reasoningPartSchema,\n toolCallPartSchema,\n toolResultPartSchema\n ]))\n ]),\n providerOptions: providerMetadataSchema.optional()\n});\nvar toolModelMessageSchema = exports_external.object({\n role: exports_external.literal("tool"),\n content: exports_external.array(toolResultPartSchema),\n providerOptions: providerMetadataSchema.optional()\n});\nvar modelMessageSchema = exports_external.union([\n systemModelMessageSchema,\n userModelMessageSchema,\n assistantModelMessageSchema,\n toolModelMessageSchema\n]);\nfunction createToolModelOutput({\n output,\n tool: tool3,\n errorMode\n}) {\n if (errorMode === "text") {\n return { type: "error-text", value: getErrorMessage(output) };\n } else if (errorMode === "json") {\n return { type: "error-json", value: toJSONValue(output) };\n }\n if (tool3 == null ? undefined : tool3.toModelOutput) {\n return tool3.toModelOutput(output);\n }\n return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };\n}\nfunction toJSONValue(value) {\n return value === undefined ? null : value;\n}\nvar originalGenerateId = createIdGenerator({\n prefix: "aitxt",\n size: 24\n});\nvar JsonToSseTransformStream = class extends TransformStream {\n constructor() {\n super({\n transform(part, controller) {\n controller.enqueue(`data: ${JSON.stringify(part)}\n\n`);\n },\n flush(controller) {\n controller.enqueue(`data: [DONE]\n\n`);\n }\n });\n }\n};\nvar uiMessageChunkSchema = exports_external.union([\n exports_external.strictObject({\n type: exports_external.literal("text-start"),\n id: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("text-delta"),\n id: exports_external.string(),\n delta: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("text-end"),\n id: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("error"),\n errorText: exports_external.string()\n }),\n exports_external.strictObject({\n type: exports_external.literal("tool-input-start"),\n toolCallId: exports_external.string(),\n toolName: exports_external.string(),\n providerExecuted: exports_external.boolean().optional(),\n dynamic: exports_external.boolean().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("tool-input-delta"),\n toolCallId: exports_external.string(),\n inputTextDelta: exports_external.string()\n }),\n exports_external.strictObject({\n type: exports_external.literal("tool-input-available"),\n toolCallId: exports_external.string(),\n toolName: exports_external.string(),\n input: exports_external.unknown(),\n providerExecuted: exports_external.boolean().optional(),\n providerMetadata: providerMetadataSchema.optional(),\n dynamic: exports_external.boolean().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("tool-input-error"),\n toolCallId: exports_external.string(),\n toolName: exports_external.string(),\n input: exports_external.unknown(),\n providerExecuted: exports_external.boolean().optional(),\n providerMetadata: providerMetadataSchema.optional(),\n dynamic: exports_external.boolean().optional(),\n errorText: exports_external.string()\n }),\n exports_external.strictObject({\n type: exports_external.literal("tool-output-available"),\n toolCallId: exports_external.string(),\n output: exports_external.unknown(),\n providerExecuted: exports_external.boolean().optional(),\n dynamic: exports_external.boolean().optional(),\n preliminary: exports_external.boolean().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("tool-output-error"),\n toolCallId: exports_external.string(),\n errorText: exports_external.string(),\n providerExecuted: exports_external.boolean().optional(),\n dynamic: exports_external.boolean().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("reasoning"),\n text: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("reasoning-start"),\n id: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("reasoning-delta"),\n id: exports_external.string(),\n delta: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("reasoning-end"),\n id: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("reasoning-part-finish")\n }),\n exports_external.strictObject({\n type: exports_external.literal("source-url"),\n sourceId: exports_external.string(),\n url: exports_external.string(),\n title: exports_external.string().optional(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("source-document"),\n sourceId: exports_external.string(),\n mediaType: exports_external.string(),\n title: exports_external.string(),\n filename: exports_external.string().optional(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("file"),\n url: exports_external.string(),\n mediaType: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n }),\n exports_external.strictObject({\n type: exports_external.string().startsWith("data-"),\n id: exports_external.string().optional(),\n data: exports_external.unknown(),\n transient: exports_external.boolean().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("start-step")\n }),\n exports_external.strictObject({\n type: exports_external.literal("finish-step")\n }),\n exports_external.strictObject({\n type: exports_external.literal("start"),\n messageId: exports_external.string().optional(),\n messageMetadata: exports_external.unknown().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("finish"),\n messageMetadata: exports_external.unknown().optional()\n }),\n exports_external.strictObject({\n type: exports_external.literal("abort")\n }),\n exports_external.strictObject({\n type: exports_external.literal("message-metadata"),\n messageMetadata: exports_external.unknown()\n })\n]);\nfunction isDataUIMessageChunk(chunk) {\n return chunk.type.startsWith("data-");\n}\nfunction mergeObjects(base, overrides) {\n if (base === undefined && overrides === undefined) {\n return;\n }\n if (base === undefined) {\n return overrides;\n }\n if (overrides === undefined) {\n return base;\n }\n const result = { ...base };\n for (const key in overrides) {\n if (Object.prototype.hasOwnProperty.call(overrides, key)) {\n const overridesValue = overrides[key];\n if (overridesValue === undefined)\n continue;\n const baseValue = key in base ? base[key] : undefined;\n const isSourceObject = overridesValue !== null && typeof overridesValue === "object" && !Array.isArray(overridesValue) && !(overridesValue instanceof Date) && !(overridesValue instanceof RegExp);\n const isTargetObject = baseValue !== null && baseValue !== undefined && typeof baseValue === "object" && !Array.isArray(baseValue) && !(baseValue instanceof Date) && !(baseValue instanceof RegExp);\n if (isSourceObject && isTargetObject) {\n result[key] = mergeObjects(baseValue, overridesValue);\n } else {\n result[key] = overridesValue;\n }\n }\n }\n return result;\n}\nfunction fixJson(input) {\n const stack = ["ROOT"];\n let lastValidIndex = -1;\n let literalStart = null;\n function processValueStart(char, i2, swapState) {\n {\n switch (char) {\n case \'"\': {\n lastValidIndex = i2;\n stack.pop();\n stack.push(swapState);\n stack.push("INSIDE_STRING");\n break;\n }\n case "f":\n case "t":\n case "n": {\n lastValidIndex = i2;\n literalStart = i2;\n stack.pop();\n stack.push(swapState);\n stack.push("INSIDE_LITERAL");\n break;\n }\n case "-": {\n stack.pop();\n stack.push(swapState);\n stack.push("INSIDE_NUMBER");\n break;\n }\n case "0":\n case "1":\n case "2":\n case "3":\n case "4":\n case "5":\n case "6":\n case "7":\n case "8":\n case "9": {\n lastValidIndex = i2;\n stack.pop();\n stack.push(swapState);\n stack.push("INSIDE_NUMBER");\n break;\n }\n case "{": {\n lastValidIndex = i2;\n stack.pop();\n stack.push(swapState);\n stack.push("INSIDE_OBJECT_START");\n break;\n }\n case "[": {\n lastValidIndex = i2;\n stack.pop();\n stack.push(swapState);\n stack.push("INSIDE_ARRAY_START");\n break;\n }\n }\n }\n }\n function processAfterObjectValue(char, i2) {\n switch (char) {\n case ",": {\n stack.pop();\n stack.push("INSIDE_OBJECT_AFTER_COMMA");\n break;\n }\n case "}": {\n lastValidIndex = i2;\n stack.pop();\n break;\n }\n }\n }\n function processAfterArrayValue(char, i2) {\n switch (char) {\n case ",": {\n stack.pop();\n stack.push("INSIDE_ARRAY_AFTER_COMMA");\n break;\n }\n case "]": {\n lastValidIndex = i2;\n stack.pop();\n break;\n }\n }\n }\n for (let i2 = 0;i2 < input.length; i2++) {\n const char = input[i2];\n const currentState = stack[stack.length - 1];\n switch (currentState) {\n case "ROOT":\n processValueStart(char, i2, "FINISH");\n break;\n case "INSIDE_OBJECT_START": {\n switch (char) {\n case \'"\': {\n stack.pop();\n stack.push("INSIDE_OBJECT_KEY");\n break;\n }\n case "}": {\n lastValidIndex = i2;\n stack.pop();\n break;\n }\n }\n break;\n }\n case "INSIDE_OBJECT_AFTER_COMMA": {\n switch (char) {\n case \'"\': {\n stack.pop();\n stack.push("INSIDE_OBJECT_KEY");\n break;\n }\n }\n break;\n }\n case "INSIDE_OBJECT_KEY": {\n switch (char) {\n case \'"\': {\n stack.pop();\n stack.push("INSIDE_OBJECT_AFTER_KEY");\n break;\n }\n }\n break;\n }\n case "INSIDE_OBJECT_AFTER_KEY": {\n switch (char) {\n case ":": {\n stack.pop();\n stack.push("INSIDE_OBJECT_BEFORE_VALUE");\n break;\n }\n }\n break;\n }\n case "INSIDE_OBJECT_BEFORE_VALUE": {\n processValueStart(char, i2, "INSIDE_OBJECT_AFTER_VALUE");\n break;\n }\n case "INSIDE_OBJECT_AFTER_VALUE": {\n processAfterObjectValue(char, i2);\n break;\n }\n case "INSIDE_STRING": {\n switch (char) {\n case \'"\': {\n stack.pop();\n lastValidIndex = i2;\n break;\n }\n case "\\\\": {\n stack.push("INSIDE_STRING_ESCAPE");\n break;\n }\n default: {\n lastValidIndex = i2;\n }\n }\n break;\n }\n case "INSIDE_ARRAY_START": {\n switch (char) {\n case "]": {\n lastValidIndex = i2;\n stack.pop();\n break;\n }\n default: {\n lastValidIndex = i2;\n processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");\n break;\n }\n }\n break;\n }\n case "INSIDE_ARRAY_AFTER_VALUE": {\n switch (char) {\n case ",": {\n stack.pop();\n stack.push("INSIDE_ARRAY_AFTER_COMMA");\n break;\n }\n case "]": {\n lastValidIndex = i2;\n stack.pop();\n break;\n }\n default: {\n lastValidIndex = i2;\n break;\n }\n }\n break;\n }\n case "INSIDE_ARRAY_AFTER_COMMA": {\n processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");\n break;\n }\n case "INSIDE_STRING_ESCAPE": {\n stack.pop();\n lastValidIndex = i2;\n break;\n }\n case "INSIDE_NUMBER": {\n switch (char) {\n case "0":\n case "1":\n case "2":\n case "3":\n case "4":\n case "5":\n case "6":\n case "7":\n case "8":\n case "9": {\n lastValidIndex = i2;\n break;\n }\n case "e":\n case "E":\n case "-":\n case ".": {\n break;\n }\n case ",": {\n stack.pop();\n if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {\n processAfterArrayValue(char, i2);\n }\n if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {\n processAfterObjectValue(char, i2);\n }\n break;\n }\n case "}": {\n stack.pop();\n if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {\n processAfterObjectValue(char, i2);\n }\n break;\n }\n case "]": {\n stack.pop();\n if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {\n processAfterArrayValue(char, i2);\n }\n break;\n }\n default: {\n stack.pop();\n break;\n }\n }\n break;\n }\n case "INSIDE_LITERAL": {\n const partialLiteral = input.substring(literalStart, i2 + 1);\n if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {\n stack.pop();\n if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {\n processAfterObjectValue(char, i2);\n } else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {\n processAfterArrayValue(char, i2);\n }\n } else {\n lastValidIndex = i2;\n }\n break;\n }\n }\n }\n let result = input.slice(0, lastValidIndex + 1);\n for (let i2 = stack.length - 1;i2 >= 0; i2--) {\n const state = stack[i2];\n switch (state) {\n case "INSIDE_STRING": {\n result += \'"\';\n break;\n }\n case "INSIDE_OBJECT_KEY":\n case "INSIDE_OBJECT_AFTER_KEY":\n case "INSIDE_OBJECT_AFTER_COMMA":\n case "INSIDE_OBJECT_START":\n case "INSIDE_OBJECT_BEFORE_VALUE":\n case "INSIDE_OBJECT_AFTER_VALUE": {\n result += "}";\n break;\n }\n case "INSIDE_ARRAY_START":\n case "INSIDE_ARRAY_AFTER_COMMA":\n case "INSIDE_ARRAY_AFTER_VALUE": {\n result += "]";\n break;\n }\n case "INSIDE_LITERAL": {\n const partialLiteral = input.substring(literalStart, input.length);\n if ("true".startsWith(partialLiteral)) {\n result += "true".slice(partialLiteral.length);\n } else if ("false".startsWith(partialLiteral)) {\n result += "false".slice(partialLiteral.length);\n } else if ("null".startsWith(partialLiteral)) {\n result += "null".slice(partialLiteral.length);\n }\n }\n }\n }\n return result;\n}\nasync function parsePartialJson(jsonText) {\n if (jsonText === undefined) {\n return { value: undefined, state: "undefined-input" };\n }\n let result = await safeParseJSON({ text: jsonText });\n if (result.success) {\n return { value: result.value, state: "successful-parse" };\n }\n result = await safeParseJSON({ text: fixJson(jsonText) });\n if (result.success) {\n return { value: result.value, state: "repaired-parse" };\n }\n return { value: undefined, state: "failed-parse" };\n}\nfunction isToolUIPart(part) {\n return part.type.startsWith("tool-");\n}\nfunction isDynamicToolUIPart(part) {\n return part.type === "dynamic-tool";\n}\nfunction isToolOrDynamicToolUIPart(part) {\n return isToolUIPart(part) || isDynamicToolUIPart(part);\n}\nfunction getToolName(part) {\n return part.type.split("-").slice(1).join("-");\n}\nfunction createStreamingUIMessageState({\n lastMessage,\n messageId\n}) {\n return {\n message: (lastMessage == null ? undefined : lastMessage.role) === "assistant" ? lastMessage : {\n id: messageId,\n metadata: undefined,\n role: "assistant",\n parts: []\n },\n activeTextParts: {},\n activeReasoningParts: {},\n partialToolCalls: {}\n };\n}\nfunction processUIMessageStream({\n stream,\n messageMetadataSchema,\n dataPartSchemas,\n runUpdateMessageJob,\n onError,\n onToolCall,\n onData\n}) {\n return stream.pipeThrough(new TransformStream({\n async transform(chunk, controller) {\n await runUpdateMessageJob(async ({ state, write }) => {\n var _a17, _b, _c, _d;\n function getToolInvocation(toolCallId) {\n const toolInvocations = state.message.parts.filter(isToolUIPart);\n const toolInvocation = toolInvocations.find((invocation) => invocation.toolCallId === toolCallId);\n if (toolInvocation == null) {\n throw new Error("tool-output-error must be preceded by a tool-input-available");\n }\n return toolInvocation;\n }\n function getDynamicToolInvocation(toolCallId) {\n const toolInvocations = state.message.parts.filter((part) => part.type === "dynamic-tool");\n const toolInvocation = toolInvocations.find((invocation) => invocation.toolCallId === toolCallId);\n if (toolInvocation == null) {\n throw new Error("tool-output-error must be preceded by a tool-input-available");\n }\n return toolInvocation;\n }\n function updateToolPart(options) {\n var _a18;\n const part = state.message.parts.find((part2) => isToolUIPart(part2) && part2.toolCallId === options.toolCallId);\n const anyOptions = options;\n const anyPart = part;\n if (part != null) {\n part.state = options.state;\n anyPart.input = anyOptions.input;\n anyPart.output = anyOptions.output;\n anyPart.errorText = anyOptions.errorText;\n anyPart.rawInput = anyOptions.rawInput;\n anyPart.preliminary = anyOptions.preliminary;\n anyPart.providerExecuted = (_a18 = anyOptions.providerExecuted) != null ? _a18 : part.providerExecuted;\n if (anyOptions.providerMetadata != null && part.state === "input-available") {\n part.callProviderMetadata = anyOptions.providerMetadata;\n }\n } else {\n state.message.parts.push({\n type: `tool-${options.toolName}`,\n toolCallId: options.toolCallId,\n state: options.state,\n input: anyOptions.input,\n output: anyOptions.output,\n rawInput: anyOptions.rawInput,\n errorText: anyOptions.errorText,\n providerExecuted: anyOptions.providerExecuted,\n preliminary: anyOptions.preliminary,\n ...anyOptions.providerMetadata != null ? { callProviderMetadata: anyOptions.providerMetadata } : {}\n });\n }\n }\n function updateDynamicToolPart(options) {\n var _a18;\n const part = state.message.parts.find((part2) => part2.type === "dynamic-tool" && part2.toolCallId === options.toolCallId);\n const anyOptions = options;\n const anyPart = part;\n if (part != null) {\n part.state = options.state;\n anyPart.toolName = options.toolName;\n anyPart.input = anyOptions.input;\n anyPart.output = anyOptions.output;\n anyPart.errorText = anyOptions.errorText;\n anyPart.rawInput = (_a18 = anyOptions.rawInput) != null ? _a18 : anyPart.rawInput;\n anyPart.preliminary = anyOptions.preliminary;\n if (anyOptions.providerMetadata != null && part.state === "input-available") {\n part.callProviderMetadata = anyOptions.providerMetadata;\n }\n } else {\n state.message.parts.push({\n type: "dynamic-tool",\n toolName: options.toolName,\n toolCallId: options.toolCallId,\n state: options.state,\n input: anyOptions.input,\n output: anyOptions.output,\n errorText: anyOptions.errorText,\n preliminary: anyOptions.preliminary,\n ...anyOptions.providerMetadata != null ? { callProviderMetadata: anyOptions.providerMetadata } : {}\n });\n }\n }\n async function updateMessageMetadata(metadata) {\n if (metadata != null) {\n const mergedMetadata = state.message.metadata != null ? mergeObjects(state.message.metadata, metadata) : metadata;\n if (messageMetadataSchema != null) {\n await validateTypes({\n value: mergedMetadata,\n schema: messageMetadataSchema\n });\n }\n state.message.metadata = mergedMetadata;\n }\n }\n switch (chunk.type) {\n case "text-start": {\n const textPart = {\n type: "text",\n text: "",\n providerMetadata: chunk.providerMetadata,\n state: "streaming"\n };\n state.activeTextParts[chunk.id] = textPart;\n state.message.parts.push(textPart);\n write();\n break;\n }\n case "text-delta": {\n const textPart = state.activeTextParts[chunk.id];\n textPart.text += chunk.delta;\n textPart.providerMetadata = (_a17 = chunk.providerMetadata) != null ? _a17 : textPart.providerMetadata;\n write();\n break;\n }\n case "text-end": {\n const textPart = state.activeTextParts[chunk.id];\n textPart.state = "done";\n textPart.providerMetadata = (_b = chunk.providerMetadata) != null ? _b : textPart.providerMetadata;\n delete state.activeTextParts[chunk.id];\n write();\n break;\n }\n case "reasoning-start": {\n const reasoningPart = {\n type: "reasoning",\n text: "",\n providerMetadata: chunk.providerMetadata,\n state: "streaming"\n };\n state.activeReasoningParts[chunk.id] = reasoningPart;\n state.message.parts.push(reasoningPart);\n write();\n break;\n }\n case "reasoning-delta": {\n const reasoningPart = state.activeReasoningParts[chunk.id];\n reasoningPart.text += chunk.delta;\n reasoningPart.providerMetadata = (_c = chunk.providerMetadata) != null ? _c : reasoningPart.providerMetadata;\n write();\n break;\n }\n case "reasoning-end": {\n const reasoningPart = state.activeReasoningParts[chunk.id];\n reasoningPart.providerMetadata = (_d = chunk.providerMetadata) != null ? _d : reasoningPart.providerMetadata;\n reasoningPart.state = "done";\n delete state.activeReasoningParts[chunk.id];\n write();\n break;\n }\n case "file": {\n state.message.parts.push({\n type: "file",\n mediaType: chunk.mediaType,\n url: chunk.url\n });\n write();\n break;\n }\n case "source-url": {\n state.message.parts.push({\n type: "source-url",\n sourceId: chunk.sourceId,\n url: chunk.url,\n title: chunk.title,\n providerMetadata: chunk.providerMetadata\n });\n write();\n break;\n }\n case "source-document": {\n state.message.parts.push({\n type: "source-document",\n sourceId: chunk.sourceId,\n mediaType: chunk.mediaType,\n title: chunk.title,\n filename: chunk.filename,\n providerMetadata: chunk.providerMetadata\n });\n write();\n break;\n }\n case "tool-input-start": {\n const toolInvocations = state.message.parts.filter(isToolUIPart);\n state.partialToolCalls[chunk.toolCallId] = {\n text: "",\n toolName: chunk.toolName,\n index: toolInvocations.length,\n dynamic: chunk.dynamic\n };\n if (chunk.dynamic) {\n updateDynamicToolPart({\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n state: "input-streaming",\n input: undefined\n });\n } else {\n updateToolPart({\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n state: "input-streaming",\n input: undefined,\n providerExecuted: chunk.providerExecuted\n });\n }\n write();\n break;\n }\n case "tool-input-delta": {\n const partialToolCall = state.partialToolCalls[chunk.toolCallId];\n partialToolCall.text += chunk.inputTextDelta;\n const { value: partialArgs } = await parsePartialJson(partialToolCall.text);\n if (partialToolCall.dynamic) {\n updateDynamicToolPart({\n toolCallId: chunk.toolCallId,\n toolName: partialToolCall.toolName,\n state: "input-streaming",\n input: partialArgs\n });\n } else {\n updateToolPart({\n toolCallId: chunk.toolCallId,\n toolName: partialToolCall.toolName,\n state: "input-streaming",\n input: partialArgs\n });\n }\n write();\n break;\n }\n case "tool-input-available": {\n if (chunk.dynamic) {\n updateDynamicToolPart({\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n state: "input-available",\n input: chunk.input,\n providerMetadata: chunk.providerMetadata\n });\n } else {\n updateToolPart({\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n state: "input-available",\n input: chunk.input,\n providerExecuted: chunk.providerExecuted,\n providerMetadata: chunk.providerMetadata\n });\n }\n write();\n if (onToolCall && !chunk.providerExecuted) {\n await onToolCall({\n toolCall: chunk\n });\n }\n break;\n }\n case "tool-input-error": {\n if (chunk.dynamic) {\n updateDynamicToolPart({\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n state: "output-error",\n input: chunk.input,\n errorText: chunk.errorText,\n providerMetadata: chunk.providerMetadata\n });\n } else {\n updateToolPart({\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n state: "output-error",\n input: undefined,\n rawInput: chunk.input,\n errorText: chunk.errorText,\n providerExecuted: chunk.providerExecuted,\n providerMetadata: chunk.providerMetadata\n });\n }\n write();\n break;\n }\n case "tool-output-available": {\n if (chunk.dynamic) {\n const toolInvocation = getDynamicToolInvocation(chunk.toolCallId);\n updateDynamicToolPart({\n toolCallId: chunk.toolCallId,\n toolName: toolInvocation.toolName,\n state: "output-available",\n input: toolInvocation.input,\n output: chunk.output,\n preliminary: chunk.preliminary\n });\n } else {\n const toolInvocation = getToolInvocation(chunk.toolCallId);\n updateToolPart({\n toolCallId: chunk.toolCallId,\n toolName: getToolName(toolInvocation),\n state: "output-available",\n input: toolInvocation.input,\n output: chunk.output,\n providerExecuted: chunk.providerExecuted,\n preliminary: chunk.preliminary\n });\n }\n write();\n break;\n }\n case "tool-output-error": {\n if (chunk.dynamic) {\n const toolInvocation = getDynamicToolInvocation(chunk.toolCallId);\n updateDynamicToolPart({\n toolCallId: chunk.toolCallId,\n toolName: toolInvocation.toolName,\n state: "output-error",\n input: toolInvocation.input,\n errorText: chunk.errorText\n });\n } else {\n const toolInvocation = getToolInvocation(chunk.toolCallId);\n updateToolPart({\n toolCallId: chunk.toolCallId,\n toolName: getToolName(toolInvocation),\n state: "output-error",\n input: toolInvocation.input,\n rawInput: toolInvocation.rawInput,\n errorText: chunk.errorText\n });\n }\n write();\n break;\n }\n case "start-step": {\n state.message.parts.push({ type: "step-start" });\n break;\n }\n case "finish-step": {\n state.activeTextParts = {};\n state.activeReasoningParts = {};\n break;\n }\n case "start": {\n if (chunk.messageId != null) {\n state.message.id = chunk.messageId;\n }\n await updateMessageMetadata(chunk.messageMetadata);\n if (chunk.messageId != null || chunk.messageMetadata != null) {\n write();\n }\n break;\n }\n case "finish": {\n await updateMessageMetadata(chunk.messageMetadata);\n if (chunk.messageMetadata != null) {\n write();\n }\n break;\n }\n case "message-metadata": {\n await updateMessageMetadata(chunk.messageMetadata);\n if (chunk.messageMetadata != null) {\n write();\n }\n break;\n }\n case "error": {\n onError == null || onError(new Error(chunk.errorText));\n break;\n }\n default: {\n if (isDataUIMessageChunk(chunk)) {\n if ((dataPartSchemas == null ? undefined : dataPartSchemas[chunk.type]) != null) {\n await validateTypes({\n value: chunk.data,\n schema: dataPartSchemas[chunk.type]\n });\n }\n const dataChunk = chunk;\n if (dataChunk.transient) {\n onData == null || onData(dataChunk);\n break;\n }\n const existingUIPart = dataChunk.id != null ? state.message.parts.find((chunkArg) => dataChunk.type === chunkArg.type && dataChunk.id === chunkArg.id) : undefined;\n if (existingUIPart != null) {\n existingUIPart.data = dataChunk.data;\n } else {\n state.message.parts.push(dataChunk);\n }\n onData == null || onData(dataChunk);\n write();\n }\n }\n }\n controller.enqueue(chunk);\n });\n }\n }));\n}\nfunction handleUIMessageStreamFinish({\n messageId,\n originalMessages = [],\n onFinish,\n onError,\n stream\n}) {\n let lastMessage = originalMessages == null ? undefined : originalMessages[originalMessages.length - 1];\n if ((lastMessage == null ? undefined : lastMessage.role) !== "assistant") {\n lastMessage = undefined;\n } else {\n messageId = lastMessage.id;\n }\n let isAborted2 = false;\n const idInjectedStream = stream.pipeThrough(new TransformStream({\n transform(chunk, controller) {\n if (chunk.type === "start") {\n const startChunk = chunk;\n if (startChunk.messageId == null && messageId != null) {\n startChunk.messageId = messageId;\n }\n }\n if (chunk.type === "abort") {\n isAborted2 = true;\n }\n controller.enqueue(chunk);\n }\n }));\n if (onFinish == null) {\n return idInjectedStream;\n }\n const state = createStreamingUIMessageState({\n lastMessage: lastMessage ? structuredClone(lastMessage) : undefined,\n messageId: messageId != null ? messageId : ""\n });\n const runUpdateMessageJob = async (job) => {\n await job({ state, write: () => {} });\n };\n let finishCalled = false;\n const callOnFinish = async () => {\n if (finishCalled || !onFinish) {\n return;\n }\n finishCalled = true;\n const isContinuation = state.message.id === (lastMessage == null ? undefined : lastMessage.id);\n await onFinish({\n isAborted: isAborted2,\n isContinuation,\n responseMessage: state.message,\n messages: [\n ...isContinuation ? originalMessages.slice(0, -1) : originalMessages,\n state.message\n ]\n });\n };\n return processUIMessageStream({\n stream: idInjectedStream,\n runUpdateMessageJob,\n onError\n }).pipeThrough(new TransformStream({\n transform(chunk, controller) {\n controller.enqueue(chunk);\n },\n async cancel() {\n await callOnFinish();\n },\n async flush() {\n await callOnFinish();\n }\n }));\n}\nvar originalGenerateId2 = createIdGenerator({\n prefix: "aitxt",\n size: 24\n});\nfunction convertToModelMessages(messages, options) {\n const modelMessages = [];\n if (options == null ? undefined : options.ignoreIncompleteToolCalls) {\n messages = messages.map((message) => ({\n ...message,\n parts: message.parts.filter((part) => !isToolOrDynamicToolUIPart(part) || part.state !== "input-streaming" && part.state !== "input-available")\n }));\n }\n for (const message of messages) {\n switch (message.role) {\n case "system": {\n const textParts = message.parts.filter((part) => part.type === "text");\n const providerMetadata = textParts.reduce((acc, part) => {\n if (part.providerMetadata != null) {\n return { ...acc, ...part.providerMetadata };\n }\n return acc;\n }, {});\n modelMessages.push({\n role: "system",\n content: textParts.map((part) => part.text).join(""),\n ...Object.keys(providerMetadata).length > 0 ? { providerOptions: providerMetadata } : {}\n });\n break;\n }\n case "user": {\n modelMessages.push({\n role: "user",\n content: message.parts.filter((part) => part.type === "text" || part.type === "file").map((part) => {\n switch (part.type) {\n case "text":\n return {\n type: "text",\n text: part.text,\n ...part.providerMetadata != null ? { providerOptions: part.providerMetadata } : {}\n };\n case "file":\n return {\n type: "file",\n mediaType: part.mediaType,\n filename: part.filename,\n data: part.url,\n ...part.providerMetadata != null ? { providerOptions: part.providerMetadata } : {}\n };\n default:\n return part;\n }\n })\n });\n break;\n }\n case "assistant": {\n if (message.parts != null) {\n let processBlock2 = function() {\n var _a17, _b;\n if (block.length === 0) {\n return;\n }\n const content = [];\n for (const part of block) {\n if (part.type === "text") {\n content.push({\n type: "text",\n text: part.text,\n ...part.providerMetadata != null ? { providerOptions: part.providerMetadata } : {}\n });\n } else if (part.type === "file") {\n content.push({\n type: "file",\n mediaType: part.mediaType,\n filename: part.filename,\n data: part.url\n });\n } else if (part.type === "reasoning") {\n content.push({\n type: "reasoning",\n text: part.text,\n providerOptions: part.providerMetadata\n });\n } else if (part.type === "dynamic-tool") {\n const toolName = part.toolName;\n if (part.state !== "input-streaming") {\n content.push({\n type: "tool-call",\n toolCallId: part.toolCallId,\n toolName,\n input: part.input,\n ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}\n });\n }\n } else if (isToolUIPart(part)) {\n const toolName = getToolName(part);\n if (part.state !== "input-streaming") {\n content.push({\n type: "tool-call",\n toolCallId: part.toolCallId,\n toolName,\n input: part.state === "output-error" ? (_a17 = part.input) != null ? _a17 : part.rawInput : part.input,\n providerExecuted: part.providerExecuted,\n ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}\n });\n if (part.providerExecuted === true && (part.state === "output-available" || part.state === "output-error")) {\n content.push({\n type: "tool-result",\n toolCallId: part.toolCallId,\n toolName,\n output: createToolModelOutput({\n output: part.state === "output-error" ? part.errorText : part.output,\n tool: (_b = options == null ? undefined : options.tools) == null ? undefined : _b[toolName],\n errorMode: part.state === "output-error" ? "json" : "none"\n })\n });\n }\n }\n } else {\n const _exhaustiveCheck = part;\n throw new Error(`Unsupported part: ${_exhaustiveCheck}`);\n }\n }\n modelMessages.push({\n role: "assistant",\n content\n });\n const toolParts = block.filter((part) => isToolUIPart(part) && part.providerExecuted !== true || part.type === "dynamic-tool");\n if (toolParts.length > 0) {\n modelMessages.push({\n role: "tool",\n content: toolParts.map((toolPart) => {\n var _a18;\n switch (toolPart.state) {\n case "output-error":\n case "output-available": {\n const toolName = toolPart.type === "dynamic-tool" ? toolPart.toolName : getToolName(toolPart);\n return {\n type: "tool-result",\n toolCallId: toolPart.toolCallId,\n toolName,\n output: createToolModelOutput({\n output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,\n tool: (_a18 = options == null ? undefined : options.tools) == null ? undefined : _a18[toolName],\n errorMode: toolPart.state === "output-error" ? "text" : "none"\n })\n };\n }\n default: {\n return null;\n }\n }\n }).filter((output) => output != null)\n });\n }\n block = [];\n };\n var processBlock = processBlock2;\n let block = [];\n for (const part of message.parts) {\n if (part.type === "text" || part.type === "reasoning" || part.type === "file" || part.type === "dynamic-tool" || isToolUIPart(part)) {\n block.push(part);\n } else if (part.type === "step-start") {\n processBlock2();\n }\n }\n processBlock2();\n break;\n }\n break;\n }\n default: {\n const _exhaustiveCheck = message.role;\n throw new MessageConversionError({\n originalMessage: message,\n message: `Unsupported role: ${_exhaustiveCheck}`\n });\n }\n }\n }\n return modelMessages;\n}\nvar originalGenerateId3 = createIdGenerator({ prefix: "aiobj", size: 24 });\nvar originalGenerateId4 = createIdGenerator({ prefix: "aiobj", size: 24 });\nvar output_exports = {};\n__export2(output_exports, {\n object: () => object2,\n text: () => text\n});\nvar text = () => ({\n type: "text",\n responseFormat: { type: "text" },\n async parsePartial({ text: text2 }) {\n return { partial: text2 };\n },\n async parseOutput({ text: text2 }) {\n return text2;\n }\n});\nvar object2 = ({\n schema: inputSchema\n}) => {\n const schema = asSchema(inputSchema);\n return {\n type: "object",\n responseFormat: {\n type: "json",\n schema: schema.jsonSchema\n },\n async parsePartial({ text: text2 }) {\n const result = await parsePartialJson(text2);\n switch (result.state) {\n case "failed-parse":\n case "undefined-input":\n return;\n case "repaired-parse":\n case "successful-parse":\n return {\n partial: result.value\n };\n default: {\n const _exhaustiveCheck = result.state;\n throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);\n }\n }\n },\n async parseOutput({ text: text2 }, context) {\n const parseResult = await safeParseJSON({ text: text2 });\n if (!parseResult.success) {\n throw new NoObjectGeneratedError({\n message: "No object generated: could not parse the response.",\n cause: parseResult.error,\n text: text2,\n response: context.response,\n usage: context.usage,\n finishReason: context.finishReason\n });\n }\n const validationResult = await safeValidateTypes({\n value: parseResult.value,\n schema\n });\n if (!validationResult.success) {\n throw new NoObjectGeneratedError({\n message: "No object generated: response did not match schema.",\n cause: validationResult.error,\n text: text2,\n response: context.response,\n usage: context.usage,\n finishReason: context.finishReason\n });\n }\n return validationResult.value;\n }\n };\n};\nvar name16 = "AI_NoSuchProviderError";\nvar marker16 = `vercel.ai.error.${name16}`;\nvar symbol16 = Symbol.for(marker16);\nvar _a16;\n_a16 = symbol16;\nvar ClientOrServerImplementationSchema = exports_external.looseObject({\n name: exports_external.string(),\n version: exports_external.string()\n});\nvar BaseParamsSchema = exports_external.looseObject({\n _meta: exports_external.optional(exports_external.object({}).loose())\n});\nvar ResultSchema = BaseParamsSchema;\nvar RequestSchema = exports_external.object({\n method: exports_external.string(),\n params: exports_external.optional(BaseParamsSchema)\n});\nvar ServerCapabilitiesSchema = exports_external.looseObject({\n experimental: exports_external.optional(exports_external.object({}).loose()),\n logging: exports_external.optional(exports_external.object({}).loose()),\n prompts: exports_external.optional(exports_external.looseObject({\n listChanged: exports_external.optional(exports_external.boolean())\n })),\n resources: exports_external.optional(exports_external.looseObject({\n subscribe: exports_external.optional(exports_external.boolean()),\n listChanged: exports_external.optional(exports_external.boolean())\n })),\n tools: exports_external.optional(exports_external.looseObject({\n listChanged: exports_external.optional(exports_external.boolean())\n }))\n});\nvar InitializeResultSchema = ResultSchema.extend({\n protocolVersion: exports_external.string(),\n capabilities: ServerCapabilitiesSchema,\n serverInfo: ClientOrServerImplementationSchema,\n instructions: exports_external.optional(exports_external.string())\n});\nvar PaginatedResultSchema = ResultSchema.extend({\n nextCursor: exports_external.optional(exports_external.string())\n});\nvar ToolSchema = exports_external.object({\n name: exports_external.string(),\n description: exports_external.optional(exports_external.string()),\n inputSchema: exports_external.object({\n type: exports_external.literal("object"),\n properties: exports_external.optional(exports_external.object({}).loose())\n }).loose()\n}).loose();\nvar ListToolsResultSchema = PaginatedResultSchema.extend({\n tools: exports_external.array(ToolSchema)\n});\nvar TextContentSchema = exports_external.object({\n type: exports_external.literal("text"),\n text: exports_external.string()\n}).loose();\nvar ImageContentSchema = exports_external.object({\n type: exports_external.literal("image"),\n data: exports_external.base64(),\n mimeType: exports_external.string()\n}).loose();\nvar ResourceContentsSchema = exports_external.object({\n uri: exports_external.string(),\n mimeType: exports_external.optional(exports_external.string())\n}).loose();\nvar TextResourceContentsSchema = ResourceContentsSchema.extend({\n text: exports_external.string()\n});\nvar BlobResourceContentsSchema = ResourceContentsSchema.extend({\n blob: exports_external.base64()\n});\nvar EmbeddedResourceSchema = exports_external.object({\n type: exports_external.literal("resource"),\n resource: exports_external.union([TextResourceContentsSchema, BlobResourceContentsSchema])\n}).loose();\nvar CallToolResultSchema = ResultSchema.extend({\n content: exports_external.array(exports_external.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])),\n isError: exports_external.boolean().default(false).optional()\n}).or(ResultSchema.extend({\n toolResult: exports_external.unknown()\n}));\nvar JSONRPC_VERSION = "2.0";\nvar JSONRPCRequestSchema = exports_external.object({\n jsonrpc: exports_external.literal(JSONRPC_VERSION),\n id: exports_external.union([exports_external.string(), exports_external.number().int()])\n}).merge(RequestSchema).strict();\nvar JSONRPCResponseSchema = exports_external.object({\n jsonrpc: exports_external.literal(JSONRPC_VERSION),\n id: exports_external.union([exports_external.string(), exports_external.number().int()]),\n result: ResultSchema\n}).strict();\nvar JSONRPCErrorSchema = exports_external.object({\n jsonrpc: exports_external.literal(JSONRPC_VERSION),\n id: exports_external.union([exports_external.string(), exports_external.number().int()]),\n error: exports_external.object({\n code: exports_external.number().int(),\n message: exports_external.string(),\n data: exports_external.optional(exports_external.unknown())\n })\n}).strict();\nvar JSONRPCNotificationSchema = exports_external.object({\n jsonrpc: exports_external.literal(JSONRPC_VERSION)\n}).merge(exports_external.object({\n method: exports_external.string(),\n params: exports_external.optional(BaseParamsSchema)\n})).strict();\nvar JSONRPCMessageSchema = exports_external.union([\n JSONRPCRequestSchema,\n JSONRPCNotificationSchema,\n JSONRPCResponseSchema,\n JSONRPCErrorSchema\n]);\nvar textUIPartSchema = exports_external.object({\n type: exports_external.literal("text"),\n text: exports_external.string(),\n state: exports_external.enum(["streaming", "done"]).optional(),\n providerMetadata: providerMetadataSchema.optional()\n});\nvar reasoningUIPartSchema = exports_external.object({\n type: exports_external.literal("reasoning"),\n text: exports_external.string(),\n state: exports_external.enum(["streaming", "done"]).optional(),\n providerMetadata: providerMetadataSchema.optional()\n});\nvar sourceUrlUIPartSchema = exports_external.object({\n type: exports_external.literal("source-url"),\n sourceId: exports_external.string(),\n url: exports_external.string(),\n title: exports_external.string().optional(),\n providerMetadata: providerMetadataSchema.optional()\n});\nvar sourceDocumentUIPartSchema = exports_external.object({\n type: exports_external.literal("source-document"),\n sourceId: exports_external.string(),\n mediaType: exports_external.string(),\n title: exports_external.string(),\n filename: exports_external.string().optional(),\n providerMetadata: providerMetadataSchema.optional()\n});\nvar fileUIPartSchema = exports_external.object({\n type: exports_external.literal("file"),\n mediaType: exports_external.string(),\n filename: exports_external.string().optional(),\n url: exports_external.string(),\n providerMetadata: providerMetadataSchema.optional()\n});\nvar stepStartUIPartSchema = exports_external.object({\n type: exports_external.literal("step-start")\n});\nvar dataUIPartSchema = exports_external.object({\n type: exports_external.string().startsWith("data-"),\n id: exports_external.string().optional(),\n data: exports_external.unknown()\n});\nvar dynamicToolUIPartSchemas = [\n exports_external.object({\n type: exports_external.literal("dynamic-tool"),\n toolName: exports_external.string(),\n toolCallId: exports_external.string(),\n state: exports_external.literal("input-streaming"),\n input: exports_external.unknown().optional(),\n output: exports_external.never().optional(),\n errorText: exports_external.never().optional()\n }),\n exports_external.object({\n type: exports_external.literal("dynamic-tool"),\n toolName: exports_external.string(),\n toolCallId: exports_external.string(),\n state: exports_external.literal("input-available"),\n input: exports_external.unknown(),\n output: exports_external.never().optional(),\n errorText: exports_external.never().optional(),\n callProviderMetadata: providerMetadataSchema.optional()\n }),\n exports_external.object({\n type: exports_external.literal("dynamic-tool"),\n toolName: exports_external.string(),\n toolCallId: exports_external.string(),\n state: exports_external.literal("output-available"),\n input: exports_external.unknown(),\n output: exports_external.unknown(),\n errorText: exports_external.never().optional(),\n callProviderMetadata: providerMetadataSchema.optional(),\n preliminary: exports_external.boolean().optional()\n }),\n exports_external.object({\n type: exports_external.literal("dynamic-tool"),\n toolName: exports_external.string(),\n toolCallId: exports_external.string(),\n state: exports_external.literal("output-error"),\n input: exports_external.unknown(),\n output: exports_external.never().optional(),\n errorText: exports_external.string(),\n callProviderMetadata: providerMetadataSchema.optional()\n })\n];\nvar toolUIPartSchemas = [\n exports_external.object({\n type: exports_external.string().startsWith("tool-"),\n toolCallId: exports_external.string(),\n state: exports_external.literal("input-streaming"),\n input: exports_external.unknown().optional(),\n output: exports_external.never().optional(),\n errorText: exports_external.never().optional()\n }),\n exports_external.object({\n type: exports_external.string().startsWith("tool-"),\n toolCallId: exports_external.string(),\n state: exports_external.literal("input-available"),\n input: exports_external.unknown(),\n output: exports_external.never().optional(),\n errorText: exports_external.never().optional(),\n callProviderMetadata: providerMetadataSchema.optional()\n }),\n exports_external.object({\n type: exports_external.string().startsWith("tool-"),\n toolCallId: exports_external.string(),\n state: exports_external.literal("output-available"),\n input: exports_external.unknown(),\n output: exports_external.unknown(),\n errorText: exports_external.never().optional(),\n callProviderMetadata: providerMetadataSchema.optional(),\n preliminary: exports_external.boolean().optional()\n }),\n exports_external.object({\n type: exports_external.string().startsWith("tool-"),\n toolCallId: exports_external.string(),\n state: exports_external.literal("output-error"),\n input: exports_external.unknown(),\n output: exports_external.never().optional(),\n errorText: exports_external.string(),\n callProviderMetadata: providerMetadataSchema.optional()\n })\n];\nvar uiMessageSchema = exports_external.object({\n id: exports_external.string(),\n role: exports_external.enum(["system", "user", "assistant"]),\n metadata: exports_external.unknown().optional(),\n parts: exports_external.array(exports_external.union([\n textUIPartSchema,\n reasoningUIPartSchema,\n sourceUrlUIPartSchema,\n sourceDocumentUIPartSchema,\n fileUIPartSchema,\n stepStartUIPartSchema,\n dataUIPartSchema,\n ...dynamicToolUIPartSchemas,\n ...toolUIPartSchemas\n ]))\n});\nfunction createUIMessageStream({\n execute,\n onError = getErrorMessage2,\n originalMessages,\n onFinish,\n generateId: generateId3 = generateId\n}) {\n let controller;\n const ongoingStreamPromises = [];\n const stream = new ReadableStream({\n start(controllerArg) {\n controller = controllerArg;\n }\n });\n function safeEnqueue(data) {\n try {\n controller.enqueue(data);\n } catch (error38) {}\n }\n try {\n const result = execute({\n writer: {\n write(part) {\n safeEnqueue(part);\n },\n merge(streamArg) {\n ongoingStreamPromises.push((async () => {\n const reader = streamArg.getReader();\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n safeEnqueue(value);\n }\n })().catch((error38) => {\n safeEnqueue({\n type: "error",\n errorText: onError(error38)\n });\n }));\n },\n onError\n }\n });\n if (result) {\n ongoingStreamPromises.push(result.catch((error38) => {\n safeEnqueue({\n type: "error",\n errorText: onError(error38)\n });\n }));\n }\n } catch (error38) {\n safeEnqueue({\n type: "error",\n errorText: onError(error38)\n });\n }\n const waitForStreams = new Promise(async (resolve2) => {\n while (ongoingStreamPromises.length > 0) {\n await ongoingStreamPromises.shift();\n }\n resolve2();\n });\n waitForStreams.finally(() => {\n try {\n controller.close();\n } catch (error38) {}\n });\n return handleUIMessageStreamFinish({\n stream,\n messageId: generateId3(),\n originalMessages,\n onFinish,\n onError\n });\n}\n\n// ../../node_modules/blink/dist/browser/index.browser-D8y5NucV.js\nfunction i2(e2) {\n return typeof e2 == `object` && !!e2 && typeof e2[Symbol.asyncIterator] == `function`;\n}\nvar a2 = class extends Error {\n constructor(e2, t2) {\n super(e2), this.response = t2;\n }\n};\nvar s2 = Object.freeze({ withContext(e2, t2) {\n let n2 = {};\n for (let r2 of Object.keys(e2))\n n2[r2] = e2[r2].withContext(t2);\n return n2;\n}, with(e2, t2) {\n let n2 = {};\n for (let r2 of Object.keys(e2))\n n2[r2] = e2[r2].withContext(t2);\n return n2;\n}, async withApproval(o2) {\n let s3 = {};\n for (let [e2, t2] of Object.entries(o2.tools)) {\n let n2 = t2.execute;\n s3[e2] = { ...t2, execute: async (e3, r2) => t2.autoApprove && n2 && await t2.autoApprove(e3) ? n2(e3, r2) : { type: `tool-approval`, outcome: `pending` } };\n }\n let l2 = o2.messages[o2.messages.length - 1];\n if (!l2?.parts)\n return s3;\n let u2 = [];\n for (let e2 of l2.parts) {\n if (!isToolUIPart(e2))\n continue;\n let t2 = getToolName(e2), i3 = o2.tools[t2];\n i3 && e2.state === `output-available` && i3.execute && c2(e2.output) && e2.output.outcome === `approved` && u2.push({ toolName: getToolName(e2), tool: i3, input: e2.input, toolCallId: e2.toolCallId });\n }\n if (u2.length > 0) {\n let n2 = createUIMessageStream({ execute: async ({ writer: t2 }) => {\n t2.write({ type: `start-step` }), await Promise.all(u2.map(async (n3) => {\n if (!n3.tool.execute)\n throw Error(`Tool does not support execute.`);\n t2.write({ type: `tool-input-available`, toolCallId: n3.toolCallId, toolName: n3.toolName, input: n3.input });\n try {\n let r2 = await n3.tool.execute(n3.input, { toolCallId: n3.toolCallId, messages: convertToModelMessages(o2.messages, { tools: o2.tools }), abortSignal: o2.abortSignal });\n if (i2(r2))\n for await (let e2 of r2)\n t2.write({ type: `tool-output-available`, toolCallId: n3.toolCallId, output: e2, preliminary: true });\n t2.write({ type: `tool-output-available`, toolCallId: n3.toolCallId, output: r2 });\n } catch (e2) {\n t2.write({ type: `tool-output-error`, toolCallId: n3.toolCallId, errorText: e2 instanceof Error ? e2.message : String(e2) });\n }\n })), t2.write({ type: `finish` });\n } });\n throw new a2(`Executing tools`, n2);\n }\n return s3;\n}, prefix(e2, t2) {\n let n2 = {};\n for (let [r2, i3] of Object.entries(e2))\n n2[`${t2}${r2}`] = i3;\n return n2;\n} });\nfunction c2(e2) {\n return typeof e2 == `object` && !!e2 && `type` in e2 && e2.type === `tool-approval`;\n}\n\n// ../../node_modules/blink/dist/browser/agent/client/index.js\nvar a3 = class extends Error {\n constructor(e2, t2) {\n super(e2), this.name = `ParseError`, this.type = t2.type, this.field = t2.field, this.value = t2.value, this.line = t2.line;\n }\n};\nfunction o2(e2) {}\nfunction s3(e2) {\n if (typeof e2 == `function`)\n throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");\n let { onEvent: t2 = o2, onError: n2 = o2, onRetry: r2 = o2, onComment: i3 } = e2, s4 = ``, l2 = true, u3, d2 = ``, f3 = ``;\n function p3(e3) {\n let t3 = l2 ? e3.replace(/^\\xEF\\xBB\\xBF/, ``) : e3, [n3, r3] = c3(`${s4}${t3}`);\n for (let e4 of n3)\n m3(e4);\n s4 = r3, l2 = false;\n }\n function m3(e3) {\n if (e3 === ``) {\n g3();\n return;\n }\n if (e3.startsWith(`:`)) {\n i3 && i3(e3.slice(e3.startsWith(`: `) ? 2 : 1));\n return;\n }\n let t3 = e3.indexOf(`:`);\n if (t3 !== -1) {\n let n3 = e3.slice(0, t3), r3 = e3[t3 + 1] === ` ` ? 2 : 1, i4 = e3.slice(t3 + r3);\n h3(n3, i4, e3);\n return;\n }\n h3(e3, ``, e3);\n }\n function h3(e3, t3, i4) {\n switch (e3) {\n case `event`:\n f3 = t3;\n break;\n case `data`:\n d2 = `${d2}${t3}\n`;\n break;\n case `id`:\n u3 = t3.includes(`\\x00`) ? undefined : t3;\n break;\n case `retry`:\n /^\\d+$/.test(t3) ? r2(parseInt(t3, 10)) : n2(new a3(`Invalid \\`retry\\` value: "${t3}"`, { type: `invalid-retry`, value: t3, line: i4 }));\n break;\n default:\n n2(new a3(`Unknown field "${e3.length > 20 ? `${e3.slice(0, 20)}…` : e3}"`, { type: `unknown-field`, field: e3, value: t3, line: i4 }));\n break;\n }\n }\n function g3() {\n d2.length > 0 && t2({ id: u3, event: f3 || undefined, data: d2.endsWith(`\n`) ? d2.slice(0, -1) : d2 }), u3 = undefined, d2 = ``, f3 = ``;\n }\n function _3(e3 = {}) {\n s4 && e3.consume && m3(s4), l2 = true, u3 = undefined, d2 = ``, f3 = ``, s4 = ``;\n }\n return { feed: p3, reset: _3 };\n}\nfunction c3(e2) {\n let t2 = [], n2 = ``, r2 = 0;\n for (;r2 < e2.length; ) {\n let i3 = e2.indexOf(`\\r`, r2), a4 = e2.indexOf(`\n`, r2), o3 = -1;\n if (i3 !== -1 && a4 !== -1 ? o3 = Math.min(i3, a4) : i3 === -1 ? a4 !== -1 && (o3 = a4) : o3 = i3 === e2.length - 1 ? -1 : i3, o3 === -1) {\n n2 = e2.slice(r2);\n break;\n } else {\n let n3 = e2.slice(r2, o3);\n t2.push(n3), r2 = o3 + 1, e2[r2 - 1] === `\\r` && e2[r2] === `\n` && r2++;\n }\n }\n return [t2, n2];\n}\nvar l2 = class extends TransformStream {\n constructor({ onError: e2, onRetry: t2, onComment: n2 } = {}) {\n let r2;\n super({ start(i3) {\n r2 = s3({ onEvent: (e3) => {\n i3.enqueue(e3);\n }, onError(t3) {\n e2 === `terminate` ? i3.error(t3) : typeof e2 == `function` && e2(t3);\n }, onRetry: t2, onComment: n2 });\n }, transform(e3) {\n r2.feed(e3);\n } });\n }\n};\nvar b2 = `vercel.ai.error`;\nvar x3 = Symbol.for(b2);\nvar S2;\nvar C2 = class e2 extends Error {\n constructor({ name: e3, message: t2, cause: n2 }) {\n super(t2), this[S2] = true, this.name = e3, this.cause = n2;\n }\n static isInstance(t2) {\n return e2.hasMarker(t2, b2);\n }\n static hasMarker(e3, t2) {\n let n2 = Symbol.for(t2);\n return typeof e3 == `object` && !!e3 && n2 in e3 && typeof e3[n2] == `boolean` && e3[n2] === true;\n }\n};\nS2 = x3;\nvar w2 = C2;\nvar ee2 = `AI_APICallError`;\nvar te2 = `vercel.ai.error.${ee2}`;\nvar ne2 = Symbol.for(te2);\nvar re2;\nvar T2 = class extends w2 {\n constructor({ message: e3, url: t2, requestBodyValues: n2, statusCode: r2, responseHeaders: i3, responseBody: a4, cause: o3, isRetryable: s4 = r2 != null && (r2 === 408 || r2 === 409 || r2 === 429 || r2 >= 500), data: c4 }) {\n super({ name: ee2, message: e3, cause: o3 }), this[re2] = true, this.url = t2, this.requestBodyValues = n2, this.statusCode = r2, this.responseHeaders = i3, this.responseBody = a4, this.isRetryable = s4, this.data = c4;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, te2);\n }\n};\nre2 = ne2;\nvar ie2 = `AI_EmptyResponseBodyError`;\nvar ae2 = `vercel.ai.error.${ie2}`;\nvar oe2 = Symbol.for(ae2);\nvar se2;\nvar ce2 = class extends w2 {\n constructor({ message: e3 = `Empty response body` } = {}) {\n super({ name: ie2, message: e3 }), this[se2] = true;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, ae2);\n }\n};\nse2 = oe2;\nfunction le2(e3) {\n return e3 == null ? `unknown error` : typeof e3 == `string` ? e3 : e3 instanceof Error ? e3.message : JSON.stringify(e3);\n}\nvar ue2 = `AI_InvalidArgumentError`;\nvar de2 = `vercel.ai.error.${ue2}`;\nvar fe2 = Symbol.for(de2);\nvar pe2;\nvar me2 = class extends w2 {\n constructor({ message: e3, cause: t2, argument: n2 }) {\n super({ name: ue2, message: e3, cause: t2 }), this[pe2] = true, this.argument = n2;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, de2);\n }\n};\npe2 = fe2;\nvar he2 = `AI_InvalidPromptError`;\nvar ge2 = `vercel.ai.error.${he2}`;\nvar _e2 = Symbol.for(ge2);\nvar ve2;\nvar ye = class extends w2 {\n constructor({ prompt: e3, message: t2, cause: n2 }) {\n super({ name: he2, message: `Invalid prompt: ${t2}`, cause: n2 }), this[ve2] = true, this.prompt = e3;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, ge2);\n }\n};\nve2 = _e2;\nvar be = `AI_InvalidResponseDataError`;\nvar xe = `vercel.ai.error.${be}`;\nvar Se = Symbol.for(xe);\nvar Ce;\nvar E2 = class extends w2 {\n constructor({ data: e3, message: t2 = `Invalid response data: ${JSON.stringify(e3)}.` }) {\n super({ name: be, message: t2 }), this[Ce] = true, this.data = e3;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, xe);\n }\n};\nCe = Se;\nvar we = `AI_JSONParseError`;\nvar Te = `vercel.ai.error.${we}`;\nvar Ee = Symbol.for(Te);\nvar De;\nvar D2 = class extends w2 {\n constructor({ text: e3, cause: t2 }) {\n super({ name: we, message: `JSON parsing failed: Text: ${e3}.\nError message: ${le2(t2)}`, cause: t2 }), this[De] = true, this.text = e3;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, Te);\n }\n};\nDe = Ee;\nvar Oe = `AI_LoadAPIKeyError`;\nvar ke = `vercel.ai.error.${Oe}`;\nvar Ae = Symbol.for(ke);\nvar je;\nvar O2 = class extends w2 {\n constructor({ message: e3 }) {\n super({ name: Oe, message: e3 }), this[je] = true;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, ke);\n }\n};\nje = Ae;\nvar Me = `AI_NoSuchModelError`;\nvar Ne = `vercel.ai.error.${Me}`;\nvar Pe = Symbol.for(Ne);\nvar Fe;\nvar k2 = class extends w2 {\n constructor({ errorName: e3 = Me, modelId: t2, modelType: n2, message: r2 = `No such ${n2}: ${t2}` }) {\n super({ name: e3, message: r2 }), this[Fe] = true, this.modelId = t2, this.modelType = n2;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, Ne);\n }\n};\nFe = Pe;\nvar Ie = `AI_TooManyEmbeddingValuesForCallError`;\nvar Le = `vercel.ai.error.${Ie}`;\nvar Re = Symbol.for(Le);\nvar ze;\nvar Be = class extends w2 {\n constructor(e3) {\n super({ name: Ie, message: `Too many values for a single embedding call. The ${e3.provider} model "${e3.modelId}" can only embed up to ${e3.maxEmbeddingsPerCall} values per call, but ${e3.values.length} values were provided.` }), this[ze] = true, this.provider = e3.provider, this.modelId = e3.modelId, this.maxEmbeddingsPerCall = e3.maxEmbeddingsPerCall, this.values = e3.values;\n }\n static isInstance(e3) {\n return w2.hasMarker(e3, Le);\n }\n};\nze = Re;\nvar Ve = `AI_TypeValidationError`;\nvar He = `vercel.ai.error.${Ve}`;\nvar Ue = Symbol.for(He);\nvar We;\nvar Ge = class e3 extends w2 {\n constructor({ value: e4, cause: t2 }) {\n super({ name: Ve, message: `Type validation failed: Value: ${JSON.stringify(e4)}.\nError message: ${le2(t2)}`, cause: t2 }), this[We] = true, this.value = e4;\n }\n static isInstance(e4) {\n return w2.hasMarker(e4, He);\n }\n static wrap({ value: t2, cause: n2 }) {\n return e3.isInstance(n2) && n2.value === t2 ? n2 : new e3({ value: t2, cause: n2 });\n }\n};\nWe = Ue;\nvar A2 = Ge;\nvar Ke = `AI_UnsupportedFunctionalityError`;\nvar qe = `vercel.ai.error.${Ke}`;\nvar Je = Symbol.for(qe);\nvar Ye;\nvar j2 = class extends w2 {\n constructor({ functionality: e4, message: t2 = `\'${e4}\' functionality not supported.` }) {\n super({ name: Ke, message: t2 }), this[Ye] = true, this.functionality = e4;\n }\n static isInstance(e4) {\n return w2.hasMarker(e4, qe);\n }\n};\nYe = Je;\nfunction M2(...e4) {\n return e4.reduce((e5, t2) => ({ ...e5, ...t2 ?? {} }), {});\n}\nfunction N2(e4) {\n return Object.fromEntries([...e4.headers]);\n}\nfunction Xe(e4 = globalThis) {\n return e4.window ? `runtime/browser` : e4.navigator?.userAgent ? `runtime/${e4.navigator.userAgent.toLowerCase()}` : e4.process?.versions?.node ? `runtime/node.js/${e4.process.version.substring(0)}` : e4.EdgeRuntime ? `runtime/vercel-edge` : `runtime/unknown`;\n}\nfunction Ze(e4) {\n return Object.fromEntries(Object.entries(e4).filter(([e5, t2]) => t2 != null));\n}\nfunction P2(e4, ...t2) {\n let n2 = Ze(e4 ?? {}), r2 = new Headers(n2), i3 = r2.get(`user-agent`) || ``;\n return r2.set(`user-agent`, [i3, ...t2].filter(Boolean).join(` `)), Object.fromEntries(r2);\n}\nvar F2 = (({ prefix: e4, size: t2 = 16, alphabet: n2 = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`, separator: r2 = `-` } = {}) => {\n let i3 = () => {\n let e5 = n2.length, r3 = Array(t2);\n for (let i4 = 0;i4 < t2; i4++)\n r3[i4] = n2[Math.random() * e5 | 0];\n return r3.join(``);\n };\n if (e4 == null)\n return i3;\n if (n2.includes(r2))\n throw new me2({ argument: `separator`, message: `The separator "${r2}" must not be part of the alphabet "${n2}".` });\n return () => `${e4}${r2}${i3()}`;\n})();\nfunction Qe(e4) {\n return (e4 instanceof Error || e4 instanceof DOMException) && (e4.name === `AbortError` || e4.name === `ResponseAborted` || e4.name === `TimeoutError`);\n}\nvar $e = [`fetch failed`, `failed to fetch`];\nfunction et({ error: e4, url: t2, requestBodyValues: n2 }) {\n if (Qe(e4))\n return e4;\n if (e4 instanceof TypeError && $e.includes(e4.message.toLowerCase())) {\n let r2 = e4.cause;\n if (r2 != null)\n return new T2({ message: `Cannot connect to API: ${r2.message}`, cause: r2, url: t2, requestBodyValues: n2, isRetryable: true });\n }\n return e4;\n}\nvar tt = `3.0.10`;\nfunction I2({ apiKey: e4, environmentVariableName: t2, apiKeyParameterName: n2 = `apiKey`, description: r2 }) {\n if (typeof e4 == `string`)\n return e4;\n if (e4 != null)\n throw new O2({ message: `${r2} API key must be a string.` });\n if (typeof process > `u`)\n throw new O2({ message: `${r2} API key is missing. Pass it using the \'${n2}\' parameter. Environment variables is not supported in this environment.` });\n if (e4 = process.env[t2], e4 == null)\n throw new O2({ message: `${r2} API key is missing. Pass it using the \'${n2}\' parameter or the ${t2} environment variable.` });\n if (typeof e4 != `string`)\n throw new O2({ message: `${r2} API key must be a string. The value of the ${t2} environment variable is not a string.` });\n return e4;\n}\nfunction nt({ settingValue: e4, environmentVariableName: t2 }) {\n if (typeof e4 == `string` || !(e4 != null || typeof process > `u`) && (e4 = process.env[t2], !(e4 == null || typeof e4 != `string`)))\n return e4;\n}\nfunction rt(e4) {\n let [t2, n2 = ``] = e4.toLowerCase().split(`/`);\n return { mpeg: `mp3`, "x-wav": `wav`, opus: `ogg`, mp4: `m4a`, "x-m4a": `m4a` }[n2] ?? n2;\n}\nvar it = /"__proto__"\\s*:/;\nvar at = /"constructor"\\s*:/;\nfunction ot(e4) {\n let t2 = JSON.parse(e4);\n return typeof t2 != `object` || !t2 || it.test(e4) === false && at.test(e4) === false ? t2 : st(t2);\n}\nfunction st(e4) {\n let t2 = [e4];\n for (;t2.length; ) {\n let e5 = t2;\n t2 = [];\n for (let n2 of e5) {\n if (Object.prototype.hasOwnProperty.call(n2, `__proto__`) || Object.prototype.hasOwnProperty.call(n2, `constructor`) && Object.prototype.hasOwnProperty.call(n2.constructor, `prototype`))\n throw SyntaxError(`Object contains forbidden prototype property`);\n for (let e6 in n2) {\n let r2 = n2[e6];\n r2 && typeof r2 == `object` && t2.push(r2);\n }\n }\n }\n return e4;\n}\nfunction ct(e4) {\n let { stackTraceLimit: t2 } = Error;\n Error.stackTraceLimit = 0;\n try {\n return ot(e4);\n } finally {\n Error.stackTraceLimit = t2;\n }\n}\nvar lt = Symbol.for(`vercel.ai.validator`);\nfunction ut(e4) {\n return { [lt]: true, validate: e4 };\n}\nfunction dt(e4) {\n return typeof e4 == `object` && !!e4 && lt in e4 && e4[lt] === true && `validate` in e4;\n}\nfunction ft(e4) {\n return dt(e4) ? e4 : pt(e4);\n}\nfunction pt(e4) {\n return ut(async (t2) => {\n let n2 = await e4[`~standard`].validate(t2);\n return n2.issues == null ? { success: true, value: n2.value } : { success: false, error: new A2({ value: t2, cause: n2.issues }) };\n });\n}\nasync function mt({ value: e4, schema: t2 }) {\n let n2 = await ht({ value: e4, schema: t2 });\n if (!n2.success)\n throw A2.wrap({ value: e4, cause: n2.error });\n return n2.value;\n}\nasync function ht({ value: e4, schema: t2 }) {\n let n2 = ft(t2);\n try {\n if (n2.validate == null)\n return { success: true, value: e4, rawValue: e4 };\n let t3 = await n2.validate(e4);\n return t3.success ? { success: true, value: t3.value, rawValue: e4 } : { success: false, error: A2.wrap({ value: e4, cause: t3.error }), rawValue: e4 };\n } catch (t3) {\n return { success: false, error: A2.wrap({ value: e4, cause: t3 }), rawValue: e4 };\n }\n}\nasync function gt({ text: e4, schema: t2 }) {\n try {\n let n2 = ct(e4);\n return t2 == null ? n2 : mt({ value: n2, schema: t2 });\n } catch (t3) {\n throw D2.isInstance(t3) || A2.isInstance(t3) ? t3 : new D2({ text: e4, cause: t3 });\n }\n}\nasync function _t({ text: e4, schema: t2 }) {\n try {\n let n2 = ct(e4);\n return t2 == null ? { success: true, value: n2, rawValue: n2 } : await ht({ value: n2, schema: t2 });\n } catch (t3) {\n return { success: false, error: D2.isInstance(t3) ? t3 : new D2({ text: e4, cause: t3 }), rawValue: undefined };\n }\n}\nfunction vt(e4) {\n try {\n return ct(e4), true;\n } catch {\n return false;\n }\n}\nfunction yt({ stream: e4, schema: t2 }) {\n return e4.pipeThrough(new TextDecoderStream).pipeThrough(new l2).pipeThrough(new TransformStream({ async transform({ data: e5 }, n2) {\n e5 !== `[DONE]` && n2.enqueue(await _t({ text: e5, schema: t2 }));\n } }));\n}\nasync function L2({ provider: e4, providerOptions: t2, schema: n2 }) {\n if (t2?.[e4] == null)\n return;\n let r2 = await ht({ value: t2[e4], schema: n2 });\n if (!r2.success)\n throw new me2({ argument: `providerOptions`, message: `invalid ${e4} provider options`, cause: r2.error });\n return r2.value;\n}\nvar bt = () => globalThis.fetch;\nvar R2 = async ({ url: e4, headers: t2, body: n2, failedResponseHandler: r2, successfulResponseHandler: i3, abortSignal: a4, fetch: o3 }) => St({ url: e4, headers: { "Content-Type": `application/json`, ...t2 }, body: { content: JSON.stringify(n2), values: n2 }, failedResponseHandler: r2, successfulResponseHandler: i3, abortSignal: a4, fetch: o3 });\nvar xt = async ({ url: e4, headers: t2, formData: n2, failedResponseHandler: r2, successfulResponseHandler: i3, abortSignal: a4, fetch: o3 }) => St({ url: e4, headers: t2, body: { content: n2, values: Object.fromEntries(n2.entries()) }, failedResponseHandler: r2, successfulResponseHandler: i3, abortSignal: a4, fetch: o3 });\nvar St = async ({ url: e4, headers: t2 = {}, body: n2, successfulResponseHandler: r2, failedResponseHandler: i3, abortSignal: a4, fetch: o3 = bt() }) => {\n try {\n let s4 = await o3(e4, { method: `POST`, headers: P2(t2, `ai-sdk/provider-utils/${tt}`, Xe()), body: n2.content, signal: a4 }), c4 = N2(s4);\n if (!s4.ok) {\n let t3;\n try {\n t3 = await i3({ response: s4, url: e4, requestBodyValues: n2.values });\n } catch (t4) {\n throw Qe(t4) || T2.isInstance(t4) ? t4 : new T2({ message: `Failed to process error response`, cause: t4, statusCode: s4.status, url: e4, responseHeaders: c4, requestBodyValues: n2.values });\n }\n throw t3.value;\n }\n try {\n return await r2({ response: s4, url: e4, requestBodyValues: n2.values });\n } catch (t3) {\n throw t3 instanceof Error && (Qe(t3) || T2.isInstance(t3)) ? t3 : new T2({ message: `Failed to process successful response`, cause: t3, statusCode: s4.status, url: e4, responseHeaders: c4, requestBodyValues: n2.values });\n }\n } catch (t3) {\n throw et({ error: t3, url: e4, requestBodyValues: n2.values });\n }\n};\nfunction Ct(e4) {\n return e4;\n}\nfunction z2({ id: e4, name: t2, inputSchema: n2 }) {\n return ({ execute: r2, outputSchema: i3, toModelOutput: a4, onInputStart: o3, onInputDelta: s4, onInputAvailable: c4, ...l3 }) => Ct({ type: `provider-defined`, id: e4, name: t2, args: l3, inputSchema: n2, outputSchema: i3, execute: r2, toModelOutput: a4, onInputStart: o3, onInputDelta: s4, onInputAvailable: c4 });\n}\nfunction B2({ id: e4, name: t2, inputSchema: n2, outputSchema: r2 }) {\n return ({ execute: i3, toModelOutput: a4, onInputStart: o3, onInputDelta: s4, onInputAvailable: c4, ...l3 }) => Ct({ type: `provider-defined`, id: e4, name: t2, args: l3, inputSchema: n2, outputSchema: r2, execute: i3, toModelOutput: a4, onInputStart: o3, onInputDelta: s4, onInputAvailable: c4 });\n}\nasync function V2(e4) {\n return typeof e4 == `function` && (e4 = e4()), Promise.resolve(e4);\n}\nvar H2 = ({ errorSchema: e4, errorToMessage: t2, isRetryable: n2 }) => async ({ response: r2, url: i3, requestBodyValues: a4 }) => {\n let o3 = await r2.text(), s4 = N2(r2);\n if (o3.trim() === ``)\n return { responseHeaders: s4, value: new T2({ message: r2.statusText, url: i3, requestBodyValues: a4, statusCode: r2.status, responseHeaders: s4, responseBody: o3, isRetryable: n2?.(r2) }) };\n try {\n let c4 = await gt({ text: o3, schema: e4 });\n return { responseHeaders: s4, value: new T2({ message: t2(c4), url: i3, requestBodyValues: a4, statusCode: r2.status, responseHeaders: s4, responseBody: o3, data: c4, isRetryable: n2?.(r2, c4) }) };\n } catch {\n return { responseHeaders: s4, value: new T2({ message: r2.statusText, url: i3, requestBodyValues: a4, statusCode: r2.status, responseHeaders: s4, responseBody: o3, isRetryable: n2?.(r2) }) };\n }\n};\nvar U2 = (e4) => async ({ response: t2 }) => {\n let n2 = N2(t2);\n if (t2.body == null)\n throw new ce2({});\n return { responseHeaders: n2, value: yt({ stream: t2.body, schema: e4 }) };\n};\nvar W2 = (e4) => async ({ response: t2, url: n2, requestBodyValues: r2 }) => {\n let i3 = await t2.text(), a4 = await _t({ text: i3, schema: e4 }), o3 = N2(t2);\n if (!a4.success)\n throw new T2({ message: `Invalid JSON response`, cause: a4.error, statusCode: t2.status, responseHeaders: o3, responseBody: i3, url: n2, requestBodyValues: r2 });\n return { responseHeaders: o3, value: a4.value, rawValue: a4.rawValue };\n};\nvar wt = () => async ({ response: e4, url: t2, requestBodyValues: n2 }) => {\n let r2 = N2(e4);\n if (!e4.body)\n throw new T2({ message: `Response body is empty`, url: t2, requestBodyValues: n2, statusCode: e4.status, responseHeaders: r2, responseBody: undefined });\n try {\n let t3 = await e4.arrayBuffer();\n return { responseHeaders: r2, value: new Uint8Array(t3) };\n } catch (i3) {\n throw new T2({ message: `Failed to read response as array buffer`, url: t2, requestBodyValues: n2, statusCode: e4.status, responseHeaders: r2, responseBody: undefined, cause: i3 });\n }\n};\nvar { btoa: Tt, atob: Et } = globalThis;\nfunction Dt(e4) {\n let t2 = e4.replace(/-/g, `+`).replace(/_/g, `/`), n2 = Et(t2);\n return Uint8Array.from(n2, (e5) => e5.codePointAt(0));\n}\nfunction Ot(e4) {\n let t2 = ``;\n for (let n2 = 0;n2 < e4.length; n2++)\n t2 += String.fromCodePoint(e4[n2]);\n return Tt(t2);\n}\nfunction G2(e4) {\n return e4 instanceof Uint8Array ? Ot(e4) : e4;\n}\nfunction K2(e4) {\n return e4?.replace(/\\/$/, ``);\n}\nvar kt = `2.0.23`;\nvar At = exports_external.object({ type: exports_external.literal(`error`), error: exports_external.object({ type: exports_external.string(), message: exports_external.string() }) });\nvar jt = H2({ errorSchema: At, errorToMessage: (e4) => e4.error.message });\nvar Mt = exports_external.object({ citations: exports_external.object({ enabled: exports_external.boolean() }).optional(), title: exports_external.string().optional(), context: exports_external.string().optional() });\nvar Nt = exports_external.object({ sendReasoning: exports_external.boolean().optional(), thinking: exports_external.object({ type: exports_external.union([exports_external.literal(`enabled`), exports_external.literal(`disabled`)]), budgetTokens: exports_external.number().optional() }).optional(), disableParallelToolUse: exports_external.boolean().optional(), cacheControl: exports_external.object({ type: exports_external.literal(`ephemeral`), ttl: exports_external.union([exports_external.literal(`5m`), exports_external.literal(`1h`)]).optional() }).optional() });\nfunction q2(e4) {\n let t2 = e4?.anthropic;\n return t2?.cacheControl ?? t2?.cache_control;\n}\nvar Pt = exports_external.object({ maxCharacters: exports_external.number().optional() });\nvar Ft = z2({ id: `anthropic.text_editor_20250728`, name: `str_replace_based_edit_tool`, inputSchema: exports_external.object({ command: exports_external.enum([`view`, `create`, `str_replace`, `insert`]), path: exports_external.string(), file_text: exports_external.string().optional(), insert_line: exports_external.number().int().optional(), new_str: exports_external.string().optional(), old_str: exports_external.string().optional(), view_range: exports_external.array(exports_external.number().int()).optional() }) });\nvar It = (e4 = {}) => Ft(e4);\nvar Lt = exports_external.object({ maxUses: exports_external.number().optional(), allowedDomains: exports_external.array(exports_external.string()).optional(), blockedDomains: exports_external.array(exports_external.string()).optional(), userLocation: exports_external.object({ type: exports_external.literal(`approximate`), city: exports_external.string().optional(), region: exports_external.string().optional(), country: exports_external.string().optional(), timezone: exports_external.string().optional() }).optional() });\nvar Rt = exports_external.array(exports_external.object({ url: exports_external.string(), title: exports_external.string(), pageAge: exports_external.string().nullable(), encryptedContent: exports_external.string(), type: exports_external.literal(`web_search_result`) }));\nvar zt = B2({ id: `anthropic.web_search_20250305`, name: `web_search`, inputSchema: exports_external.object({ query: exports_external.string() }), outputSchema: Rt });\nvar Bt = (e4 = {}) => zt(e4);\nvar Vt = exports_external.object({ maxUses: exports_external.number().optional(), allowedDomains: exports_external.array(exports_external.string()).optional(), blockedDomains: exports_external.array(exports_external.string()).optional(), citations: exports_external.object({ enabled: exports_external.boolean() }).optional(), maxContentTokens: exports_external.number().optional() });\nvar Ht = exports_external.object({ type: exports_external.literal(`web_fetch_result`), url: exports_external.string(), content: exports_external.object({ type: exports_external.literal(`document`), title: exports_external.string(), citations: exports_external.object({ enabled: exports_external.boolean() }).optional(), source: exports_external.union([exports_external.object({ type: exports_external.literal(`base64`), mediaType: exports_external.literal(`application/pdf`), data: exports_external.string() }), exports_external.object({ type: exports_external.literal(`text`), mediaType: exports_external.literal(`text/plain`), data: exports_external.string() })]) }), retrievedAt: exports_external.string().nullable() });\nvar Ut = B2({ id: `anthropic.web_fetch_20250910`, name: `web_fetch`, inputSchema: exports_external.object({ url: exports_external.string() }), outputSchema: Ht });\nvar Wt = (e4 = {}) => Ut(e4);\nfunction Gt({ tools: e4, toolChoice: t2, disableParallelToolUse: n2 }) {\n e4 = e4?.length ? e4 : undefined;\n let r2 = [], i3 = new Set;\n if (e4 == null)\n return { tools: undefined, toolChoice: undefined, toolWarnings: r2, betas: i3 };\n let a4 = [];\n for (let t3 of e4)\n switch (t3.type) {\n case `function`: {\n let e5 = q2(t3.providerOptions);\n a4.push({ name: t3.name, description: t3.description, input_schema: t3.inputSchema, cache_control: e5 });\n break;\n }\n case `provider-defined`:\n switch (t3.id) {\n case `anthropic.code_execution_20250522`:\n i3.add(`code-execution-2025-05-22`), a4.push({ type: `code_execution_20250522`, name: `code_execution` });\n break;\n case `anthropic.computer_20250124`:\n i3.add(`computer-use-2025-01-24`), a4.push({ name: `computer`, type: `computer_20250124`, display_width_px: t3.args.displayWidthPx, display_height_px: t3.args.displayHeightPx, display_number: t3.args.displayNumber });\n break;\n case `anthropic.computer_20241022`:\n i3.add(`computer-use-2024-10-22`), a4.push({ name: `computer`, type: `computer_20241022`, display_width_px: t3.args.displayWidthPx, display_height_px: t3.args.displayHeightPx, display_number: t3.args.displayNumber });\n break;\n case `anthropic.text_editor_20250124`:\n i3.add(`computer-use-2025-01-24`), a4.push({ name: `str_replace_editor`, type: `text_editor_20250124` });\n break;\n case `anthropic.text_editor_20241022`:\n i3.add(`computer-use-2024-10-22`), a4.push({ name: `str_replace_editor`, type: `text_editor_20241022` });\n break;\n case `anthropic.text_editor_20250429`:\n i3.add(`computer-use-2025-01-24`), a4.push({ name: `str_replace_based_edit_tool`, type: `text_editor_20250429` });\n break;\n case `anthropic.text_editor_20250728`: {\n let e5 = Pt.parse(t3.args);\n a4.push({ name: `str_replace_based_edit_tool`, type: `text_editor_20250728`, max_characters: e5.maxCharacters });\n break;\n }\n case `anthropic.bash_20250124`:\n i3.add(`computer-use-2025-01-24`), a4.push({ name: `bash`, type: `bash_20250124` });\n break;\n case `anthropic.bash_20241022`:\n i3.add(`computer-use-2024-10-22`), a4.push({ name: `bash`, type: `bash_20241022` });\n break;\n case `anthropic.web_fetch_20250910`: {\n i3.add(`web-fetch-2025-09-10`);\n let e5 = Vt.parse(t3.args);\n a4.push({ type: `web_fetch_20250910`, name: `web_fetch`, max_uses: e5.maxUses, allowed_domains: e5.allowedDomains, blocked_domains: e5.blockedDomains, citations: e5.citations, max_content_tokens: e5.maxContentTokens });\n break;\n }\n case `anthropic.web_search_20250305`: {\n let e5 = Lt.parse(t3.args);\n a4.push({ type: `web_search_20250305`, name: `web_search`, max_uses: e5.maxUses, allowed_domains: e5.allowedDomains, blocked_domains: e5.blockedDomains, user_location: e5.userLocation });\n break;\n }\n default:\n r2.push({ type: `unsupported-tool`, tool: t3 });\n break;\n }\n break;\n default:\n r2.push({ type: `unsupported-tool`, tool: t3 });\n break;\n }\n if (t2 == null)\n return { tools: a4, toolChoice: n2 ? { type: `auto`, disable_parallel_tool_use: n2 } : undefined, toolWarnings: r2, betas: i3 };\n let o3 = t2.type;\n switch (o3) {\n case `auto`:\n return { tools: a4, toolChoice: { type: `auto`, disable_parallel_tool_use: n2 }, toolWarnings: r2, betas: i3 };\n case `required`:\n return { tools: a4, toolChoice: { type: `any`, disable_parallel_tool_use: n2 }, toolWarnings: r2, betas: i3 };\n case `none`:\n return { tools: undefined, toolChoice: undefined, toolWarnings: r2, betas: i3 };\n case `tool`:\n return { tools: a4, toolChoice: { type: `tool`, name: t2.toolName, disable_parallel_tool_use: n2 }, toolWarnings: r2, betas: i3 };\n default:\n throw new j2({ functionality: `tool choice type: ${o3}` });\n }\n}\nvar Kt = exports_external.object({ type: exports_external.literal(`code_execution_result`), stdout: exports_external.string(), stderr: exports_external.string(), return_code: exports_external.number() });\nvar qt = B2({ id: `anthropic.code_execution_20250522`, name: `code_execution`, inputSchema: exports_external.object({ code: exports_external.string() }), outputSchema: Kt });\nvar Jt = (e4 = {}) => qt(e4);\nfunction Yt(e4) {\n if (typeof e4 == `string`)\n return Buffer.from(e4, `base64`).toString(`utf-8`);\n if (e4 instanceof Uint8Array)\n return new TextDecoder().decode(e4);\n throw e4 instanceof URL ? new j2({ functionality: `URL-based text documents are not supported for citations` }) : new j2({ functionality: `unsupported data type for text documents: ${typeof e4}` });\n}\nasync function Xt({ prompt: e4, sendReasoning: t2, warnings: n2 }) {\n let r2 = new Set, i3 = Zt(e4), a4, o3 = [];\n async function s4(e5) {\n return (await L2({ provider: `anthropic`, providerOptions: e5, schema: Mt }))?.citations?.enabled ?? false;\n }\n async function c4(e5) {\n let t3 = await L2({ provider: `anthropic`, providerOptions: e5, schema: Mt });\n return { title: t3?.title, context: t3?.context };\n }\n for (let e5 = 0;e5 < i3.length; e5++) {\n let l3 = i3[e5], u3 = e5 === i3.length - 1, d2 = l3.type;\n switch (d2) {\n case `system`:\n if (a4 != null)\n throw new j2({ functionality: `Multiple system messages that are separated by user/assistant messages` });\n a4 = l3.messages.map(({ content: e6, providerOptions: t3 }) => ({ type: `text`, text: e6, cache_control: q2(t3) }));\n break;\n case `user`: {\n let e6 = [];\n for (let t3 of l3.messages) {\n let { role: n3, content: i4 } = t3;\n switch (n3) {\n case `user`:\n for (let n4 = 0;n4 < i4.length; n4++) {\n let a5 = i4[n4], o4 = n4 === i4.length - 1, l4 = q2(a5.providerOptions) ?? (o4 ? q2(t3.providerOptions) : undefined);\n switch (a5.type) {\n case `text`:\n e6.push({ type: `text`, text: a5.text, cache_control: l4 });\n break;\n case `file`:\n if (a5.mediaType.startsWith(`image/`))\n e6.push({ type: `image`, source: a5.data instanceof URL ? { type: `url`, url: a5.data.toString() } : { type: `base64`, media_type: a5.mediaType === `image/*` ? `image/jpeg` : a5.mediaType, data: G2(a5.data) }, cache_control: l4 });\n else if (a5.mediaType === `application/pdf`) {\n r2.add(`pdfs-2024-09-25`);\n let t4 = await s4(a5.providerOptions), n5 = await c4(a5.providerOptions);\n e6.push({ type: `document`, source: a5.data instanceof URL ? { type: `url`, url: a5.data.toString() } : { type: `base64`, media_type: `application/pdf`, data: G2(a5.data) }, title: n5.title ?? a5.filename, ...n5.context && { context: n5.context }, ...t4 && { citations: { enabled: true } }, cache_control: l4 });\n } else if (a5.mediaType === `text/plain`) {\n let t4 = await s4(a5.providerOptions), n5 = await c4(a5.providerOptions);\n e6.push({ type: `document`, source: a5.data instanceof URL ? { type: `url`, url: a5.data.toString() } : { type: `text`, media_type: `text/plain`, data: Yt(a5.data) }, title: n5.title ?? a5.filename, ...n5.context && { context: n5.context }, ...t4 && { citations: { enabled: true } }, cache_control: l4 });\n } else\n throw new j2({ functionality: `media type: ${a5.mediaType}` });\n break;\n }\n }\n break;\n case `tool`:\n for (let n4 = 0;n4 < i4.length; n4++) {\n let r3 = i4[n4], a5 = n4 === i4.length - 1, o4 = q2(r3.providerOptions) ?? (a5 ? q2(t3.providerOptions) : undefined), s5 = r3.output, c5;\n switch (s5.type) {\n case `content`:\n c5 = s5.value.map((e7) => {\n switch (e7.type) {\n case `text`:\n return { type: `text`, text: e7.text, cache_control: undefined };\n case `media`:\n if (e7.mediaType.startsWith(`image/`))\n return { type: `image`, source: { type: `base64`, media_type: e7.mediaType, data: e7.data }, cache_control: undefined };\n throw new j2({ functionality: `media type: ${e7.mediaType}` });\n }\n });\n break;\n case `text`:\n case `error-text`:\n c5 = s5.value;\n break;\n case `json`:\n case `error-json`:\n default:\n c5 = JSON.stringify(s5.value);\n break;\n }\n e6.push({ type: `tool_result`, tool_use_id: r3.toolCallId, content: c5, is_error: s5.type === `error-text` || s5.type === `error-json` ? true : undefined, cache_control: o4 });\n }\n break;\n default: {\n let e7 = n3;\n throw Error(`Unsupported role: ${e7}`);\n }\n }\n }\n o3.push({ role: `user`, content: e6 });\n break;\n }\n case `assistant`: {\n let e6 = [];\n for (let r3 = 0;r3 < l3.messages.length; r3++) {\n let i4 = l3.messages[r3], a5 = r3 === l3.messages.length - 1, { content: o4 } = i4;\n for (let r4 = 0;r4 < o4.length; r4++) {\n let s5 = o4[r4], c5 = r4 === o4.length - 1, l4 = q2(s5.providerOptions) ?? (c5 ? q2(i4.providerOptions) : undefined);\n switch (s5.type) {\n case `text`:\n e6.push({ type: `text`, text: u3 && a5 && c5 ? s5.text.trim() : s5.text, cache_control: l4 });\n break;\n case `reasoning`:\n if (t2) {\n let t3 = await L2({ provider: `anthropic`, providerOptions: s5.providerOptions, schema: on });\n t3 == null ? n2.push({ type: `other`, message: `unsupported reasoning metadata` }) : t3.signature == null ? t3.redactedData == null ? n2.push({ type: `other`, message: `unsupported reasoning metadata` }) : e6.push({ type: `redacted_thinking`, data: t3.redactedData, cache_control: l4 }) : e6.push({ type: `thinking`, thinking: s5.text, signature: t3.signature, cache_control: l4 });\n } else\n n2.push({ type: `other`, message: `sending reasoning content is disabled for this model` });\n break;\n case `tool-call`:\n if (s5.providerExecuted) {\n s5.toolName === `code_execution` || s5.toolName === `web_fetch` || s5.toolName === `web_search` ? e6.push({ type: `server_tool_use`, id: s5.toolCallId, name: s5.toolName, input: s5.input, cache_control: l4 }) : n2.push({ type: `other`, message: `provider executed tool call for tool ${s5.toolName} is not supported` });\n break;\n }\n e6.push({ type: `tool_use`, id: s5.toolCallId, name: s5.toolName, input: s5.input, cache_control: l4 });\n break;\n case `tool-result`:\n if (s5.toolName === `code_execution`) {\n let t3 = s5.output;\n if (t3.type !== `json`) {\n n2.push({ type: `other`, message: `provider executed tool result output type ${t3.type} for tool ${s5.toolName} is not supported` });\n break;\n }\n let r5 = Kt.parse(t3.value);\n e6.push({ type: `code_execution_tool_result`, tool_use_id: s5.toolCallId, content: { type: r5.type, stdout: r5.stdout, stderr: r5.stderr, return_code: r5.return_code }, cache_control: l4 });\n break;\n }\n if (s5.toolName === `web_fetch`) {\n let t3 = s5.output;\n if (t3.type !== `json`) {\n n2.push({ type: `other`, message: `provider executed tool result output type ${t3.type} for tool ${s5.toolName} is not supported` });\n break;\n }\n let r5 = Ht.parse(t3.value);\n e6.push({ type: `web_fetch_tool_result`, tool_use_id: s5.toolCallId, content: { type: `web_fetch_result`, url: r5.url, retrieved_at: r5.retrievedAt, content: { type: `document`, title: r5.content.title, citations: r5.content.citations, source: { type: r5.content.source.type, media_type: r5.content.source.mediaType, data: r5.content.source.data } } }, cache_control: l4 });\n break;\n }\n if (s5.toolName === `web_search`) {\n let t3 = s5.output;\n if (t3.type !== `json`) {\n n2.push({ type: `other`, message: `provider executed tool result output type ${t3.type} for tool ${s5.toolName} is not supported` });\n break;\n }\n let r5 = Rt.parse(t3.value);\n e6.push({ type: `web_search_tool_result`, tool_use_id: s5.toolCallId, content: r5.map((e7) => ({ url: e7.url, title: e7.title, page_age: e7.pageAge, encrypted_content: e7.encryptedContent, type: e7.type })), cache_control: l4 });\n break;\n }\n n2.push({ type: `other`, message: `provider executed tool result for tool ${s5.toolName} is not supported` });\n break;\n }\n }\n }\n o3.push({ role: `assistant`, content: e6 });\n break;\n }\n default: {\n let e6 = d2;\n throw Error(`content type: ${e6}`);\n }\n }\n }\n return { prompt: { system: a4, messages: o3 }, betas: r2 };\n}\nfunction Zt(e4) {\n let t2 = [], n2;\n for (let r2 of e4) {\n let { role: e5 } = r2;\n switch (e5) {\n case `system`:\n n2?.type !== `system` && (n2 = { type: `system`, messages: [] }, t2.push(n2)), n2.messages.push(r2);\n break;\n case `assistant`:\n n2?.type !== `assistant` && (n2 = { type: `assistant`, messages: [] }, t2.push(n2)), n2.messages.push(r2);\n break;\n case `user`:\n n2?.type !== `user` && (n2 = { type: `user`, messages: [] }, t2.push(n2)), n2.messages.push(r2);\n break;\n case `tool`:\n n2?.type !== `user` && (n2 = { type: `user`, messages: [] }, t2.push(n2)), n2.messages.push(r2);\n break;\n default: {\n let t3 = e5;\n throw Error(`Unsupported role: ${t3}`);\n }\n }\n }\n return t2;\n}\nfunction Qt({ finishReason: e4, isJsonResponseFromTool: t2 }) {\n switch (e4) {\n case `pause_turn`:\n case `end_turn`:\n case `stop_sequence`:\n return `stop`;\n case `refusal`:\n return `content-filter`;\n case `tool_use`:\n return t2 ? `stop` : `tool-calls`;\n case `max_tokens`:\n return `length`;\n default:\n return `unknown`;\n }\n}\nvar J2 = { webSearchResult: exports_external.object({ type: exports_external.literal(`web_search_result_location`), cited_text: exports_external.string(), url: exports_external.string(), title: exports_external.string(), encrypted_index: exports_external.string() }), pageLocation: exports_external.object({ type: exports_external.literal(`page_location`), cited_text: exports_external.string(), document_index: exports_external.number(), document_title: exports_external.string().nullable(), start_page_number: exports_external.number(), end_page_number: exports_external.number() }), charLocation: exports_external.object({ type: exports_external.literal(`char_location`), cited_text: exports_external.string(), document_index: exports_external.number(), document_title: exports_external.string().nullable(), start_char_index: exports_external.number(), end_char_index: exports_external.number() }) };\nvar $t = exports_external.discriminatedUnion(`type`, [J2.webSearchResult, J2.pageLocation, J2.charLocation]);\nexports_external.discriminatedUnion(`type`, [J2.pageLocation, J2.charLocation]);\nfunction en(e4, t2, n2, r2) {\n if (e4.type === `page_location` || e4.type === `char_location`) {\n let i3 = tn(e4, t2, n2);\n i3 && r2(i3);\n }\n}\nfunction tn(e4, t2, n2) {\n let r2 = t2[e4.document_index];\n if (!r2)\n return null;\n let i3 = e4.type === `page_location` ? { citedText: e4.cited_text, startPageNumber: e4.start_page_number, endPageNumber: e4.end_page_number } : { citedText: e4.cited_text, startCharIndex: e4.start_char_index, endCharIndex: e4.end_char_index };\n return { type: `source`, sourceType: `document`, id: n2(), mediaType: r2.mediaType, title: e4.document_title ?? r2.title, filename: r2.filename, providerMetadata: { anthropic: i3 } };\n}\nvar nn = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.modelId = e4, this.config = t2, this.generateId = t2.generateId ?? F2;\n }\n supportsUrl(e4) {\n return e4.protocol === `https:`;\n }\n get provider() {\n return this.config.provider;\n }\n get supportedUrls() {\n var e4;\n return (e4 = this.config).supportedUrls?.call(e4) ?? {};\n }\n async getArgs({ prompt: e4, maxOutputTokens: t2 = 4096, temperature: n2, topP: r2, topK: i3, frequencyPenalty: a4, presencePenalty: o3, stopSequences: s4, responseFormat: c4, seed: l3, tools: u3, toolChoice: d2, providerOptions: f3 }) {\n let p3 = [];\n a4 != null && p3.push({ type: `unsupported-setting`, setting: `frequencyPenalty` }), o3 != null && p3.push({ type: `unsupported-setting`, setting: `presencePenalty` }), l3 != null && p3.push({ type: `unsupported-setting`, setting: `seed` }), c4?.type === `json` && (c4.schema == null ? p3.push({ type: `unsupported-setting`, setting: `responseFormat`, details: `JSON response format requires a schema. The response format is ignored.` }) : u3 != null && p3.push({ type: `unsupported-setting`, setting: `tools`, details: `JSON response format does not support tools. The provided tools are ignored.` }));\n let m3 = c4?.type === `json` && c4.schema != null ? { type: `function`, name: `json`, description: `Respond with a JSON object.`, inputSchema: c4.schema } : undefined, h3 = await L2({ provider: `anthropic`, providerOptions: f3, schema: Nt }), { prompt: g3, betas: _3 } = await Xt({ prompt: e4, sendReasoning: h3?.sendReasoning ?? true, warnings: p3 }), v3 = h3?.thinking?.type === `enabled`, y3 = h3?.thinking?.budgetTokens, b3 = { model: this.modelId, max_tokens: t2, temperature: n2, top_k: i3, top_p: r2, stop_sequences: s4, ...v3 && { thinking: { type: `enabled`, budget_tokens: y3 } }, system: g3.system, messages: g3.messages };\n if (v3) {\n if (y3 == null)\n throw new j2({ functionality: `thinking requires a budget` });\n b3.temperature != null && (b3.temperature = undefined, p3.push({ type: `unsupported-setting`, setting: `temperature`, details: `temperature is not supported when thinking is enabled` })), i3 != null && (b3.top_k = undefined, p3.push({ type: `unsupported-setting`, setting: `topK`, details: `topK is not supported when thinking is enabled` })), r2 != null && (b3.top_p = undefined, p3.push({ type: `unsupported-setting`, setting: `topP`, details: `topP is not supported when thinking is enabled` })), b3.max_tokens = t2 + y3;\n }\n let { tools: x4, toolChoice: S3, toolWarnings: C3, betas: w3 } = Gt(m3 == null ? { tools: u3 ?? [], toolChoice: d2, disableParallelToolUse: h3?.disableParallelToolUse } : { tools: [m3], toolChoice: { type: `tool`, toolName: m3.name }, disableParallelToolUse: true });\n return { args: { ...b3, tools: x4, tool_choice: S3 }, warnings: [...p3, ...C3], betas: new Set([..._3, ...w3]), usesJsonResponseTool: m3 != null };\n }\n async getHeaders({ betas: e4, headers: t2 }) {\n return M2(await V2(this.config.headers), e4.size > 0 ? { "anthropic-beta": Array.from(e4).join(`,`) } : {}, t2);\n }\n buildRequestUrl(e4) {\n var t2;\n return (t2 = this.config).buildRequestUrl?.call(t2, this.config.baseURL, e4) ?? `${this.config.baseURL}/messages`;\n }\n transformRequestBody(e4) {\n var t2;\n return (t2 = this.config).transformRequestBody?.call(t2, e4) ?? e4;\n }\n extractCitationDocuments(e4) {\n return e4.filter((e5) => e5.role === `user`).flatMap((e5) => e5.content).filter((e5) => e5.type !== `file` || e5.mediaType !== `application/pdf` && e5.mediaType !== `text/plain` ? false : e5.providerOptions?.anthropic?.citations?.enabled ?? false).map((e5) => {\n let t2 = e5;\n return { title: t2.filename ?? `Untitled Document`, filename: t2.filename, mediaType: t2.mediaType };\n });\n }\n async doGenerate(e4) {\n let { args: t2, warnings: n2, betas: r2, usesJsonResponseTool: i3 } = await this.getArgs(e4), a4 = this.extractCitationDocuments(e4.prompt), { responseHeaders: o3, value: s4, rawValue: c4 } = await R2({ url: this.buildRequestUrl(false), headers: await this.getHeaders({ betas: r2, headers: e4.headers }), body: this.transformRequestBody(t2), failedResponseHandler: jt, successfulResponseHandler: W2(rn), abortSignal: e4.abortSignal, fetch: this.config.fetch }), l3 = [];\n for (let e5 of s4.content)\n switch (e5.type) {\n case `text`:\n if (!i3 && (l3.push({ type: `text`, text: e5.text }), e5.citations))\n for (let t3 of e5.citations)\n en(t3, a4, this.generateId, (e6) => l3.push(e6));\n break;\n case `thinking`:\n l3.push({ type: `reasoning`, text: e5.thinking, providerMetadata: { anthropic: { signature: e5.signature } } });\n break;\n case `redacted_thinking`:\n l3.push({ type: `reasoning`, text: ``, providerMetadata: { anthropic: { redactedData: e5.data } } });\n break;\n case `tool_use`:\n l3.push(i3 ? { type: `text`, text: JSON.stringify(e5.input) } : { type: `tool-call`, toolCallId: e5.id, toolName: e5.name, input: JSON.stringify(e5.input) });\n break;\n case `server_tool_use`:\n (e5.name === `web_search` || e5.name === `code_execution` || e5.name === `web_fetch`) && l3.push({ type: `tool-call`, toolCallId: e5.id, toolName: e5.name, input: JSON.stringify(e5.input), providerExecuted: true });\n break;\n case `web_fetch_tool_result`:\n e5.content.type === `web_fetch_result` ? l3.push({ type: `tool-result`, toolCallId: e5.tool_use_id, toolName: `web_fetch`, result: { type: `web_fetch_result`, url: e5.content.url, retrievedAt: e5.content.retrieved_at, content: { type: e5.content.content.type, title: e5.content.content.title, citations: e5.content.content.citations, source: { type: e5.content.content.source.type, mediaType: e5.content.content.source.media_type, data: e5.content.content.source.data } } }, providerExecuted: true }) : e5.content.type === `web_fetch_tool_result_error` && l3.push({ type: `tool-result`, toolCallId: e5.tool_use_id, toolName: `web_fetch`, isError: true, result: { type: `web_fetch_tool_result_error`, errorCode: e5.content.error_code }, providerExecuted: true });\n break;\n case `web_search_tool_result`:\n if (Array.isArray(e5.content)) {\n l3.push({ type: `tool-result`, toolCallId: e5.tool_use_id, toolName: `web_search`, result: e5.content.map((e6) => ({ url: e6.url, title: e6.title, pageAge: e6.page_age ?? null, encryptedContent: e6.encrypted_content, type: e6.type })), providerExecuted: true });\n for (let t3 of e5.content)\n l3.push({ type: `source`, sourceType: `url`, id: this.generateId(), url: t3.url, title: t3.title, providerMetadata: { anthropic: { pageAge: t3.page_age ?? null } } });\n } else\n l3.push({ type: `tool-result`, toolCallId: e5.tool_use_id, toolName: `web_search`, isError: true, result: { type: `web_search_tool_result_error`, errorCode: e5.content.error_code }, providerExecuted: true });\n break;\n case `code_execution_tool_result`:\n e5.content.type === `code_execution_result` ? l3.push({ type: `tool-result`, toolCallId: e5.tool_use_id, toolName: `code_execution`, result: { type: e5.content.type, stdout: e5.content.stdout, stderr: e5.content.stderr, return_code: e5.content.return_code }, providerExecuted: true }) : e5.content.type === `code_execution_tool_result_error` && l3.push({ type: `tool-result`, toolCallId: e5.tool_use_id, toolName: `code_execution`, isError: true, result: { type: `code_execution_tool_result_error`, errorCode: e5.content.error_code }, providerExecuted: true });\n break;\n }\n return { content: l3, finishReason: Qt({ finishReason: s4.stop_reason, isJsonResponseFromTool: i3 }), usage: { inputTokens: s4.usage.input_tokens, outputTokens: s4.usage.output_tokens, totalTokens: s4.usage.input_tokens + s4.usage.output_tokens, cachedInputTokens: s4.usage.cache_read_input_tokens ?? undefined }, request: { body: t2 }, response: { id: s4.id ?? undefined, modelId: s4.model ?? undefined, headers: o3, body: c4 }, warnings: n2, providerMetadata: { anthropic: { usage: s4.usage, cacheCreationInputTokens: s4.usage.cache_creation_input_tokens ?? null, stopSequence: s4.stop_sequence ?? null } } };\n }\n async doStream(e4) {\n let { args: t2, warnings: n2, betas: r2, usesJsonResponseTool: i3 } = await this.getArgs(e4), a4 = this.extractCitationDocuments(e4.prompt), o3 = { ...t2, stream: true }, { responseHeaders: s4, value: c4 } = await R2({ url: this.buildRequestUrl(true), headers: await this.getHeaders({ betas: r2, headers: e4.headers }), body: this.transformRequestBody(o3), failedResponseHandler: jt, successfulResponseHandler: U2(an), abortSignal: e4.abortSignal, fetch: this.config.fetch }), l3 = `unknown`, u3 = { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined }, d2 = {}, f3, p3 = null, m3 = null, h3, g3 = this.generateId;\n return { stream: c4.pipeThrough(new TransformStream({ start(e5) {\n e5.enqueue({ type: `stream-start`, warnings: n2 });\n }, transform(t3, n3) {\n if (e4.includeRawChunks && n3.enqueue({ type: `raw`, rawValue: t3.rawValue }), !t3.success) {\n n3.enqueue({ type: `error`, error: t3.error });\n return;\n }\n let r3 = t3.value;\n switch (r3.type) {\n case `ping`:\n return;\n case `content_block_start`: {\n let e5 = r3.content_block.type;\n switch (h3 = e5, e5) {\n case `text`:\n d2[r3.index] = { type: `text` }, n3.enqueue({ type: `text-start`, id: String(r3.index) });\n return;\n case `thinking`:\n d2[r3.index] = { type: `reasoning` }, n3.enqueue({ type: `reasoning-start`, id: String(r3.index) });\n return;\n case `redacted_thinking`:\n d2[r3.index] = { type: `reasoning` }, n3.enqueue({ type: `reasoning-start`, id: String(r3.index), providerMetadata: { anthropic: { redactedData: r3.content_block.data } } });\n return;\n case `tool_use`:\n d2[r3.index] = i3 ? { type: `text` } : { type: `tool-call`, toolCallId: r3.content_block.id, toolName: r3.content_block.name, input: `` }, n3.enqueue(i3 ? { type: `text-start`, id: String(r3.index) } : { type: `tool-input-start`, id: r3.content_block.id, toolName: r3.content_block.name });\n return;\n case `server_tool_use`:\n (r3.content_block.name === `web_fetch` || r3.content_block.name === `web_search` || r3.content_block.name === `code_execution`) && (d2[r3.index] = { type: `tool-call`, toolCallId: r3.content_block.id, toolName: r3.content_block.name, input: ``, providerExecuted: true }, n3.enqueue({ type: `tool-input-start`, id: r3.content_block.id, toolName: r3.content_block.name, providerExecuted: true }));\n return;\n case `web_fetch_tool_result`: {\n let e6 = r3.content_block;\n e6.content.type === `web_fetch_result` ? n3.enqueue({ type: `tool-result`, toolCallId: e6.tool_use_id, toolName: `web_fetch`, result: { type: `web_fetch_result`, url: e6.content.url, retrievedAt: e6.content.retrieved_at, content: { type: e6.content.content.type, title: e6.content.content.title, citations: e6.content.content.citations, source: { type: e6.content.content.source.type, mediaType: e6.content.content.source.media_type, data: e6.content.content.source.data } } } }) : e6.content.type === `web_fetch_tool_result_error` && n3.enqueue({ type: `tool-result`, toolCallId: e6.tool_use_id, toolName: `web_fetch`, isError: true, result: { type: `web_fetch_tool_result_error`, errorCode: e6.content.error_code }, providerExecuted: true });\n return;\n }\n case `web_search_tool_result`: {\n let e6 = r3.content_block;\n if (Array.isArray(e6.content)) {\n n3.enqueue({ type: `tool-result`, toolCallId: e6.tool_use_id, toolName: `web_search`, result: e6.content.map((e7) => ({ url: e7.url, title: e7.title, pageAge: e7.page_age ?? null, encryptedContent: e7.encrypted_content, type: e7.type })), providerExecuted: true });\n for (let t4 of e6.content)\n n3.enqueue({ type: `source`, sourceType: `url`, id: g3(), url: t4.url, title: t4.title, providerMetadata: { anthropic: { pageAge: t4.page_age ?? null } } });\n } else\n n3.enqueue({ type: `tool-result`, toolCallId: e6.tool_use_id, toolName: `web_search`, isError: true, result: { type: `web_search_tool_result_error`, errorCode: e6.content.error_code }, providerExecuted: true });\n return;\n }\n case `code_execution_tool_result`: {\n let e6 = r3.content_block;\n e6.content.type === `code_execution_result` ? n3.enqueue({ type: `tool-result`, toolCallId: e6.tool_use_id, toolName: `code_execution`, result: { type: e6.content.type, stdout: e6.content.stdout, stderr: e6.content.stderr, return_code: e6.content.return_code }, providerExecuted: true }) : e6.content.type === `code_execution_tool_result_error` && n3.enqueue({ type: `tool-result`, toolCallId: e6.tool_use_id, toolName: `code_execution`, isError: true, result: { type: `code_execution_tool_result_error`, errorCode: e6.content.error_code }, providerExecuted: true });\n return;\n }\n default: {\n let t4 = e5;\n throw Error(`Unsupported content block type: ${t4}`);\n }\n }\n }\n case `content_block_stop`:\n if (d2[r3.index] != null) {\n let e5 = d2[r3.index];\n switch (e5.type) {\n case `text`:\n n3.enqueue({ type: `text-end`, id: String(r3.index) });\n break;\n case `reasoning`:\n n3.enqueue({ type: `reasoning-end`, id: String(r3.index) });\n break;\n case `tool-call`:\n i3 || (n3.enqueue({ type: `tool-input-end`, id: e5.toolCallId }), n3.enqueue(e5));\n break;\n }\n delete d2[r3.index];\n }\n h3 = undefined;\n return;\n case `content_block_delta`: {\n let e5 = r3.delta.type;\n switch (e5) {\n case `text_delta`:\n if (i3)\n return;\n n3.enqueue({ type: `text-delta`, id: String(r3.index), delta: r3.delta.text });\n return;\n case `thinking_delta`:\n n3.enqueue({ type: `reasoning-delta`, id: String(r3.index), delta: r3.delta.thinking });\n return;\n case `signature_delta`:\n h3 === `thinking` && n3.enqueue({ type: `reasoning-delta`, id: String(r3.index), delta: ``, providerMetadata: { anthropic: { signature: r3.delta.signature } } });\n return;\n case `input_json_delta`: {\n let e6 = d2[r3.index], t4 = r3.delta.partial_json;\n if (i3) {\n if (e6?.type !== `text`)\n return;\n n3.enqueue({ type: `text-delta`, id: String(r3.index), delta: t4 });\n } else {\n if (e6?.type !== `tool-call`)\n return;\n n3.enqueue({ type: `tool-input-delta`, id: e6.toolCallId, delta: t4 }), e6.input += t4;\n }\n return;\n }\n case `citations_delta`: {\n let e6 = r3.delta.citation;\n en(e6, a4, g3, (e7) => n3.enqueue(e7));\n return;\n }\n default: {\n let t4 = e5;\n throw Error(`Unsupported delta type: ${t4}`);\n }\n }\n }\n case `message_start`:\n u3.inputTokens = r3.message.usage.input_tokens, u3.cachedInputTokens = r3.message.usage.cache_read_input_tokens ?? undefined, f3 = { ...r3.message.usage }, p3 = r3.message.usage.cache_creation_input_tokens ?? null, n3.enqueue({ type: `response-metadata`, id: r3.message.id ?? undefined, modelId: r3.message.model ?? undefined });\n return;\n case `message_delta`:\n u3.outputTokens = r3.usage.output_tokens, u3.totalTokens = (u3.inputTokens ?? 0) + (r3.usage.output_tokens ?? 0), l3 = Qt({ finishReason: r3.delta.stop_reason, isJsonResponseFromTool: i3 }), m3 = r3.delta.stop_sequence ?? null, f3 = { ...f3, ...r3.usage };\n return;\n case `message_stop`:\n n3.enqueue({ type: `finish`, finishReason: l3, usage: u3, providerMetadata: { anthropic: { usage: f3 ?? null, cacheCreationInputTokens: p3, stopSequence: m3 } } });\n return;\n case `error`:\n n3.enqueue({ type: `error`, error: r3.error });\n return;\n default: {\n let e5 = r3;\n throw Error(`Unsupported chunk type: ${e5}`);\n }\n }\n } })), request: { body: o3 }, response: { headers: s4 } };\n }\n};\nvar rn = exports_external.object({ type: exports_external.literal(`message`), id: exports_external.string().nullish(), model: exports_external.string().nullish(), content: exports_external.array(exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`text`), text: exports_external.string(), citations: exports_external.array($t).optional() }), exports_external.object({ type: exports_external.literal(`thinking`), thinking: exports_external.string(), signature: exports_external.string() }), exports_external.object({ type: exports_external.literal(`redacted_thinking`), data: exports_external.string() }), exports_external.object({ type: exports_external.literal(`tool_use`), id: exports_external.string(), name: exports_external.string(), input: exports_external.unknown() }), exports_external.object({ type: exports_external.literal(`server_tool_use`), id: exports_external.string(), name: exports_external.string(), input: exports_external.record(exports_external.string(), exports_external.unknown()).nullish() }), exports_external.object({ type: exports_external.literal(`web_fetch_tool_result`), tool_use_id: exports_external.string(), content: exports_external.union([exports_external.object({ type: exports_external.literal(`web_fetch_result`), url: exports_external.string(), retrieved_at: exports_external.string(), content: exports_external.object({ type: exports_external.literal(`document`), title: exports_external.string().nullable(), citations: exports_external.object({ enabled: exports_external.boolean() }).optional(), source: exports_external.object({ type: exports_external.literal(`text`), media_type: exports_external.string(), data: exports_external.string() }) }) }), exports_external.object({ type: exports_external.literal(`web_fetch_tool_result_error`), error_code: exports_external.string() })]) }), exports_external.object({ type: exports_external.literal(`web_search_tool_result`), tool_use_id: exports_external.string(), content: exports_external.union([exports_external.array(exports_external.object({ type: exports_external.literal(`web_search_result`), url: exports_external.string(), title: exports_external.string(), encrypted_content: exports_external.string(), page_age: exports_external.string().nullish() })), exports_external.object({ type: exports_external.literal(`web_search_tool_result_error`), error_code: exports_external.string() })]) }), exports_external.object({ type: exports_external.literal(`code_execution_tool_result`), tool_use_id: exports_external.string(), content: exports_external.union([exports_external.object({ type: exports_external.literal(`code_execution_result`), stdout: exports_external.string(), stderr: exports_external.string(), return_code: exports_external.number() }), exports_external.object({ type: exports_external.literal(`code_execution_tool_result_error`), error_code: exports_external.string() })]) })])), stop_reason: exports_external.string().nullish(), stop_sequence: exports_external.string().nullish(), usage: exports_external.looseObject({ input_tokens: exports_external.number(), output_tokens: exports_external.number(), cache_creation_input_tokens: exports_external.number().nullish(), cache_read_input_tokens: exports_external.number().nullish() }) });\nvar an = exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`message_start`), message: exports_external.object({ id: exports_external.string().nullish(), model: exports_external.string().nullish(), usage: exports_external.looseObject({ input_tokens: exports_external.number(), cache_creation_input_tokens: exports_external.number().nullish(), cache_read_input_tokens: exports_external.number().nullish() }) }) }), exports_external.object({ type: exports_external.literal(`content_block_start`), index: exports_external.number(), content_block: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`text`), text: exports_external.string() }), exports_external.object({ type: exports_external.literal(`thinking`), thinking: exports_external.string() }), exports_external.object({ type: exports_external.literal(`tool_use`), id: exports_external.string(), name: exports_external.string() }), exports_external.object({ type: exports_external.literal(`redacted_thinking`), data: exports_external.string() }), exports_external.object({ type: exports_external.literal(`server_tool_use`), id: exports_external.string(), name: exports_external.string(), input: exports_external.record(exports_external.string(), exports_external.unknown()).nullish() }), exports_external.object({ type: exports_external.literal(`web_fetch_tool_result`), tool_use_id: exports_external.string(), content: exports_external.union([exports_external.object({ type: exports_external.literal(`web_fetch_result`), url: exports_external.string(), retrieved_at: exports_external.string(), content: exports_external.object({ type: exports_external.literal(`document`), title: exports_external.string().nullable(), citations: exports_external.object({ enabled: exports_external.boolean() }).optional(), source: exports_external.object({ type: exports_external.literal(`text`), media_type: exports_external.string(), data: exports_external.string() }) }) }), exports_external.object({ type: exports_external.literal(`web_fetch_tool_result_error`), error_code: exports_external.string() })]) }), exports_external.object({ type: exports_external.literal(`web_search_tool_result`), tool_use_id: exports_external.string(), content: exports_external.union([exports_external.array(exports_external.object({ type: exports_external.literal(`web_search_result`), url: exports_external.string(), title: exports_external.string(), encrypted_content: exports_external.string(), page_age: exports_external.string().nullish() })), exports_external.object({ type: exports_external.literal(`web_search_tool_result_error`), error_code: exports_external.string() })]) }), exports_external.object({ type: exports_external.literal(`code_execution_tool_result`), tool_use_id: exports_external.string(), content: exports_external.union([exports_external.object({ type: exports_external.literal(`code_execution_result`), stdout: exports_external.string(), stderr: exports_external.string(), return_code: exports_external.number() }), exports_external.object({ type: exports_external.literal(`code_execution_tool_result_error`), error_code: exports_external.string() })]) })]) }), exports_external.object({ type: exports_external.literal(`content_block_delta`), index: exports_external.number(), delta: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`input_json_delta`), partial_json: exports_external.string() }), exports_external.object({ type: exports_external.literal(`text_delta`), text: exports_external.string() }), exports_external.object({ type: exports_external.literal(`thinking_delta`), thinking: exports_external.string() }), exports_external.object({ type: exports_external.literal(`signature_delta`), signature: exports_external.string() }), exports_external.object({ type: exports_external.literal(`citations_delta`), citation: $t })]) }), exports_external.object({ type: exports_external.literal(`content_block_stop`), index: exports_external.number() }), exports_external.object({ type: exports_external.literal(`error`), error: exports_external.object({ type: exports_external.string(), message: exports_external.string() }) }), exports_external.object({ type: exports_external.literal(`message_delta`), delta: exports_external.object({ stop_reason: exports_external.string().nullish(), stop_sequence: exports_external.string().nullish() }), usage: exports_external.looseObject({ output_tokens: exports_external.number(), cache_creation_input_tokens: exports_external.number().nullish() }) }), exports_external.object({ type: exports_external.literal(`message_stop`) }), exports_external.object({ type: exports_external.literal(`ping`) })]);\nvar on = exports_external.object({ signature: exports_external.string().optional(), redactedData: exports_external.string().optional() });\nvar sn = z2({ id: `anthropic.bash_20241022`, name: `bash`, inputSchema: v4_default.object({ command: v4_default.string(), restart: v4_default.boolean().optional() }) });\nvar cn = z2({ id: `anthropic.bash_20250124`, name: `bash`, inputSchema: v4_default.object({ command: v4_default.string(), restart: v4_default.boolean().optional() }) });\nvar ln = z2({ id: `anthropic.computer_20241022`, name: `computer`, inputSchema: exports_external.object({ action: exports_external.enum([`key`, `type`, `mouse_move`, `left_click`, `left_click_drag`, `right_click`, `middle_click`, `double_click`, `screenshot`, `cursor_position`]), coordinate: exports_external.array(exports_external.number().int()).optional(), text: exports_external.string().optional() }) });\nvar un = z2({ id: `anthropic.computer_20250124`, name: `computer`, inputSchema: exports_external.object({ action: exports_external.enum([`key`, `hold_key`, `type`, `cursor_position`, `mouse_move`, `left_mouse_down`, `left_mouse_up`, `left_click`, `left_click_drag`, `right_click`, `middle_click`, `double_click`, `triple_click`, `scroll`, `wait`, `screenshot`]), coordinate: exports_external.tuple([exports_external.number().int(), exports_external.number().int()]).optional(), duration: exports_external.number().optional(), scroll_amount: exports_external.number().optional(), scroll_direction: exports_external.enum([`up`, `down`, `left`, `right`]).optional(), start_coordinate: exports_external.tuple([exports_external.number().int(), exports_external.number().int()]).optional(), text: exports_external.string().optional() }) });\nvar dn = z2({ id: `anthropic.text_editor_20241022`, name: `str_replace_editor`, inputSchema: exports_external.object({ command: exports_external.enum([`view`, `create`, `str_replace`, `insert`, `undo_edit`]), path: exports_external.string(), file_text: exports_external.string().optional(), insert_line: exports_external.number().int().optional(), new_str: exports_external.string().optional(), old_str: exports_external.string().optional(), view_range: exports_external.array(exports_external.number().int()).optional() }) });\nvar fn = z2({ id: `anthropic.text_editor_20250124`, name: `str_replace_editor`, inputSchema: exports_external.object({ command: exports_external.enum([`view`, `create`, `str_replace`, `insert`, `undo_edit`]), path: exports_external.string(), file_text: exports_external.string().optional(), insert_line: exports_external.number().int().optional(), new_str: exports_external.string().optional(), old_str: exports_external.string().optional(), view_range: exports_external.array(exports_external.number().int()).optional() }) });\nvar pn = z2({ id: `anthropic.text_editor_20250429`, name: `str_replace_based_edit_tool`, inputSchema: exports_external.object({ command: exports_external.enum([`view`, `create`, `str_replace`, `insert`]), path: exports_external.string(), file_text: exports_external.string().optional(), insert_line: exports_external.number().int().optional(), new_str: exports_external.string().optional(), old_str: exports_external.string().optional(), view_range: exports_external.array(exports_external.number().int()).optional() }) });\nvar mn = { bash_20241022: sn, bash_20250124: cn, codeExecution_20250522: Jt, computer_20241022: ln, computer_20250124: un, textEditor_20241022: dn, textEditor_20250124: fn, textEditor_20250429: pn, textEditor_20250728: It, webFetch_20250910: Wt, webSearch_20250305: Bt };\nfunction hn(e4 = {}) {\n let t2 = K2(e4.baseURL) ?? `https://api.anthropic.com/v1`, n2 = () => P2({ "anthropic-version": `2023-06-01`, "x-api-key": I2({ apiKey: e4.apiKey, environmentVariableName: `ANTHROPIC_API_KEY`, description: `Anthropic` }), ...e4.headers }, `ai-sdk/anthropic/${kt}`), r2 = (r3) => new nn(r3, { provider: `anthropic.messages`, baseURL: t2, headers: n2, fetch: e4.fetch, generateId: e4.generateId ?? F2, supportedUrls: () => ({ "image/*": [/^https?:\\/\\/.*$/] }) }), i3 = function(e5) {\n if (new.target)\n throw Error(`The Anthropic model function cannot be called with the new keyword.`);\n return r2(e5);\n };\n return i3.languageModel = r2, i3.chat = r2, i3.messages = r2, i3.textEmbeddingModel = (e5) => {\n throw new k2({ modelId: e5, modelType: `textEmbeddingModel` });\n }, i3.imageModel = (e5) => {\n throw new k2({ modelId: e5, modelType: `imageModel` });\n }, i3.tools = mn, i3;\n}\nhn();\nvar gn = `2.0.17`;\nvar _n = exports_external.object({ error: exports_external.object({ code: exports_external.number().nullable(), message: exports_external.string(), status: exports_external.string() }) });\nvar Y2 = H2({ errorSchema: _n, errorToMessage: (e4) => e4.error.message });\nvar vn = exports_external.object({ outputDimensionality: exports_external.number().optional(), taskType: exports_external.enum([`SEMANTIC_SIMILARITY`, `CLASSIFICATION`, `CLUSTERING`, `RETRIEVAL_DOCUMENT`, `RETRIEVAL_QUERY`, `QUESTION_ANSWERING`, `FACT_VERIFICATION`, `CODE_RETRIEVAL_QUERY`]).optional() });\nvar yn = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.maxEmbeddingsPerCall = 2048, this.supportsParallelCalls = true, this.modelId = e4, this.config = t2;\n }\n get provider() {\n return this.config.provider;\n }\n async doEmbed({ values: e4, headers: t2, abortSignal: n2, providerOptions: r2 }) {\n let i3 = await L2({ provider: `google`, providerOptions: r2, schema: vn });\n if (e4.length > this.maxEmbeddingsPerCall)\n throw new Be({ provider: this.provider, modelId: this.modelId, maxEmbeddingsPerCall: this.maxEmbeddingsPerCall, values: e4 });\n let a4 = M2(await V2(this.config.headers), t2);\n if (e4.length === 1) {\n let { responseHeaders: t3, value: r3, rawValue: o4 } = await R2({ url: `${this.config.baseURL}/models/${this.modelId}:embedContent`, headers: a4, body: { model: `models/${this.modelId}`, content: { parts: [{ text: e4[0] }] }, outputDimensionality: i3?.outputDimensionality, taskType: i3?.taskType }, failedResponseHandler: Y2, successfulResponseHandler: W2(xn), abortSignal: n2, fetch: this.config.fetch });\n return { embeddings: [r3.embedding.values], usage: undefined, response: { headers: t3, body: o4 } };\n }\n let { responseHeaders: o3, value: s4, rawValue: c4 } = await R2({ url: `${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`, headers: a4, body: { requests: e4.map((e5) => ({ model: `models/${this.modelId}`, content: { role: `user`, parts: [{ text: e5 }] }, outputDimensionality: i3?.outputDimensionality, taskType: i3?.taskType })) }, failedResponseHandler: Y2, successfulResponseHandler: W2(bn), abortSignal: n2, fetch: this.config.fetch });\n return { embeddings: s4.embeddings.map((e5) => e5.values), usage: undefined, response: { headers: o3, body: c4 } };\n }\n};\nvar bn = exports_external.object({ embeddings: exports_external.array(exports_external.object({ values: exports_external.array(exports_external.number()) })) });\nvar xn = exports_external.object({ embedding: exports_external.object({ values: exports_external.array(exports_external.number()) }) });\nfunction X2(e4) {\n if (e4 == null || Sn(e4))\n return;\n if (typeof e4 == `boolean`)\n return { type: `boolean`, properties: {} };\n let { type: t2, description: n2, required: r2, properties: i3, items: a4, allOf: o3, anyOf: s4, oneOf: c4, format: l3, const: u3, minLength: d2, enum: f3 } = e4, p3 = {};\n if (n2 && (p3.description = n2), r2 && (p3.required = r2), l3 && (p3.format = l3), u3 !== undefined && (p3.enum = [u3]), t2 && (Array.isArray(t2) ? t2.includes(`null`) ? (p3.type = t2.filter((e5) => e5 !== `null`)[0], p3.nullable = true) : p3.type = t2 : t2 === `null` ? p3.type = `null` : p3.type = t2), f3 !== undefined && (p3.enum = f3), i3 != null && (p3.properties = Object.entries(i3).reduce((e5, [t3, n3]) => (e5[t3] = X2(n3), e5), {})), a4 && (p3.items = Array.isArray(a4) ? a4.map(X2) : X2(a4)), o3 && (p3.allOf = o3.map(X2)), s4)\n if (s4.some((e5) => typeof e5 == `object` && e5?.type === `null`)) {\n let e5 = s4.filter((e6) => !(typeof e6 == `object` && e6?.type === `null`));\n if (e5.length === 1) {\n let t3 = X2(e5[0]);\n typeof t3 == `object` && (p3.nullable = true, Object.assign(p3, t3));\n } else\n p3.anyOf = e5.map(X2), p3.nullable = true;\n } else\n p3.anyOf = s4.map(X2);\n return c4 && (p3.oneOf = c4.map(X2)), d2 !== undefined && (p3.minLength = d2), p3;\n}\nfunction Sn(e4) {\n return typeof e4 == `object` && !!e4 && e4.type === `object` && (e4.properties == null || Object.keys(e4.properties).length === 0) && !e4.additionalProperties;\n}\nfunction Cn(e4, t2) {\n let n2 = [], r2 = [], i3 = true, a4 = t2?.isGemmaModel ?? false;\n for (let { role: t3, content: a5 } of e4)\n switch (t3) {\n case `system`:\n if (!i3)\n throw new j2({ functionality: `system messages are only supported at the beginning of the conversation` });\n n2.push({ text: a5 });\n break;\n case `user`: {\n i3 = false;\n let e5 = [];\n for (let t4 of a5)\n switch (t4.type) {\n case `text`:\n e5.push({ text: t4.text });\n break;\n case `file`: {\n let n3 = t4.mediaType === `image/*` ? `image/jpeg` : t4.mediaType;\n e5.push(t4.data instanceof URL ? { fileData: { mimeType: n3, fileUri: t4.data.toString() } } : { inlineData: { mimeType: n3, data: G2(t4.data) } });\n break;\n }\n }\n r2.push({ role: `user`, parts: e5 });\n break;\n }\n case `assistant`:\n i3 = false, r2.push({ role: `model`, parts: a5.map((e5) => {\n switch (e5.type) {\n case `text`:\n return e5.text.length === 0 ? undefined : { text: e5.text, thoughtSignature: e5.providerOptions?.google?.thoughtSignature };\n case `reasoning`:\n return e5.text.length === 0 ? undefined : { text: e5.text, thought: true, thoughtSignature: e5.providerOptions?.google?.thoughtSignature };\n case `file`:\n if (e5.mediaType !== `image/png`)\n throw new j2({ functionality: `Only PNG images are supported in assistant messages` });\n if (e5.data instanceof URL)\n throw new j2({ functionality: `File data URLs in assistant messages are not supported` });\n return { inlineData: { mimeType: e5.mediaType, data: G2(e5.data) } };\n case `tool-call`:\n return { functionCall: { name: e5.toolName, args: e5.input }, thoughtSignature: e5.providerOptions?.google?.thoughtSignature };\n }\n }).filter((e5) => e5 !== undefined) });\n break;\n case `tool`: {\n i3 = false;\n let e5 = [];\n for (let t4 of a5) {\n let n3 = t4.output;\n if (n3.type === `content`)\n for (let r3 of n3.value)\n switch (r3.type) {\n case `text`:\n e5.push({ functionResponse: { name: t4.toolName, response: { name: t4.toolName, content: r3.text } } });\n break;\n case `media`:\n e5.push({ inlineData: { mimeType: r3.mediaType, data: r3.data } }, { text: `Tool executed successfully and returned this image as a response` });\n break;\n default:\n e5.push({ text: JSON.stringify(r3) });\n break;\n }\n else\n e5.push({ functionResponse: { name: t4.toolName, response: { name: t4.toolName, content: n3.value } } });\n }\n r2.push({ role: `user`, parts: e5 });\n break;\n }\n }\n if (a4 && n2.length > 0 && r2.length > 0 && r2[0].role === `user`) {\n let e5 = n2.map((e6) => e6.text).join(`\n\n`);\n r2[0].parts.unshift({ text: e5 + `\n\n` });\n }\n return { systemInstruction: n2.length > 0 && !a4 ? { parts: n2 } : undefined, contents: r2 };\n}\nfunction wn(e4) {\n return e4.includes(`/`) ? e4 : `models/${e4}`;\n}\nvar Tn = exports_external.object({ responseModalities: exports_external.array(exports_external.enum([`TEXT`, `IMAGE`])).optional(), thinkingConfig: exports_external.object({ thinkingBudget: exports_external.number().optional(), includeThoughts: exports_external.boolean().optional() }).optional(), cachedContent: exports_external.string().optional(), structuredOutputs: exports_external.boolean().optional(), safetySettings: exports_external.array(exports_external.object({ category: exports_external.enum([`HARM_CATEGORY_UNSPECIFIED`, `HARM_CATEGORY_HATE_SPEECH`, `HARM_CATEGORY_DANGEROUS_CONTENT`, `HARM_CATEGORY_HARASSMENT`, `HARM_CATEGORY_SEXUALLY_EXPLICIT`, `HARM_CATEGORY_CIVIC_INTEGRITY`]), threshold: exports_external.enum([`HARM_BLOCK_THRESHOLD_UNSPECIFIED`, `BLOCK_LOW_AND_ABOVE`, `BLOCK_MEDIUM_AND_ABOVE`, `BLOCK_ONLY_HIGH`, `BLOCK_NONE`, `OFF`]) })).optional(), threshold: exports_external.enum([`HARM_BLOCK_THRESHOLD_UNSPECIFIED`, `BLOCK_LOW_AND_ABOVE`, `BLOCK_MEDIUM_AND_ABOVE`, `BLOCK_ONLY_HIGH`, `BLOCK_NONE`, `OFF`]).optional(), audioTimestamp: exports_external.boolean().optional(), labels: exports_external.record(exports_external.string(), exports_external.string()).optional() });\nfunction En({ tools: e4, toolChoice: t2, modelId: n2 }) {\n e4 = e4?.length ? e4 : undefined;\n let r2 = [], i3 = n2.includes(`gemini-2`), a4 = n2.includes(`gemini-1.5-flash`) && !n2.includes(`-8b`);\n if (e4 == null)\n return { tools: undefined, toolConfig: undefined, toolWarnings: r2 };\n let o3 = e4.some((e5) => e5.type === `function`), s4 = e4.some((e5) => e5.type === `provider-defined`);\n if (o3 && s4 && r2.push({ type: `unsupported-tool`, tool: e4.find((e5) => e5.type === `function`), details: `Cannot mix function tools with provider-defined tools in the same request. Please use either function tools or provider-defined tools, but not both.` }), s4) {\n let t3 = {};\n return e4.filter((e5) => e5.type === `provider-defined`).forEach((e5) => {\n switch (e5.id) {\n case `google.google_search`:\n i3 ? t3.googleSearch = {} : a4 ? t3.googleSearchRetrieval = { dynamicRetrievalConfig: { mode: e5.args.mode, dynamicThreshold: e5.args.dynamicThreshold } } : t3.googleSearchRetrieval = {};\n break;\n case `google.url_context`:\n i3 ? t3.urlContext = {} : r2.push({ type: `unsupported-tool`, tool: e5, details: `The URL context tool is not supported with other Gemini models than Gemini 2.` });\n break;\n case `google.code_execution`:\n i3 ? t3.codeExecution = {} : r2.push({ type: `unsupported-tool`, tool: e5, details: `The code execution tools is not supported with other Gemini models than Gemini 2.` });\n break;\n default:\n r2.push({ type: `unsupported-tool`, tool: e5 });\n break;\n }\n }), { tools: Object.keys(t3).length > 0 ? t3 : undefined, toolConfig: undefined, toolWarnings: r2 };\n }\n let c4 = [];\n for (let t3 of e4)\n switch (t3.type) {\n case `function`:\n c4.push({ name: t3.name, description: t3.description ?? ``, parameters: X2(t3.inputSchema) });\n break;\n default:\n r2.push({ type: `unsupported-tool`, tool: t3 });\n break;\n }\n if (t2 == null)\n return { tools: { functionDeclarations: c4 }, toolConfig: undefined, toolWarnings: r2 };\n let l3 = t2.type;\n switch (l3) {\n case `auto`:\n return { tools: { functionDeclarations: c4 }, toolConfig: { functionCallingConfig: { mode: `AUTO` } }, toolWarnings: r2 };\n case `none`:\n return { tools: { functionDeclarations: c4 }, toolConfig: { functionCallingConfig: { mode: `NONE` } }, toolWarnings: r2 };\n case `required`:\n return { tools: { functionDeclarations: c4 }, toolConfig: { functionCallingConfig: { mode: `ANY` } }, toolWarnings: r2 };\n case `tool`:\n return { tools: { functionDeclarations: c4 }, toolConfig: { functionCallingConfig: { mode: `ANY`, allowedFunctionNames: [t2.toolName] } }, toolWarnings: r2 };\n default:\n throw new j2({ functionality: `tool choice type: ${l3}` });\n }\n}\nfunction Dn({ finishReason: e4, hasToolCalls: t2 }) {\n switch (e4) {\n case `STOP`:\n return t2 ? `tool-calls` : `stop`;\n case `MAX_TOKENS`:\n return `length`;\n case `IMAGE_SAFETY`:\n case `RECITATION`:\n case `SAFETY`:\n case `BLOCKLIST`:\n case `PROHIBITED_CONTENT`:\n case `SPII`:\n return `content-filter`;\n case `FINISH_REASON_UNSPECIFIED`:\n case `OTHER`:\n return `other`;\n case `MALFORMED_FUNCTION_CALL`:\n return `error`;\n default:\n return `unknown`;\n }\n}\nvar On = exports_external.object({ web: exports_external.object({ uri: exports_external.string(), title: exports_external.string() }).nullish(), retrievedContext: exports_external.object({ uri: exports_external.string(), title: exports_external.string() }).nullish() });\nvar kn = exports_external.object({ webSearchQueries: exports_external.array(exports_external.string()).nullish(), retrievalQueries: exports_external.array(exports_external.string()).nullish(), searchEntryPoint: exports_external.object({ renderedContent: exports_external.string() }).nullish(), groundingChunks: exports_external.array(On).nullish(), groundingSupports: exports_external.array(exports_external.object({ segment: exports_external.object({ startIndex: exports_external.number().nullish(), endIndex: exports_external.number().nullish(), text: exports_external.string().nullish() }), segment_text: exports_external.string().nullish(), groundingChunkIndices: exports_external.array(exports_external.number()).nullish(), supportChunkIndices: exports_external.array(exports_external.number()).nullish(), confidenceScores: exports_external.array(exports_external.number()).nullish(), confidenceScore: exports_external.array(exports_external.number()).nullish() })).nullish(), retrievalMetadata: exports_external.union([exports_external.object({ webDynamicRetrievalScore: exports_external.number() }), exports_external.object({})]).nullish() });\nvar An = z2({ id: `google.google_search`, name: `google_search`, inputSchema: exports_external.object({ mode: exports_external.enum([`MODE_DYNAMIC`, `MODE_UNSPECIFIED`]).default(`MODE_UNSPECIFIED`), dynamicThreshold: exports_external.number().default(1) }) });\nvar jn = exports_external.object({ retrievedUrl: exports_external.string(), urlRetrievalStatus: exports_external.string() });\nvar Mn = exports_external.object({ urlMetadata: exports_external.array(jn) });\nvar Nn = z2({ id: `google.url_context`, name: `url_context`, inputSchema: exports_external.object({}) });\nvar Pn = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.modelId = e4, this.config = t2, this.generateId = t2.generateId ?? F2;\n }\n get provider() {\n return this.config.provider;\n }\n get supportedUrls() {\n var e4;\n return (e4 = this.config).supportedUrls?.call(e4) ?? {};\n }\n async getArgs({ prompt: e4, maxOutputTokens: t2, temperature: n2, topP: r2, topK: i3, frequencyPenalty: a4, presencePenalty: o3, stopSequences: s4, responseFormat: c4, seed: l3, tools: u3, toolChoice: d2, providerOptions: f3 }) {\n let p3 = [], m3 = await L2({ provider: `google`, providerOptions: f3, schema: Tn });\n m3?.thinkingConfig?.includeThoughts === true && !this.config.provider.startsWith(`google.vertex.`) && p3.push({ type: `other`, message: `The \'includeThoughts\' option is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).` });\n let h3 = this.modelId.toLowerCase().startsWith(`gemma-`), { contents: g3, systemInstruction: _3 } = Cn(e4, { isGemmaModel: h3 }), { tools: v3, toolConfig: y3, toolWarnings: b3 } = En({ tools: u3, toolChoice: d2, modelId: this.modelId });\n return { args: { generationConfig: { maxOutputTokens: t2, temperature: n2, topK: i3, topP: r2, frequencyPenalty: a4, presencePenalty: o3, stopSequences: s4, seed: l3, responseMimeType: c4?.type === `json` ? `application/json` : undefined, responseSchema: c4?.type === `json` && c4.schema != null && (m3?.structuredOutputs ?? true) ? X2(c4.schema) : undefined, ...m3?.audioTimestamp && { audioTimestamp: m3.audioTimestamp }, responseModalities: m3?.responseModalities, thinkingConfig: m3?.thinkingConfig }, contents: g3, systemInstruction: h3 ? undefined : _3, safetySettings: m3?.safetySettings, tools: v3, toolConfig: y3, cachedContent: m3?.cachedContent, labels: m3?.labels }, warnings: [...p3, ...b3] };\n }\n async doGenerate(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), r2 = JSON.stringify(t2), i3 = M2(await V2(this.config.headers), e4.headers), { responseHeaders: a4, value: o3, rawValue: s4 } = await R2({ url: `${this.config.baseURL}/${wn(this.modelId)}:generateContent`, headers: i3, body: t2, failedResponseHandler: Y2, successfulResponseHandler: W2(Bn), abortSignal: e4.abortSignal, fetch: this.config.fetch }), c4 = o3.candidates[0], l3 = [], u3 = c4.content?.parts ?? [], d2 = o3.usageMetadata, f3;\n for (let e5 of u3)\n if (`executableCode` in e5 && e5.executableCode?.code) {\n let t3 = this.config.generateId();\n f3 = t3, l3.push({ type: `tool-call`, toolCallId: t3, toolName: `code_execution`, input: JSON.stringify(e5.executableCode), providerExecuted: true });\n } else\n `codeExecutionResult` in e5 && e5.codeExecutionResult ? (l3.push({ type: `tool-result`, toolCallId: f3, toolName: `code_execution`, result: { outcome: e5.codeExecutionResult.outcome, output: e5.codeExecutionResult.output }, providerExecuted: true }), f3 = undefined) : (`text` in e5) && e5.text != null && e5.text.length > 0 ? l3.push({ type: e5.thought === true ? `reasoning` : `text`, text: e5.text, providerMetadata: e5.thoughtSignature ? { google: { thoughtSignature: e5.thoughtSignature } } : undefined }) : (`functionCall` in e5) ? l3.push({ type: `tool-call`, toolCallId: this.config.generateId(), toolName: e5.functionCall.name, input: JSON.stringify(e5.functionCall.args), providerMetadata: e5.thoughtSignature ? { google: { thoughtSignature: e5.thoughtSignature } } : undefined }) : (`inlineData` in e5) && l3.push({ type: `file`, data: e5.inlineData.data, mediaType: e5.inlineData.mimeType });\n let p3 = Ln({ groundingMetadata: c4.groundingMetadata, generateId: this.config.generateId }) ?? [];\n for (let e5 of p3)\n l3.push(e5);\n return { content: l3, finishReason: Dn({ finishReason: c4.finishReason, hasToolCalls: l3.some((e5) => e5.type === `tool-call`) }), usage: { inputTokens: d2?.promptTokenCount ?? undefined, outputTokens: d2?.candidatesTokenCount ?? undefined, totalTokens: d2?.totalTokenCount ?? undefined, reasoningTokens: d2?.thoughtsTokenCount ?? undefined, cachedInputTokens: d2?.cachedContentTokenCount ?? undefined }, warnings: n2, providerMetadata: { google: { promptFeedback: o3.promptFeedback ?? null, groundingMetadata: c4.groundingMetadata ?? null, urlContextMetadata: c4.urlContextMetadata ?? null, safetyRatings: c4.safetyRatings ?? null, usageMetadata: d2 ?? null } }, request: { body: r2 }, response: { headers: a4, body: s4 } };\n }\n async doStream(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), r2 = JSON.stringify(t2), i3 = M2(await V2(this.config.headers), e4.headers), { responseHeaders: a4, value: o3 } = await R2({ url: `${this.config.baseURL}/${wn(this.modelId)}:streamGenerateContent?alt=sse`, headers: i3, body: t2, failedResponseHandler: Y2, successfulResponseHandler: U2(Vn), abortSignal: e4.abortSignal, fetch: this.config.fetch }), s4 = `unknown`, c4 = { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined }, l3, u3 = this.config.generateId, d2 = false, f3 = null, p3 = null, m3 = 0, h3 = new Set, g3;\n return { stream: o3.pipeThrough(new TransformStream({ start(e5) {\n e5.enqueue({ type: `stream-start`, warnings: n2 });\n }, transform(t3, n3) {\n if (e4.includeRawChunks && n3.enqueue({ type: `raw`, rawValue: t3.rawValue }), !t3.success) {\n n3.enqueue({ type: `error`, error: t3.error });\n return;\n }\n let r3 = t3.value, i4 = r3.usageMetadata;\n i4 != null && (c4.inputTokens = i4.promptTokenCount ?? undefined, c4.outputTokens = i4.candidatesTokenCount ?? undefined, c4.totalTokens = i4.totalTokenCount ?? undefined, c4.reasoningTokens = i4.thoughtsTokenCount ?? undefined, c4.cachedInputTokens = i4.cachedContentTokenCount ?? undefined);\n let a5 = r3.candidates?.[0];\n if (a5 == null)\n return;\n let o4 = a5.content, _3 = Ln({ groundingMetadata: a5.groundingMetadata, generateId: u3 });\n if (_3 != null)\n for (let e5 of _3)\n e5.sourceType === `url` && !h3.has(e5.url) && (h3.add(e5.url), n3.enqueue(e5));\n if (o4 != null) {\n let e5 = o4.parts ?? [];\n for (let t5 of e5)\n if (`executableCode` in t5 && t5.executableCode?.code) {\n let e6 = u3();\n g3 = e6, n3.enqueue({ type: `tool-call`, toolCallId: e6, toolName: `code_execution`, input: JSON.stringify(t5.executableCode), providerExecuted: true }), d2 = true;\n } else if (`codeExecutionResult` in t5 && t5.codeExecutionResult) {\n let e6 = g3;\n e6 && (n3.enqueue({ type: `tool-result`, toolCallId: e6, toolName: `code_execution`, result: { outcome: t5.codeExecutionResult.outcome, output: t5.codeExecutionResult.output }, providerExecuted: true }), g3 = undefined);\n } else\n `text` in t5 && t5.text != null && t5.text.length > 0 && (t5.thought === true ? (f3 !== null && (n3.enqueue({ type: `text-end`, id: f3 }), f3 = null), p3 === null && (p3 = String(m3++), n3.enqueue({ type: `reasoning-start`, id: p3, providerMetadata: t5.thoughtSignature ? { google: { thoughtSignature: t5.thoughtSignature } } : undefined })), n3.enqueue({ type: `reasoning-delta`, id: p3, delta: t5.text, providerMetadata: t5.thoughtSignature ? { google: { thoughtSignature: t5.thoughtSignature } } : undefined })) : (p3 !== null && (n3.enqueue({ type: `reasoning-end`, id: p3 }), p3 = null), f3 === null && (f3 = String(m3++), n3.enqueue({ type: `text-start`, id: f3, providerMetadata: t5.thoughtSignature ? { google: { thoughtSignature: t5.thoughtSignature } } : undefined })), n3.enqueue({ type: `text-delta`, id: f3, delta: t5.text, providerMetadata: t5.thoughtSignature ? { google: { thoughtSignature: t5.thoughtSignature } } : undefined })));\n let t4 = In(o4.parts);\n if (t4 != null)\n for (let e6 of t4)\n n3.enqueue({ type: `file`, mediaType: e6.inlineData.mimeType, data: e6.inlineData.data });\n let r4 = Fn({ parts: o4.parts, generateId: u3 });\n if (r4 != null)\n for (let e6 of r4)\n n3.enqueue({ type: `tool-input-start`, id: e6.toolCallId, toolName: e6.toolName, providerMetadata: e6.providerMetadata }), n3.enqueue({ type: `tool-input-delta`, id: e6.toolCallId, delta: e6.args, providerMetadata: e6.providerMetadata }), n3.enqueue({ type: `tool-input-end`, id: e6.toolCallId, providerMetadata: e6.providerMetadata }), n3.enqueue({ type: `tool-call`, toolCallId: e6.toolCallId, toolName: e6.toolName, input: e6.args, providerMetadata: e6.providerMetadata }), d2 = true;\n }\n a5.finishReason != null && (s4 = Dn({ finishReason: a5.finishReason, hasToolCalls: d2 }), l3 = { google: { promptFeedback: r3.promptFeedback ?? null, groundingMetadata: a5.groundingMetadata ?? null, urlContextMetadata: a5.urlContextMetadata ?? null, safetyRatings: a5.safetyRatings ?? null } }, i4 != null && (l3.google.usageMetadata = i4));\n }, flush(e5) {\n f3 !== null && e5.enqueue({ type: `text-end`, id: f3 }), p3 !== null && e5.enqueue({ type: `reasoning-end`, id: p3 }), e5.enqueue({ type: `finish`, finishReason: s4, usage: c4, providerMetadata: l3 });\n } })), response: { headers: a4 }, request: { body: r2 } };\n }\n};\nfunction Fn({ parts: e4, generateId: t2 }) {\n let n2 = e4?.filter((e5) => (`functionCall` in e5));\n return n2 == null || n2.length === 0 ? undefined : n2.map((e5) => ({ type: `tool-call`, toolCallId: t2(), toolName: e5.functionCall.name, args: JSON.stringify(e5.functionCall.args), providerMetadata: e5.thoughtSignature ? { google: { thoughtSignature: e5.thoughtSignature } } : undefined }));\n}\nfunction In(e4) {\n return e4?.filter((e5) => (`inlineData` in e5));\n}\nfunction Ln({ groundingMetadata: e4, generateId: t2 }) {\n return e4?.groundingChunks?.filter((e5) => e5.web != null).map((e5) => ({ type: `source`, sourceType: `url`, id: t2(), url: e5.web.uri, title: e5.web.title }));\n}\nvar Rn = exports_external.object({ parts: exports_external.array(exports_external.union([exports_external.object({ functionCall: exports_external.object({ name: exports_external.string(), args: exports_external.unknown() }), thoughtSignature: exports_external.string().nullish() }), exports_external.object({ inlineData: exports_external.object({ mimeType: exports_external.string(), data: exports_external.string() }) }), exports_external.object({ executableCode: exports_external.object({ language: exports_external.string(), code: exports_external.string() }).nullish(), codeExecutionResult: exports_external.object({ outcome: exports_external.string(), output: exports_external.string() }).nullish(), text: exports_external.string().nullish(), thought: exports_external.boolean().nullish(), thoughtSignature: exports_external.string().nullish() })])).nullish() });\nvar Z2 = exports_external.object({ category: exports_external.string().nullish(), probability: exports_external.string().nullish(), probabilityScore: exports_external.number().nullish(), severity: exports_external.string().nullish(), severityScore: exports_external.number().nullish(), blocked: exports_external.boolean().nullish() });\nvar zn = exports_external.object({ cachedContentTokenCount: exports_external.number().nullish(), thoughtsTokenCount: exports_external.number().nullish(), promptTokenCount: exports_external.number().nullish(), candidatesTokenCount: exports_external.number().nullish(), totalTokenCount: exports_external.number().nullish() });\nvar Bn = exports_external.object({ candidates: exports_external.array(exports_external.object({ content: Rn.nullish().or(exports_external.object({}).strict()), finishReason: exports_external.string().nullish(), safetyRatings: exports_external.array(Z2).nullish(), groundingMetadata: kn.nullish(), urlContextMetadata: Mn.nullish() })), usageMetadata: zn.nullish(), promptFeedback: exports_external.object({ blockReason: exports_external.string().nullish(), safetyRatings: exports_external.array(Z2).nullish() }).nullish() });\nvar Vn = exports_external.object({ candidates: exports_external.array(exports_external.object({ content: Rn.nullish(), finishReason: exports_external.string().nullish(), safetyRatings: exports_external.array(Z2).nullish(), groundingMetadata: kn.nullish(), urlContextMetadata: Mn.nullish() })).nullish(), usageMetadata: zn.nullish(), promptFeedback: exports_external.object({ blockReason: exports_external.string().nullish(), safetyRatings: exports_external.array(Z2).nullish() }).nullish() });\nvar Hn = B2({ id: `google.code_execution`, name: `code_execution`, inputSchema: exports_external.object({ language: exports_external.string().describe(`The programming language of the code.`), code: exports_external.string().describe(`The code to be executed.`) }), outputSchema: exports_external.object({ outcome: exports_external.string().describe(`The outcome of the execution (e.g., "OUTCOME_OK").`), output: exports_external.string().describe(`The output from the code execution.`) }) });\nvar Un = { googleSearch: An, urlContext: Nn, codeExecution: Hn };\nvar Wn = class {\n constructor(e4, t2, n2) {\n this.modelId = e4, this.settings = t2, this.config = n2, this.specificationVersion = `v2`;\n }\n get maxImagesPerCall() {\n return this.settings.maxImagesPerCall ?? 4;\n }\n get provider() {\n return this.config.provider;\n }\n async doGenerate(e4) {\n var t2;\n let { prompt: n2, n: r2 = 1, size: i3 = `1024x1024`, aspectRatio: a4 = `1:1`, seed: o3, providerOptions: s4, headers: c4, abortSignal: l3 } = e4, u3 = [];\n i3 != null && u3.push({ type: `unsupported-setting`, setting: `size`, details: "This model does not support the `size` option. Use `aspectRatio` instead." }), o3 != null && u3.push({ type: `unsupported-setting`, setting: `seed`, details: "This model does not support the `seed` option through this provider." });\n let d2 = await L2({ provider: `google`, providerOptions: s4, schema: Kn }), f3 = (t2 = this.config._internal)?.currentDate?.call(t2) ?? new Date, p3 = { sampleCount: r2 };\n a4 != null && (p3.aspectRatio = a4), d2 && Object.assign(p3, d2);\n let m3 = { instances: [{ prompt: n2 }], parameters: p3 }, { responseHeaders: h3, value: g3 } = await R2({ url: `${this.config.baseURL}/models/${this.modelId}:predict`, headers: M2(await V2(this.config.headers), c4), body: m3, failedResponseHandler: Y2, successfulResponseHandler: W2(Gn), abortSignal: l3, fetch: this.config.fetch });\n return { images: g3.predictions.map((e5) => e5.bytesBase64Encoded), warnings: u3 ?? [], providerMetadata: { google: { images: g3.predictions.map((e5) => ({})) } }, response: { timestamp: f3, modelId: this.modelId, headers: h3 } };\n }\n};\nvar Gn = exports_external.object({ predictions: exports_external.array(exports_external.object({ bytesBase64Encoded: exports_external.string() })).default([]) });\nvar Kn = exports_external.object({ personGeneration: exports_external.enum([`dont_allow`, `allow_adult`, `allow_all`]).nullish(), aspectRatio: exports_external.enum([`1:1`, `3:4`, `4:3`, `9:16`, `16:9`]).nullish() });\nfunction qn(e4 = {}) {\n let t2 = K2(e4.baseURL) ?? `https://generativelanguage.googleapis.com/v1beta`, n2 = () => P2({ "x-goog-api-key": I2({ apiKey: e4.apiKey, environmentVariableName: `GOOGLE_GENERATIVE_AI_API_KEY`, description: `Google Generative AI` }), ...e4.headers }, `ai-sdk/google/${gn}`), r2 = (r3) => new Pn(r3, { provider: `google.generative-ai`, baseURL: t2, headers: n2, generateId: e4.generateId ?? F2, supportedUrls: () => ({ "*": [RegExp(`^${t2}/files/.*$`), RegExp(`^https://(?:www\\\\.)?youtube\\\\.com/watch\\\\?v=[\\\\w-]+(?:&[\\\\w=&.-]*)?$`), RegExp(`^https://youtu\\\\.be/[\\\\w-]+(?:\\\\?[\\\\w=&.-]*)?$`)] }), fetch: e4.fetch }), i3 = (r3) => new yn(r3, { provider: `google.generative-ai`, baseURL: t2, headers: n2, fetch: e4.fetch }), a4 = (r3, i4 = {}) => new Wn(r3, i4, { provider: `google.generative-ai`, baseURL: t2, headers: n2, fetch: e4.fetch }), o3 = function(e5) {\n if (new.target)\n throw Error(`The Google Generative AI model function cannot be called with the new keyword.`);\n return r2(e5);\n };\n return o3.languageModel = r2, o3.chat = r2, o3.generativeAI = r2, o3.embedding = i3, o3.textEmbedding = i3, o3.textEmbeddingModel = i3, o3.image = a4, o3.imageModel = a4, o3.tools = Un, o3;\n}\nqn();\nvar Jn = exports_external.object({ error: exports_external.object({ message: exports_external.string(), type: exports_external.string().nullish(), param: exports_external.any().nullish(), code: exports_external.union([exports_external.string(), exports_external.number()]).nullish() }) });\nvar Q2 = H2({ errorSchema: Jn, errorToMessage: (e4) => e4.error.message });\nfunction Yn({ prompt: e4, systemMessageMode: t2 = `system` }) {\n let n2 = [], r2 = [];\n for (let { role: i3, content: a4 } of e4)\n switch (i3) {\n case `system`:\n switch (t2) {\n case `system`:\n n2.push({ role: `system`, content: a4 });\n break;\n case `developer`:\n n2.push({ role: `developer`, content: a4 });\n break;\n case `remove`:\n r2.push({ type: `other`, message: `system messages are removed for this model` });\n break;\n default: {\n let e5 = t2;\n throw Error(`Unsupported system message mode: ${e5}`);\n }\n }\n break;\n case `user`:\n if (a4.length === 1 && a4[0].type === `text`) {\n n2.push({ role: `user`, content: a4[0].text });\n break;\n }\n n2.push({ role: `user`, content: a4.map((e5, t3) => {\n switch (e5.type) {\n case `text`:\n return { type: `text`, text: e5.text };\n case `file`:\n if (e5.mediaType.startsWith(`image/`)) {\n let t4 = e5.mediaType === `image/*` ? `image/jpeg` : e5.mediaType;\n return { type: `image_url`, image_url: { url: e5.data instanceof URL ? e5.data.toString() : `data:${t4};base64,${G2(e5.data)}`, detail: e5.providerOptions?.openai?.imageDetail } };\n } else if (e5.mediaType.startsWith(`audio/`)) {\n if (e5.data instanceof URL)\n throw new j2({ functionality: `audio file parts with URLs` });\n switch (e5.mediaType) {\n case `audio/wav`:\n return { type: `input_audio`, input_audio: { data: G2(e5.data), format: `wav` } };\n case `audio/mp3`:\n case `audio/mpeg`:\n return { type: `input_audio`, input_audio: { data: G2(e5.data), format: `mp3` } };\n default:\n throw new j2({ functionality: `audio content parts with media type ${e5.mediaType}` });\n }\n } else if (e5.mediaType === `application/pdf`) {\n if (e5.data instanceof URL)\n throw new j2({ functionality: `PDF file parts with URLs` });\n return { type: `file`, file: typeof e5.data == `string` && e5.data.startsWith(`file-`) ? { file_id: e5.data } : { filename: e5.filename ?? `part-${t3}.pdf`, file_data: `data:application/pdf;base64,${G2(e5.data)}` } };\n } else\n throw new j2({ functionality: `file part media type ${e5.mediaType}` });\n }\n }) });\n break;\n case `assistant`: {\n let e5 = ``, t3 = [];\n for (let n3 of a4)\n switch (n3.type) {\n case `text`:\n e5 += n3.text;\n break;\n case `tool-call`:\n t3.push({ id: n3.toolCallId, type: `function`, function: { name: n3.toolName, arguments: JSON.stringify(n3.input) } });\n break;\n }\n n2.push({ role: `assistant`, content: e5, tool_calls: t3.length > 0 ? t3 : undefined });\n break;\n }\n case `tool`:\n for (let e5 of a4) {\n let t3 = e5.output, r3;\n switch (t3.type) {\n case `text`:\n case `error-text`:\n r3 = t3.value;\n break;\n case `content`:\n case `json`:\n case `error-json`:\n r3 = JSON.stringify(t3.value);\n break;\n }\n n2.push({ role: `tool`, tool_call_id: e5.toolCallId, content: r3 });\n }\n break;\n default: {\n let e5 = i3;\n throw Error(`Unsupported role: ${e5}`);\n }\n }\n return { messages: n2, warnings: r2 };\n}\nfunction Xn({ id: e4, model: t2, created: n2 }) {\n return { id: e4 ?? undefined, modelId: t2 ?? undefined, timestamp: n2 == null ? undefined : new Date(n2 * 1000) };\n}\nfunction Zn(e4) {\n switch (e4) {\n case `stop`:\n return `stop`;\n case `length`:\n return `length`;\n case `content_filter`:\n return `content-filter`;\n case `function_call`:\n case `tool_calls`:\n return `tool-calls`;\n default:\n return `unknown`;\n }\n}\nvar Qn = exports_external.object({ logitBias: exports_external.record(exports_external.coerce.number(), exports_external.number()).optional(), logprobs: exports_external.union([exports_external.boolean(), exports_external.number()]).optional(), parallelToolCalls: exports_external.boolean().optional(), user: exports_external.string().optional(), reasoningEffort: exports_external.enum([`minimal`, `low`, `medium`, `high`]).optional(), maxCompletionTokens: exports_external.number().optional(), store: exports_external.boolean().optional(), metadata: exports_external.record(exports_external.string().max(64), exports_external.string().max(512)).optional(), prediction: exports_external.record(exports_external.string(), exports_external.any()).optional(), structuredOutputs: exports_external.boolean().optional(), serviceTier: exports_external.enum([`auto`, `flex`, `priority`]).optional(), strictJsonSchema: exports_external.boolean().optional(), textVerbosity: exports_external.enum([`low`, `medium`, `high`]).optional(), promptCacheKey: exports_external.string().optional(), safetyIdentifier: exports_external.string().optional() });\nfunction $n({ tools: e4, toolChoice: t2, structuredOutputs: n2, strictJsonSchema: r2 }) {\n e4 = e4?.length ? e4 : undefined;\n let i3 = [];\n if (e4 == null)\n return { tools: undefined, toolChoice: undefined, toolWarnings: i3 };\n let a4 = [];\n for (let t3 of e4)\n switch (t3.type) {\n case `function`:\n a4.push({ type: `function`, function: { name: t3.name, description: t3.description, parameters: t3.inputSchema, strict: n2 ? r2 : undefined } });\n break;\n default:\n i3.push({ type: `unsupported-tool`, tool: t3 });\n break;\n }\n if (t2 == null)\n return { tools: a4, toolChoice: undefined, toolWarnings: i3 };\n let o3 = t2.type;\n switch (o3) {\n case `auto`:\n case `none`:\n case `required`:\n return { tools: a4, toolChoice: o3, toolWarnings: i3 };\n case `tool`:\n return { tools: a4, toolChoice: { type: `function`, function: { name: t2.toolName } }, toolWarnings: i3 };\n default:\n throw new j2({ functionality: `tool choice type: ${o3}` });\n }\n}\nvar er = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.supportedUrls = { "image/*": [/^https?:\\/\\/.*$/] }, this.modelId = e4, this.config = t2;\n }\n get provider() {\n return this.config.provider;\n }\n async getArgs({ prompt: e4, maxOutputTokens: t2, temperature: n2, topP: r2, topK: i3, frequencyPenalty: a4, presencePenalty: o3, stopSequences: s4, responseFormat: c4, seed: l3, tools: u3, toolChoice: d2, providerOptions: f3 }) {\n let p3 = [], m3 = await L2({ provider: `openai`, providerOptions: f3, schema: Qn }) ?? {}, h3 = m3.structuredOutputs ?? true;\n i3 != null && p3.push({ type: `unsupported-setting`, setting: `topK` }), c4?.type === `json` && c4.schema != null && !h3 && p3.push({ type: `unsupported-setting`, setting: `responseFormat`, details: `JSON response format schema is only supported with structuredOutputs` });\n let { messages: g3, warnings: _3 } = Yn({ prompt: e4, systemMessageMode: sr(this.modelId) });\n p3.push(..._3);\n let v3 = m3.strictJsonSchema ?? false, y3 = { model: this.modelId, logit_bias: m3.logitBias, logprobs: m3.logprobs === true || typeof m3.logprobs == `number` ? true : undefined, top_logprobs: typeof m3.logprobs == `number` ? m3.logprobs : typeof m3.logprobs == `boolean` && m3.logprobs ? 0 : undefined, user: m3.user, parallel_tool_calls: m3.parallelToolCalls, max_tokens: t2, temperature: n2, top_p: r2, frequency_penalty: a4, presence_penalty: o3, response_format: c4?.type === `json` ? h3 && c4.schema != null ? { type: `json_schema`, json_schema: { schema: c4.schema, strict: v3, name: c4.name ?? `response`, description: c4.description } } : { type: `json_object` } : undefined, stop: s4, seed: l3, verbosity: m3.textVerbosity, max_completion_tokens: m3.maxCompletionTokens, store: m3.store, metadata: m3.metadata, prediction: m3.prediction, reasoning_effort: m3.reasoningEffort, service_tier: m3.serviceTier, prompt_cache_key: m3.promptCacheKey, safety_identifier: m3.safetyIdentifier, messages: g3 };\n ir(this.modelId) ? (y3.temperature != null && (y3.temperature = undefined, p3.push({ type: `unsupported-setting`, setting: `temperature`, details: `temperature is not supported for reasoning models` })), y3.top_p != null && (y3.top_p = undefined, p3.push({ type: `unsupported-setting`, setting: `topP`, details: `topP is not supported for reasoning models` })), y3.frequency_penalty != null && (y3.frequency_penalty = undefined, p3.push({ type: `unsupported-setting`, setting: `frequencyPenalty`, details: `frequencyPenalty is not supported for reasoning models` })), y3.presence_penalty != null && (y3.presence_penalty = undefined, p3.push({ type: `unsupported-setting`, setting: `presencePenalty`, details: `presencePenalty is not supported for reasoning models` })), y3.logit_bias != null && (y3.logit_bias = undefined, p3.push({ type: `other`, message: `logitBias is not supported for reasoning models` })), y3.logprobs != null && (y3.logprobs = undefined, p3.push({ type: `other`, message: `logprobs is not supported for reasoning models` })), y3.top_logprobs != null && (y3.top_logprobs = undefined, p3.push({ type: `other`, message: `topLogprobs is not supported for reasoning models` })), y3.max_tokens != null && (y3.max_completion_tokens ??= y3.max_tokens, y3.max_tokens = undefined)) : (this.modelId.startsWith(`gpt-4o-search-preview`) || this.modelId.startsWith(`gpt-4o-mini-search-preview`)) && y3.temperature != null && (y3.temperature = undefined, p3.push({ type: `unsupported-setting`, setting: `temperature`, details: `temperature is not supported for the search preview models and has been removed.` })), m3.serviceTier === `flex` && !ar(this.modelId) && (p3.push({ type: `unsupported-setting`, setting: `serviceTier`, details: `flex processing is only available for o3, o4-mini, and gpt-5 models` }), y3.service_tier = undefined), m3.serviceTier === `priority` && !or(this.modelId) && (p3.push({ type: `unsupported-setting`, setting: `serviceTier`, details: `priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported` }), y3.service_tier = undefined);\n let { tools: b3, toolChoice: x4, toolWarnings: S3 } = $n({ tools: u3, toolChoice: d2, structuredOutputs: h3, strictJsonSchema: v3 });\n return { args: { ...y3, tools: b3, tool_choice: x4 }, warnings: [...p3, ...S3] };\n }\n async doGenerate(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), { responseHeaders: r2, value: i3, rawValue: a4 } = await R2({ url: this.config.url({ path: `/chat/completions`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), body: t2, failedResponseHandler: Q2, successfulResponseHandler: W2(nr), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = i3.choices[0], s4 = [], c4 = o3.message.content;\n c4 != null && c4.length > 0 && s4.push({ type: `text`, text: c4 });\n for (let e5 of o3.message.tool_calls ?? [])\n s4.push({ type: `tool-call`, toolCallId: e5.id ?? F2(), toolName: e5.function.name, input: e5.function.arguments });\n for (let e5 of o3.message.annotations ?? [])\n s4.push({ type: `source`, sourceType: `url`, id: F2(), url: e5.url, title: e5.title });\n let l3 = i3.usage?.completion_tokens_details, u3 = i3.usage?.prompt_tokens_details, d2 = { openai: {} };\n return l3?.accepted_prediction_tokens != null && (d2.openai.acceptedPredictionTokens = l3?.accepted_prediction_tokens), l3?.rejected_prediction_tokens != null && (d2.openai.rejectedPredictionTokens = l3?.rejected_prediction_tokens), o3.logprobs?.content != null && (d2.openai.logprobs = o3.logprobs.content), { content: s4, finishReason: Zn(o3.finish_reason), usage: { inputTokens: i3.usage?.prompt_tokens ?? undefined, outputTokens: i3.usage?.completion_tokens ?? undefined, totalTokens: i3.usage?.total_tokens ?? undefined, reasoningTokens: l3?.reasoning_tokens ?? undefined, cachedInputTokens: u3?.cached_tokens ?? undefined }, request: { body: t2 }, response: { ...Xn(i3), headers: r2, body: a4 }, warnings: n2, providerMetadata: d2 };\n }\n async doStream(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), r2 = { ...t2, stream: true, stream_options: { include_usage: true } }, { responseHeaders: i3, value: a4 } = await R2({ url: this.config.url({ path: `/chat/completions`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), body: r2, failedResponseHandler: Q2, successfulResponseHandler: U2(rr), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = [], s4 = `unknown`, c4 = { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined }, l3 = true, u3 = false, d2 = { openai: {} };\n return { stream: a4.pipeThrough(new TransformStream({ start(e5) {\n e5.enqueue({ type: `stream-start`, warnings: n2 });\n }, transform(t3, n3) {\n if (e4.includeRawChunks && n3.enqueue({ type: `raw`, rawValue: t3.rawValue }), !t3.success) {\n s4 = `error`, n3.enqueue({ type: `error`, error: t3.error });\n return;\n }\n let r3 = t3.value;\n if (`error` in r3) {\n s4 = `error`, n3.enqueue({ type: `error`, error: r3.error });\n return;\n }\n l3 && (l3 = false, n3.enqueue({ type: `response-metadata`, ...Xn(r3) })), r3.usage != null && (c4.inputTokens = r3.usage.prompt_tokens ?? undefined, c4.outputTokens = r3.usage.completion_tokens ?? undefined, c4.totalTokens = r3.usage.total_tokens ?? undefined, c4.reasoningTokens = r3.usage.completion_tokens_details?.reasoning_tokens ?? undefined, c4.cachedInputTokens = r3.usage.prompt_tokens_details?.cached_tokens ?? undefined, r3.usage.completion_tokens_details?.accepted_prediction_tokens != null && (d2.openai.acceptedPredictionTokens = r3.usage.completion_tokens_details?.accepted_prediction_tokens), r3.usage.completion_tokens_details?.rejected_prediction_tokens != null && (d2.openai.rejectedPredictionTokens = r3.usage.completion_tokens_details?.rejected_prediction_tokens));\n let i4 = r3.choices[0];\n if (i4?.finish_reason != null && (s4 = Zn(i4.finish_reason)), i4?.logprobs?.content != null && (d2.openai.logprobs = i4.logprobs.content), i4?.delta == null)\n return;\n let a5 = i4.delta;\n if (a5.content != null && (u3 ||= (n3.enqueue({ type: `text-start`, id: `0` }), true), n3.enqueue({ type: `text-delta`, id: `0`, delta: a5.content })), a5.tool_calls != null)\n for (let e5 of a5.tool_calls) {\n let t4 = e5.index;\n if (o3[t4] == null) {\n if (e5.type !== `function`)\n throw new E2({ data: e5, message: `Expected \'function\' type.` });\n if (e5.id == null)\n throw new E2({ data: e5, message: `Expected \'id\' to be a string.` });\n if (e5.function?.name == null)\n throw new E2({ data: e5, message: `Expected \'function.name\' to be a string.` });\n n3.enqueue({ type: `tool-input-start`, id: e5.id, toolName: e5.function.name }), o3[t4] = { id: e5.id, type: `function`, function: { name: e5.function.name, arguments: e5.function.arguments ?? `` }, hasFinished: false };\n let r5 = o3[t4];\n r5.function?.name != null && r5.function?.arguments != null && (r5.function.arguments.length > 0 && n3.enqueue({ type: `tool-input-delta`, id: r5.id, delta: r5.function.arguments }), vt(r5.function.arguments) && (n3.enqueue({ type: `tool-input-end`, id: r5.id }), n3.enqueue({ type: `tool-call`, toolCallId: r5.id ?? F2(), toolName: r5.function.name, input: r5.function.arguments }), r5.hasFinished = true));\n continue;\n }\n let r4 = o3[t4];\n r4.hasFinished || (e5.function?.arguments != null && (r4.function.arguments += e5.function?.arguments ?? ``), n3.enqueue({ type: `tool-input-delta`, id: r4.id, delta: e5.function.arguments ?? `` }), r4.function?.name != null && r4.function?.arguments != null && vt(r4.function.arguments) && (n3.enqueue({ type: `tool-input-end`, id: r4.id }), n3.enqueue({ type: `tool-call`, toolCallId: r4.id ?? F2(), toolName: r4.function.name, input: r4.function.arguments }), r4.hasFinished = true));\n }\n if (a5.annotations != null)\n for (let e5 of a5.annotations)\n n3.enqueue({ type: `source`, sourceType: `url`, id: F2(), url: e5.url, title: e5.title });\n }, flush(e5) {\n u3 && e5.enqueue({ type: `text-end`, id: `0` }), e5.enqueue({ type: `finish`, finishReason: s4, usage: c4, ...d2 == null ? {} : { providerMetadata: d2 } });\n } })), request: { body: r2 }, response: { headers: i3 } };\n }\n};\nvar tr = exports_external.object({ prompt_tokens: exports_external.number().nullish(), completion_tokens: exports_external.number().nullish(), total_tokens: exports_external.number().nullish(), prompt_tokens_details: exports_external.object({ cached_tokens: exports_external.number().nullish() }).nullish(), completion_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish(), accepted_prediction_tokens: exports_external.number().nullish(), rejected_prediction_tokens: exports_external.number().nullish() }).nullish() }).nullish();\nvar nr = exports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ message: exports_external.object({ role: exports_external.literal(`assistant`).nullish(), content: exports_external.string().nullish(), tool_calls: exports_external.array(exports_external.object({ id: exports_external.string().nullish(), type: exports_external.literal(`function`), function: exports_external.object({ name: exports_external.string(), arguments: exports_external.string() }) })).nullish(), annotations: exports_external.array(exports_external.object({ type: exports_external.literal(`url_citation`), start_index: exports_external.number(), end_index: exports_external.number(), url: exports_external.string(), title: exports_external.string() })).nullish() }), index: exports_external.number(), logprobs: exports_external.object({ content: exports_external.array(exports_external.object({ token: exports_external.string(), logprob: exports_external.number(), top_logprobs: exports_external.array(exports_external.object({ token: exports_external.string(), logprob: exports_external.number() })) })).nullish() }).nullish(), finish_reason: exports_external.string().nullish() })), usage: tr });\nvar rr = exports_external.union([exports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ delta: exports_external.object({ role: exports_external.enum([`assistant`]).nullish(), content: exports_external.string().nullish(), tool_calls: exports_external.array(exports_external.object({ index: exports_external.number(), id: exports_external.string().nullish(), type: exports_external.literal(`function`).nullish(), function: exports_external.object({ name: exports_external.string().nullish(), arguments: exports_external.string().nullish() }) })).nullish(), annotations: exports_external.array(exports_external.object({ type: exports_external.literal(`url_citation`), start_index: exports_external.number(), end_index: exports_external.number(), url: exports_external.string(), title: exports_external.string() })).nullish() }).nullish(), logprobs: exports_external.object({ content: exports_external.array(exports_external.object({ token: exports_external.string(), logprob: exports_external.number(), top_logprobs: exports_external.array(exports_external.object({ token: exports_external.string(), logprob: exports_external.number() })) })).nullish() }).nullish(), finish_reason: exports_external.string().nullish(), index: exports_external.number() })), usage: tr }), Jn]);\nfunction ir(e4) {\n return (e4.startsWith(`o`) || e4.startsWith(`gpt-5`)) && !e4.startsWith(`gpt-5-chat`);\n}\nfunction ar(e4) {\n return e4.startsWith(`o3`) || e4.startsWith(`o4-mini`) || e4.startsWith(`gpt-5`) && !e4.startsWith(`gpt-5-chat`);\n}\nfunction or(e4) {\n return e4.startsWith(`gpt-4`) || e4.startsWith(`gpt-5-mini`) || e4.startsWith(`gpt-5`) && !e4.startsWith(`gpt-5-nano`) && !e4.startsWith(`gpt-5-chat`) || e4.startsWith(`o3`) || e4.startsWith(`o4-mini`);\n}\nfunction sr(e4) {\n return ir(e4) ? cr[e4]?.systemMessageMode ?? `developer` : `system`;\n}\nvar cr = { "o1-mini": { systemMessageMode: `remove` }, "o1-mini-2024-09-12": { systemMessageMode: `remove` }, "o1-preview": { systemMessageMode: `remove` }, "o1-preview-2024-09-12": { systemMessageMode: `remove` }, o3: { systemMessageMode: `developer` }, "o3-2025-04-16": { systemMessageMode: `developer` }, "o3-mini": { systemMessageMode: `developer` }, "o3-mini-2025-01-31": { systemMessageMode: `developer` }, "o4-mini": { systemMessageMode: `developer` }, "o4-mini-2025-04-16": { systemMessageMode: `developer` } };\nfunction lr({ prompt: e4, user: t2 = `user`, assistant: n2 = `assistant` }) {\n let r2 = ``;\n e4[0].role === `system` && (r2 += `${e4[0].content}\n\n`, e4 = e4.slice(1));\n for (let { role: i3, content: a4 } of e4)\n switch (i3) {\n case `system`:\n throw new ye({ message: "Unexpected system message in prompt: ${content}", prompt: e4 });\n case `user`: {\n let e5 = a4.map((e6) => {\n switch (e6.type) {\n case `text`:\n return e6.text;\n }\n }).filter(Boolean).join(``);\n r2 += `${t2}:\n${e5}\n\n`;\n break;\n }\n case `assistant`: {\n let e5 = a4.map((e6) => {\n switch (e6.type) {\n case `text`:\n return e6.text;\n case `tool-call`:\n throw new j2({ functionality: `tool-call messages` });\n }\n }).join(``);\n r2 += `${n2}:\n${e5}\n\n`;\n break;\n }\n case `tool`:\n throw new j2({ functionality: `tool messages` });\n default: {\n let e5 = i3;\n throw Error(`Unsupported role: ${e5}`);\n }\n }\n return r2 += `${n2}:\n`, { prompt: r2, stopSequences: [`\n${t2}:`] };\n}\nfunction ur({ id: e4, model: t2, created: n2 }) {\n return { id: e4 ?? undefined, modelId: t2 ?? undefined, timestamp: n2 == null ? undefined : new Date(n2 * 1000) };\n}\nfunction dr(e4) {\n switch (e4) {\n case `stop`:\n return `stop`;\n case `length`:\n return `length`;\n case `content_filter`:\n return `content-filter`;\n case `function_call`:\n case `tool_calls`:\n return `tool-calls`;\n default:\n return `unknown`;\n }\n}\nvar fr = exports_external.object({ echo: exports_external.boolean().optional(), logitBias: exports_external.record(exports_external.string(), exports_external.number()).optional(), suffix: exports_external.string().optional(), user: exports_external.string().optional(), logprobs: exports_external.union([exports_external.boolean(), exports_external.number()]).optional() });\nvar pr = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.supportedUrls = {}, this.modelId = e4, this.config = t2;\n }\n get providerOptionsName() {\n return this.config.provider.split(`.`)[0].trim();\n }\n get provider() {\n return this.config.provider;\n }\n async getArgs({ prompt: e4, maxOutputTokens: t2, temperature: n2, topP: r2, topK: i3, frequencyPenalty: a4, presencePenalty: o3, stopSequences: s4, responseFormat: c4, tools: l3, toolChoice: u3, seed: d2, providerOptions: f3 }) {\n let p3 = [], m3 = { ...await L2({ provider: `openai`, providerOptions: f3, schema: fr }), ...await L2({ provider: this.providerOptionsName, providerOptions: f3, schema: fr }) };\n i3 != null && p3.push({ type: `unsupported-setting`, setting: `topK` }), l3?.length && p3.push({ type: `unsupported-setting`, setting: `tools` }), u3 != null && p3.push({ type: `unsupported-setting`, setting: `toolChoice` }), c4 != null && c4.type !== `text` && p3.push({ type: `unsupported-setting`, setting: `responseFormat`, details: `JSON response format is not supported.` });\n let { prompt: h3, stopSequences: g3 } = lr({ prompt: e4 }), _3 = [...g3 ?? [], ...s4 ?? []];\n return { args: { model: this.modelId, echo: m3.echo, logit_bias: m3.logitBias, logprobs: m3?.logprobs === true ? 0 : m3?.logprobs === false ? undefined : m3?.logprobs, suffix: m3.suffix, user: m3.user, max_tokens: t2, temperature: n2, top_p: r2, frequency_penalty: a4, presence_penalty: o3, seed: d2, prompt: h3, stop: _3.length > 0 ? _3 : undefined }, warnings: p3 };\n }\n async doGenerate(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), { responseHeaders: r2, value: i3, rawValue: a4 } = await R2({ url: this.config.url({ path: `/completions`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), body: t2, failedResponseHandler: Q2, successfulResponseHandler: W2(hr), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = i3.choices[0], s4 = { openai: {} };\n return o3.logprobs != null && (s4.openai.logprobs = o3.logprobs), { content: [{ type: `text`, text: o3.text }], usage: { inputTokens: i3.usage?.prompt_tokens, outputTokens: i3.usage?.completion_tokens, totalTokens: i3.usage?.total_tokens }, finishReason: dr(o3.finish_reason), request: { body: t2 }, response: { ...ur(i3), headers: r2, body: a4 }, providerMetadata: s4, warnings: n2 };\n }\n async doStream(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), r2 = { ...t2, stream: true, stream_options: { include_usage: true } }, { responseHeaders: i3, value: a4 } = await R2({ url: this.config.url({ path: `/completions`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), body: r2, failedResponseHandler: Q2, successfulResponseHandler: U2(gr), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = `unknown`, s4 = { openai: {} }, c4 = { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined }, l3 = true;\n return { stream: a4.pipeThrough(new TransformStream({ start(e5) {\n e5.enqueue({ type: `stream-start`, warnings: n2 });\n }, transform(t3, n3) {\n if (e4.includeRawChunks && n3.enqueue({ type: `raw`, rawValue: t3.rawValue }), !t3.success) {\n o3 = `error`, n3.enqueue({ type: `error`, error: t3.error });\n return;\n }\n let r3 = t3.value;\n if (`error` in r3) {\n o3 = `error`, n3.enqueue({ type: `error`, error: r3.error });\n return;\n }\n l3 && (l3 = false, n3.enqueue({ type: `response-metadata`, ...ur(r3) }), n3.enqueue({ type: `text-start`, id: `0` })), r3.usage != null && (c4.inputTokens = r3.usage.prompt_tokens, c4.outputTokens = r3.usage.completion_tokens, c4.totalTokens = r3.usage.total_tokens);\n let i4 = r3.choices[0];\n i4?.finish_reason != null && (o3 = dr(i4.finish_reason)), i4?.logprobs != null && (s4.openai.logprobs = i4.logprobs), i4?.text != null && i4.text.length > 0 && n3.enqueue({ type: `text-delta`, id: `0`, delta: i4.text });\n }, flush(e5) {\n l3 || e5.enqueue({ type: `text-end`, id: `0` }), e5.enqueue({ type: `finish`, finishReason: o3, providerMetadata: s4, usage: c4 });\n } })), request: { body: r2 }, response: { headers: i3 } };\n }\n};\nvar mr = exports_external.object({ prompt_tokens: exports_external.number(), completion_tokens: exports_external.number(), total_tokens: exports_external.number() });\nvar hr = exports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ text: exports_external.string(), finish_reason: exports_external.string(), logprobs: exports_external.object({ tokens: exports_external.array(exports_external.string()), token_logprobs: exports_external.array(exports_external.number()), top_logprobs: exports_external.array(exports_external.record(exports_external.string(), exports_external.number())).nullish() }).nullish() })), usage: mr.nullish() });\nvar gr = exports_external.union([exports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ text: exports_external.string(), finish_reason: exports_external.string().nullish(), index: exports_external.number(), logprobs: exports_external.object({ tokens: exports_external.array(exports_external.string()), token_logprobs: exports_external.array(exports_external.number()), top_logprobs: exports_external.array(exports_external.record(exports_external.string(), exports_external.number())).nullish() }).nullish() })), usage: mr.nullish() }), Jn]);\nvar _r = exports_external.object({ dimensions: exports_external.number().optional(), user: exports_external.string().optional() });\nvar vr = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.maxEmbeddingsPerCall = 2048, this.supportsParallelCalls = true, this.modelId = e4, this.config = t2;\n }\n get provider() {\n return this.config.provider;\n }\n async doEmbed({ values: e4, headers: t2, abortSignal: n2, providerOptions: r2 }) {\n if (e4.length > this.maxEmbeddingsPerCall)\n throw new Be({ provider: this.provider, modelId: this.modelId, maxEmbeddingsPerCall: this.maxEmbeddingsPerCall, values: e4 });\n let i3 = await L2({ provider: `openai`, providerOptions: r2, schema: _r }) ?? {}, { responseHeaders: a4, value: o3, rawValue: s4 } = await R2({ url: this.config.url({ path: `/embeddings`, modelId: this.modelId }), headers: M2(this.config.headers(), t2), body: { model: this.modelId, input: e4, encoding_format: `float`, dimensions: i3.dimensions, user: i3.user }, failedResponseHandler: Q2, successfulResponseHandler: W2(yr), abortSignal: n2, fetch: this.config.fetch });\n return { embeddings: o3.data.map((e5) => e5.embedding), usage: o3.usage ? { tokens: o3.usage.prompt_tokens } : undefined, response: { headers: a4, body: s4 } };\n }\n};\nvar yr = exports_external.object({ data: exports_external.array(exports_external.object({ embedding: exports_external.array(exports_external.number()) })), usage: exports_external.object({ prompt_tokens: exports_external.number() }).nullish() });\nvar br = { "dall-e-3": 1, "dall-e-2": 10, "gpt-image-1": 10 };\nvar xr = new Set([`gpt-image-1`]);\nvar Sr = class {\n constructor(e4, t2) {\n this.modelId = e4, this.config = t2, this.specificationVersion = `v2`;\n }\n get maxImagesPerCall() {\n return br[this.modelId] ?? 1;\n }\n get provider() {\n return this.config.provider;\n }\n async doGenerate({ prompt: e4, n: t2, size: n2, aspectRatio: r2, seed: i3, providerOptions: a4, headers: o3, abortSignal: s4 }) {\n var c4;\n let l3 = [];\n r2 != null && l3.push({ type: `unsupported-setting`, setting: `aspectRatio`, details: "This model does not support aspect ratio. Use `size` instead." }), i3 != null && l3.push({ type: `unsupported-setting`, setting: `seed` });\n let u3 = (c4 = this.config._internal)?.currentDate?.call(c4) ?? new Date, { value: d2, responseHeaders: f3 } = await R2({ url: this.config.url({ path: `/images/generations`, modelId: this.modelId }), headers: M2(this.config.headers(), o3), body: { model: this.modelId, prompt: e4, n: t2, size: n2, ...a4.openai ?? {}, ...xr.has(this.modelId) ? {} : { response_format: `b64_json` } }, failedResponseHandler: Q2, successfulResponseHandler: W2(Cr), abortSignal: s4, fetch: this.config.fetch });\n return { images: d2.data.map((e5) => e5.b64_json), warnings: l3, response: { timestamp: u3, modelId: this.modelId, headers: f3 }, providerMetadata: { openai: { images: d2.data.map((e5) => e5.revised_prompt ? { revisedPrompt: e5.revised_prompt } : null) } } };\n }\n};\nvar Cr = exports_external.object({ data: exports_external.array(exports_external.object({ b64_json: exports_external.string(), revised_prompt: exports_external.string().optional() })) });\nvar wr = exports_external.object({ code: exports_external.string().nullish(), containerId: exports_external.string() });\nvar Tr = exports_external.object({ outputs: exports_external.array(exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`logs`), logs: exports_external.string() }), exports_external.object({ type: exports_external.literal(`image`), url: exports_external.string() })])).nullish() });\nvar Er = exports_external.object({ container: exports_external.union([exports_external.string(), exports_external.object({ fileIds: exports_external.array(exports_external.string()).optional() })]).optional() });\nvar Dr = B2({ id: `openai.code_interpreter`, name: `code_interpreter`, inputSchema: wr, outputSchema: Tr });\nvar Or = (e4 = {}) => Dr(e4);\nvar kr = exports_external.object({ key: exports_external.string(), type: exports_external.enum([`eq`, `ne`, `gt`, `gte`, `lt`, `lte`]), value: exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()]) });\nvar Ar = exports_external.object({ type: exports_external.enum([`and`, `or`]), filters: exports_external.array(exports_external.union([kr, exports_external.lazy(() => Ar)])) });\nvar jr = exports_external.object({ vectorStoreIds: exports_external.array(exports_external.string()), maxNumResults: exports_external.number().optional(), ranking: exports_external.object({ ranker: exports_external.string().optional(), scoreThreshold: exports_external.number().optional() }).optional(), filters: exports_external.union([kr, Ar]).optional() });\nvar Mr = exports_external.object({ queries: exports_external.array(exports_external.string()), results: exports_external.array(exports_external.object({ attributes: exports_external.record(exports_external.string(), exports_external.unknown()), fileId: exports_external.string(), filename: exports_external.string(), score: exports_external.number(), text: exports_external.string() })).nullable() });\nvar Nr = B2({ id: `openai.file_search`, name: `file_search`, inputSchema: exports_external.object({}), outputSchema: Mr });\nvar Pr = exports_external.object({ background: exports_external.enum([`auto`, `opaque`, `transparent`]).optional(), inputFidelity: exports_external.enum([`low`, `high`]).optional(), inputImageMask: exports_external.object({ fileId: exports_external.string().optional(), imageUrl: exports_external.string().optional() }).optional(), model: exports_external.string().optional(), moderation: exports_external.enum([`auto`]).optional(), outputCompression: exports_external.number().int().min(0).max(100).optional(), outputFormat: exports_external.enum([`png`, `jpeg`, `webp`]).optional(), quality: exports_external.enum([`auto`, `low`, `medium`, `high`]).optional(), size: exports_external.enum([`1024x1024`, `1024x1536`, `1536x1024`, `auto`]).optional() }).strict();\nvar Fr = exports_external.object({ result: exports_external.string() });\nvar Ir = B2({ id: `openai.image_generation`, name: `image_generation`, inputSchema: exports_external.object({}), outputSchema: Fr });\nvar Lr = (e4 = {}) => Ir(e4);\nvar Rr = exports_external.object({ action: exports_external.object({ type: exports_external.literal(`exec`), command: exports_external.array(exports_external.string()), timeoutMs: exports_external.number().optional(), user: exports_external.string().optional(), workingDirectory: exports_external.string().optional(), env: exports_external.record(exports_external.string(), exports_external.string()).optional() }) });\nvar zr = exports_external.object({ output: exports_external.string() });\nvar Br = B2({ id: `openai.local_shell`, name: `local_shell`, inputSchema: Rr, outputSchema: zr });\nvar Vr = exports_external.object({ filters: exports_external.object({ allowedDomains: exports_external.array(exports_external.string()).optional() }).optional(), searchContextSize: exports_external.enum([`low`, `medium`, `high`]).optional(), userLocation: exports_external.object({ type: exports_external.literal(`approximate`), country: exports_external.string().optional(), city: exports_external.string().optional(), region: exports_external.string().optional(), timezone: exports_external.string().optional() }).optional() });\nvar Hr = z2({ id: `openai.web_search`, name: `web_search`, inputSchema: exports_external.object({ action: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`search`), query: exports_external.string().nullish() }), exports_external.object({ type: exports_external.literal(`open_page`), url: exports_external.string() }), exports_external.object({ type: exports_external.literal(`find`), url: exports_external.string(), pattern: exports_external.string() })]).nullish() }) });\nvar Ur = (e4 = {}) => Hr(e4);\nvar Wr = exports_external.object({ searchContextSize: exports_external.enum([`low`, `medium`, `high`]).optional(), userLocation: exports_external.object({ type: exports_external.literal(`approximate`), country: exports_external.string().optional(), city: exports_external.string().optional(), region: exports_external.string().optional(), timezone: exports_external.string().optional() }).optional() });\nvar Gr = z2({ id: `openai.web_search_preview`, name: `web_search_preview`, inputSchema: exports_external.object({ action: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`search`), query: exports_external.string().nullish() }), exports_external.object({ type: exports_external.literal(`open_page`), url: exports_external.string() }), exports_external.object({ type: exports_external.literal(`find`), url: exports_external.string(), pattern: exports_external.string() })]).nullish() }) });\nvar Kr = { codeInterpreter: Or, fileSearch: Nr, imageGeneration: Lr, localShell: Br, webSearchPreview: Gr, webSearch: Ur };\nfunction qr(e4, t2) {\n return t2 ? t2.some((t3) => e4.startsWith(t3)) : false;\n}\nasync function Jr({ prompt: e4, systemMessageMode: t2, fileIdPrefixes: n2, store: r2, hasLocalShellTool: i3 = false }) {\n let a4 = [], o3 = [];\n for (let { role: s4, content: c4 } of e4)\n switch (s4) {\n case `system`:\n switch (t2) {\n case `system`:\n a4.push({ role: `system`, content: c4 });\n break;\n case `developer`:\n a4.push({ role: `developer`, content: c4 });\n break;\n case `remove`:\n o3.push({ type: `other`, message: `system messages are removed for this model` });\n break;\n default: {\n let e5 = t2;\n throw Error(`Unsupported system message mode: ${e5}`);\n }\n }\n break;\n case `user`:\n a4.push({ role: `user`, content: c4.map((e5, t3) => {\n switch (e5.type) {\n case `text`:\n return { type: `input_text`, text: e5.text };\n case `file`:\n if (e5.mediaType.startsWith(`image/`)) {\n let t4 = e5.mediaType === `image/*` ? `image/jpeg` : e5.mediaType;\n return { type: `input_image`, ...e5.data instanceof URL ? { image_url: e5.data.toString() } : typeof e5.data == `string` && qr(e5.data, n2) ? { file_id: e5.data } : { image_url: `data:${t4};base64,${G2(e5.data)}` }, detail: e5.providerOptions?.openai?.imageDetail };\n } else if (e5.mediaType === `application/pdf`)\n return e5.data instanceof URL ? { type: `input_file`, file_url: e5.data.toString() } : { type: `input_file`, ...typeof e5.data == `string` && qr(e5.data, n2) ? { file_id: e5.data } : { filename: e5.filename ?? `part-${t3}.pdf`, file_data: `data:application/pdf;base64,${G2(e5.data)}` } };\n else\n throw new j2({ functionality: `file part media type ${e5.mediaType}` });\n }\n }) });\n break;\n case `assistant`: {\n let e5 = {}, t3 = {};\n for (let n3 of c4)\n switch (n3.type) {\n case `text`:\n a4.push({ role: `assistant`, content: [{ type: `output_text`, text: n3.text }], id: n3.providerOptions?.openai?.itemId ?? undefined });\n break;\n case `tool-call`:\n if (t3[n3.toolCallId] = n3, n3.providerExecuted)\n break;\n if (i3 && n3.toolName === `local_shell`) {\n let e6 = Rr.parse(n3.input);\n a4.push({ type: `local_shell_call`, call_id: n3.toolCallId, id: n3.providerOptions?.openai?.itemId ?? undefined, action: { type: `exec`, command: e6.action.command, timeout_ms: e6.action.timeoutMs, user: e6.action.user, working_directory: e6.action.workingDirectory, env: e6.action.env } });\n break;\n }\n a4.push({ type: `function_call`, call_id: n3.toolCallId, name: n3.toolName, arguments: JSON.stringify(n3.input), id: n3.providerOptions?.openai?.itemId ?? undefined });\n break;\n case `tool-result`:\n r2 ? a4.push({ type: `item_reference`, id: n3.toolCallId }) : o3.push({ type: `other`, message: `Results for OpenAI tool ${n3.toolName} are not sent to the API when store is false` });\n break;\n case `reasoning`: {\n let t4 = await L2({ provider: `openai`, providerOptions: n3.providerOptions, schema: Yr }), i4 = t4?.itemId;\n if (i4 != null) {\n let s5 = e5[i4];\n if (r2)\n s5 === undefined && (a4.push({ type: `item_reference`, id: i4 }), e5[i4] = { type: `reasoning`, id: i4, summary: [] });\n else {\n let r3 = [];\n n3.text.length > 0 ? r3.push({ type: `summary_text`, text: n3.text }) : s5 !== undefined && o3.push({ type: `other`, message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(n3)}.` }), s5 === undefined ? (e5[i4] = { type: `reasoning`, id: i4, encrypted_content: t4?.reasoningEncryptedContent, summary: r3 }, a4.push(e5[i4])) : s5.summary.push(...r3);\n }\n } else\n o3.push({ type: `other`, message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(n3)}.` });\n break;\n }\n }\n break;\n }\n case `tool`:\n for (let e5 of c4) {\n let t3 = e5.output;\n if (i3 && e5.toolName === `local_shell` && t3.type === `json`) {\n a4.push({ type: `local_shell_call_output`, call_id: e5.toolCallId, output: zr.parse(t3.value).output });\n break;\n }\n let n3;\n switch (t3.type) {\n case `text`:\n case `error-text`:\n n3 = t3.value;\n break;\n case `content`:\n case `json`:\n case `error-json`:\n n3 = JSON.stringify(t3.value);\n break;\n }\n a4.push({ type: `function_call_output`, call_id: e5.toolCallId, output: n3 });\n }\n break;\n default: {\n let e5 = s4;\n throw Error(`Unsupported role: ${e5}`);\n }\n }\n return { input: a4, warnings: o3 };\n}\nvar Yr = exports_external.object({ itemId: exports_external.string().nullish(), reasoningEncryptedContent: exports_external.string().nullish() });\nfunction Xr({ finishReason: e4, hasFunctionCall: t2 }) {\n switch (e4) {\n case undefined:\n case null:\n return t2 ? `tool-calls` : `stop`;\n case `max_output_tokens`:\n return `length`;\n case `content_filter`:\n return `content-filter`;\n default:\n return t2 ? `tool-calls` : `unknown`;\n }\n}\nfunction Zr({ tools: e4, toolChoice: t2, strictJsonSchema: n2 }) {\n e4 = e4?.length ? e4 : undefined;\n let r2 = [];\n if (e4 == null)\n return { tools: undefined, toolChoice: undefined, toolWarnings: r2 };\n let i3 = [];\n for (let t3 of e4)\n switch (t3.type) {\n case `function`:\n i3.push({ type: `function`, name: t3.name, description: t3.description, parameters: t3.inputSchema, strict: n2 });\n break;\n case `provider-defined`:\n switch (t3.id) {\n case `openai.file_search`: {\n let e5 = jr.parse(t3.args);\n i3.push({ type: `file_search`, vector_store_ids: e5.vectorStoreIds, max_num_results: e5.maxNumResults, ranking_options: e5.ranking ? { ranker: e5.ranking.ranker, score_threshold: e5.ranking.scoreThreshold } : undefined, filters: e5.filters });\n break;\n }\n case `openai.local_shell`:\n i3.push({ type: `local_shell` });\n break;\n case `openai.web_search_preview`: {\n let e5 = Wr.parse(t3.args);\n i3.push({ type: `web_search_preview`, search_context_size: e5.searchContextSize, user_location: e5.userLocation });\n break;\n }\n case `openai.web_search`: {\n let e5 = Vr.parse(t3.args);\n i3.push({ type: `web_search`, filters: e5.filters == null ? undefined : { allowed_domains: e5.filters.allowedDomains }, search_context_size: e5.searchContextSize, user_location: e5.userLocation });\n break;\n }\n case `openai.code_interpreter`: {\n let e5 = Er.parse(t3.args);\n i3.push({ type: `code_interpreter`, container: e5.container == null ? { type: `auto`, file_ids: undefined } : typeof e5.container == `string` ? e5.container : { type: `auto`, file_ids: e5.container.fileIds } });\n break;\n }\n case `openai.image_generation`: {\n let e5 = Pr.parse(t3.args);\n i3.push({ type: `image_generation`, background: e5.background, input_fidelity: e5.inputFidelity, input_image_mask: e5.inputImageMask ? { file_id: e5.inputImageMask.fileId, image_url: e5.inputImageMask.imageUrl } : undefined, model: e5.model, size: e5.size, quality: e5.quality, moderation: e5.moderation, output_format: e5.outputFormat, output_compression: e5.outputCompression });\n break;\n }\n }\n break;\n default:\n r2.push({ type: `unsupported-tool`, tool: t3 });\n break;\n }\n if (t2 == null)\n return { tools: i3, toolChoice: undefined, toolWarnings: r2 };\n let a4 = t2.type;\n switch (a4) {\n case `auto`:\n case `none`:\n case `required`:\n return { tools: i3, toolChoice: a4, toolWarnings: r2 };\n case `tool`:\n return { tools: i3, toolChoice: t2.toolName === `code_interpreter` || t2.toolName === `file_search` || t2.toolName === `image_generation` || t2.toolName === `web_search_preview` || t2.toolName === `web_search` ? { type: t2.toolName } : { type: `function`, name: t2.toolName }, toolWarnings: r2 };\n default:\n throw new j2({ functionality: `tool choice type: ${a4}` });\n }\n}\nvar Qr = exports_external.object({ type: exports_external.literal(`web_search_call`), id: exports_external.string(), status: exports_external.string(), action: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`search`), query: exports_external.string().nullish() }), exports_external.object({ type: exports_external.literal(`open_page`), url: exports_external.string() }), exports_external.object({ type: exports_external.literal(`find`), url: exports_external.string(), pattern: exports_external.string() })]).nullish() });\nvar $r = exports_external.object({ type: exports_external.literal(`file_search_call`), id: exports_external.string(), queries: exports_external.array(exports_external.string()), results: exports_external.array(exports_external.object({ attributes: exports_external.record(exports_external.string(), exports_external.unknown()), file_id: exports_external.string(), filename: exports_external.string(), score: exports_external.number(), text: exports_external.string() })).nullish() });\nvar ei = exports_external.object({ type: exports_external.literal(`code_interpreter_call`), id: exports_external.string(), code: exports_external.string().nullable(), container_id: exports_external.string(), outputs: exports_external.array(exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`logs`), logs: exports_external.string() }), exports_external.object({ type: exports_external.literal(`image`), url: exports_external.string() })])).nullable() });\nvar ti = exports_external.object({ type: exports_external.literal(`local_shell_call`), id: exports_external.string(), call_id: exports_external.string(), action: exports_external.object({ type: exports_external.literal(`exec`), command: exports_external.array(exports_external.string()), timeout_ms: exports_external.number().optional(), user: exports_external.string().optional(), working_directory: exports_external.string().optional(), env: exports_external.record(exports_external.string(), exports_external.string()).optional() }) });\nvar ni = exports_external.object({ type: exports_external.literal(`image_generation_call`), id: exports_external.string(), result: exports_external.string() });\nvar ri = 20;\nvar ii = exports_external.array(exports_external.object({ token: exports_external.string(), logprob: exports_external.number(), top_logprobs: exports_external.array(exports_external.object({ token: exports_external.string(), logprob: exports_external.number() })) }));\nvar ai = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.supportedUrls = { "image/*": [/^https?:\\/\\/.*$/], "application/pdf": [/^https?:\\/\\/.*$/] }, this.modelId = e4, this.config = t2;\n }\n get provider() {\n return this.config.provider;\n }\n async getArgs({ maxOutputTokens: e4, temperature: t2, stopSequences: n2, topP: r2, topK: i3, presencePenalty: a4, frequencyPenalty: o3, seed: s4, prompt: c4, providerOptions: l3, tools: u3, toolChoice: d2, responseFormat: f3 }) {\n let p3 = [], m3 = Pi(this.modelId);\n i3 != null && p3.push({ type: `unsupported-setting`, setting: `topK` }), s4 != null && p3.push({ type: `unsupported-setting`, setting: `seed` }), a4 != null && p3.push({ type: `unsupported-setting`, setting: `presencePenalty` }), o3 != null && p3.push({ type: `unsupported-setting`, setting: `frequencyPenalty` }), n2 != null && p3.push({ type: `unsupported-setting`, setting: `stopSequences` });\n let h3 = await L2({ provider: `openai`, providerOptions: l3, schema: Fi }), { input: g3, warnings: _3 } = await Jr({ prompt: c4, systemMessageMode: m3.systemMessageMode, fileIdPrefixes: this.config.fileIdPrefixes, store: h3?.store ?? true, hasLocalShellTool: x4(`openai.local_shell`) });\n p3.push(..._3);\n let v3 = h3?.strictJsonSchema ?? false, y3 = h3?.include;\n function b3(e5) {\n y3 = y3 == null ? [e5] : [...y3, e5];\n }\n function x4(e5) {\n return u3?.find((t3) => t3.type === `provider-defined` && t3.id === e5) != null;\n }\n let S3 = typeof h3?.logprobs == `number` ? h3?.logprobs : h3?.logprobs === true ? ri : undefined;\n S3 && b3(`message.output_text.logprobs`);\n let C3 = u3?.find((e5) => e5.type === `provider-defined` && (e5.id === `openai.web_search` || e5.id === `openai.web_search_preview`))?.name;\n C3 && b3(`web_search_call.action.sources`), x4(`openai.code_interpreter`) && b3(`code_interpreter_call.outputs`);\n let w3 = { model: this.modelId, input: g3, temperature: t2, top_p: r2, max_output_tokens: e4, ...(f3?.type === `json` || h3?.textVerbosity) && { text: { ...f3?.type === `json` && { format: f3.schema == null ? { type: `json_object` } : { type: `json_schema`, strict: v3, name: f3.name ?? `response`, description: f3.description, schema: f3.schema } }, ...h3?.textVerbosity && { verbosity: h3.textVerbosity } } }, max_tool_calls: h3?.maxToolCalls, metadata: h3?.metadata, parallel_tool_calls: h3?.parallelToolCalls, previous_response_id: h3?.previousResponseId, store: h3?.store, user: h3?.user, instructions: h3?.instructions, service_tier: h3?.serviceTier, include: y3, prompt_cache_key: h3?.promptCacheKey, safety_identifier: h3?.safetyIdentifier, top_logprobs: S3, ...m3.isReasoningModel && (h3?.reasoningEffort != null || h3?.reasoningSummary != null) && { reasoning: { ...h3?.reasoningEffort != null && { effort: h3.reasoningEffort }, ...h3?.reasoningSummary != null && { summary: h3.reasoningSummary } } }, ...m3.requiredAutoTruncation && { truncation: `auto` } };\n m3.isReasoningModel ? (w3.temperature != null && (w3.temperature = undefined, p3.push({ type: `unsupported-setting`, setting: `temperature`, details: `temperature is not supported for reasoning models` })), w3.top_p != null && (w3.top_p = undefined, p3.push({ type: `unsupported-setting`, setting: `topP`, details: `topP is not supported for reasoning models` }))) : (h3?.reasoningEffort != null && p3.push({ type: `unsupported-setting`, setting: `reasoningEffort`, details: `reasoningEffort is not supported for non-reasoning models` }), h3?.reasoningSummary != null && p3.push({ type: `unsupported-setting`, setting: `reasoningSummary`, details: `reasoningSummary is not supported for non-reasoning models` })), h3?.serviceTier === `flex` && !m3.supportsFlexProcessing && (p3.push({ type: `unsupported-setting`, setting: `serviceTier`, details: `flex processing is only available for o3, o4-mini, and gpt-5 models` }), delete w3.service_tier), h3?.serviceTier === `priority` && !m3.supportsPriorityProcessing && (p3.push({ type: `unsupported-setting`, setting: `serviceTier`, details: `priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported` }), delete w3.service_tier);\n let { tools: ee3, toolChoice: te3, toolWarnings: ne3 } = Zr({ tools: u3, toolChoice: d2, strictJsonSchema: v3 });\n return { webSearchToolName: C3, args: { ...w3, tools: ee3, tool_choice: te3 }, warnings: [...p3, ...ne3] };\n }\n async doGenerate(e4) {\n var t2, n2;\n let { args: r2, warnings: a4, webSearchToolName: o3 } = await this.getArgs(e4), s4 = this.config.url({ path: `/responses`, modelId: this.modelId }), { responseHeaders: c4, value: l3, rawValue: u3 } = await R2({ url: s4, headers: M2(this.config.headers(), e4.headers), body: r2, failedResponseHandler: Q2, successfulResponseHandler: W2(exports_external.object({ id: exports_external.string(), created_at: exports_external.number(), error: exports_external.object({ code: exports_external.string(), message: exports_external.string() }).nullish(), model: exports_external.string(), output: exports_external.array(exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`message`), role: exports_external.literal(`assistant`), id: exports_external.string(), content: exports_external.array(exports_external.object({ type: exports_external.literal(`output_text`), text: exports_external.string(), logprobs: ii.nullish(), annotations: exports_external.array(exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`url_citation`), start_index: exports_external.number(), end_index: exports_external.number(), url: exports_external.string(), title: exports_external.string() }), exports_external.object({ type: exports_external.literal(`file_citation`), file_id: exports_external.string(), filename: exports_external.string().nullish(), index: exports_external.number().nullish(), start_index: exports_external.number().nullish(), end_index: exports_external.number().nullish(), quote: exports_external.string().nullish() }), exports_external.object({ type: exports_external.literal(`container_file_citation`) })])) })) }), Qr, $r, ei, ni, ti, exports_external.object({ type: exports_external.literal(`function_call`), call_id: exports_external.string(), name: exports_external.string(), arguments: exports_external.string(), id: exports_external.string() }), exports_external.object({ type: exports_external.literal(`computer_call`), id: exports_external.string(), status: exports_external.string().optional() }), exports_external.object({ type: exports_external.literal(`reasoning`), id: exports_external.string(), encrypted_content: exports_external.string().nullish(), summary: exports_external.array(exports_external.object({ type: exports_external.literal(`summary_text`), text: exports_external.string() })) })])), service_tier: exports_external.string().nullish(), incomplete_details: exports_external.object({ reason: exports_external.string() }).nullish(), usage: oi })), abortSignal: e4.abortSignal, fetch: this.config.fetch });\n if (l3.error)\n throw new T2({ message: l3.error.message, url: s4, requestBodyValues: r2, statusCode: 400, responseHeaders: c4, responseBody: u3, isRetryable: false });\n let d2 = [], f3 = [], p3 = false;\n for (let r3 of l3.output)\n switch (r3.type) {\n case `reasoning`:\n r3.summary.length === 0 && r3.summary.push({ type: `summary_text`, text: `` });\n for (let e5 of r3.summary)\n d2.push({ type: `reasoning`, text: e5.text, providerMetadata: { openai: { itemId: r3.id, reasoningEncryptedContent: r3.encrypted_content ?? null } } });\n break;\n case `image_generation_call`:\n d2.push({ type: `tool-call`, toolCallId: r3.id, toolName: `image_generation`, input: `{}`, providerExecuted: true }), d2.push({ type: `tool-result`, toolCallId: r3.id, toolName: `image_generation`, result: { result: r3.result }, providerExecuted: true });\n break;\n case `local_shell_call`:\n d2.push({ type: `tool-call`, toolCallId: r3.call_id, toolName: `local_shell`, input: JSON.stringify({ action: r3.action }), providerMetadata: { openai: { itemId: r3.id } } });\n break;\n case `message`:\n for (let i3 of r3.content) {\n e4.providerOptions?.openai?.logprobs && i3.logprobs && f3.push(i3.logprobs), d2.push({ type: `text`, text: i3.text, providerMetadata: { openai: { itemId: r3.id } } });\n for (let e5 of i3.annotations)\n e5.type === `url_citation` ? d2.push({ type: `source`, sourceType: `url`, id: (t2 = this.config).generateId?.call(t2) ?? F2(), url: e5.url, title: e5.title }) : e5.type === `file_citation` && d2.push({ type: `source`, sourceType: `document`, id: (n2 = this.config).generateId?.call(n2) ?? F2(), mediaType: `text/plain`, title: e5.quote ?? e5.filename ?? `Document`, filename: e5.filename ?? e5.file_id });\n }\n break;\n case `function_call`:\n p3 = true, d2.push({ type: `tool-call`, toolCallId: r3.call_id, toolName: r3.name, input: r3.arguments, providerMetadata: { openai: { itemId: r3.id } } });\n break;\n case `web_search_call`:\n d2.push({ type: `tool-call`, toolCallId: r3.id, toolName: o3 ?? `web_search`, input: JSON.stringify({ action: r3.action }), providerExecuted: true }), d2.push({ type: `tool-result`, toolCallId: r3.id, toolName: o3 ?? `web_search`, result: { status: r3.status }, providerExecuted: true });\n break;\n case `computer_call`:\n d2.push({ type: `tool-call`, toolCallId: r3.id, toolName: `computer_use`, input: ``, providerExecuted: true }), d2.push({ type: `tool-result`, toolCallId: r3.id, toolName: `computer_use`, result: { type: `computer_use_tool_result`, status: r3.status || `completed` }, providerExecuted: true });\n break;\n case `file_search_call`:\n d2.push({ type: `tool-call`, toolCallId: r3.id, toolName: `file_search`, input: `{}`, providerExecuted: true }), d2.push({ type: `tool-result`, toolCallId: r3.id, toolName: `file_search`, result: { queries: r3.queries, results: r3.results?.map((e5) => ({ attributes: e5.attributes, fileId: e5.file_id, filename: e5.filename, score: e5.score, text: e5.text })) ?? null }, providerExecuted: true });\n break;\n case `code_interpreter_call`:\n d2.push({ type: `tool-call`, toolCallId: r3.id, toolName: `code_interpreter`, input: JSON.stringify({ code: r3.code, containerId: r3.container_id }), providerExecuted: true }), d2.push({ type: `tool-result`, toolCallId: r3.id, toolName: `code_interpreter`, result: { outputs: r3.outputs }, providerExecuted: true });\n break;\n }\n let m3 = { openai: { responseId: l3.id } };\n return f3.length > 0 && (m3.openai.logprobs = f3), typeof l3.service_tier == `string` && (m3.openai.serviceTier = l3.service_tier), { content: d2, finishReason: Xr({ finishReason: l3.incomplete_details?.reason, hasFunctionCall: p3 }), usage: { inputTokens: l3.usage.input_tokens, outputTokens: l3.usage.output_tokens, totalTokens: l3.usage.input_tokens + l3.usage.output_tokens, reasoningTokens: l3.usage.output_tokens_details?.reasoning_tokens ?? undefined, cachedInputTokens: l3.usage.input_tokens_details?.cached_tokens ?? undefined }, request: { body: r2 }, response: { id: l3.id, timestamp: new Date(l3.created_at * 1000), modelId: l3.model, headers: c4, body: u3 }, providerMetadata: m3, warnings: a4 };\n }\n async doStream(e4) {\n let { args: t2, warnings: n2, webSearchToolName: r2 } = await this.getArgs(e4), { responseHeaders: i3, value: a4 } = await R2({ url: this.config.url({ path: `/responses`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), body: { ...t2, stream: true }, failedResponseHandler: Q2, successfulResponseHandler: U2(yi), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = this, s4 = `unknown`, c4 = { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined }, l3 = [], u3 = null, d2 = {}, f3 = false, p3 = {}, m3;\n return { stream: a4.pipeThrough(new TransformStream({ start(e5) {\n e5.enqueue({ type: `stream-start`, warnings: n2 });\n }, transform(t3, n3) {\n var i4, a5, h3;\n if (e4.includeRawChunks && n3.enqueue({ type: `raw`, rawValue: t3.rawValue }), !t3.success) {\n s4 = `error`, n3.enqueue({ type: `error`, error: t3.error });\n return;\n }\n let g3 = t3.value;\n if (Oi(g3))\n g3.item.type === `function_call` ? (d2[g3.output_index] = { toolName: g3.item.name, toolCallId: g3.item.call_id }, n3.enqueue({ type: `tool-input-start`, id: g3.item.call_id, toolName: g3.item.name })) : g3.item.type === `web_search_call` ? (d2[g3.output_index] = { toolName: r2 ?? `web_search`, toolCallId: g3.item.id }, n3.enqueue({ type: `tool-input-start`, id: g3.item.id, toolName: r2 ?? `web_search` })) : g3.item.type === `computer_call` ? (d2[g3.output_index] = { toolName: `computer_use`, toolCallId: g3.item.id }, n3.enqueue({ type: `tool-input-start`, id: g3.item.id, toolName: `computer_use` })) : g3.item.type === `code_interpreter_call` ? (d2[g3.output_index] = { toolName: `code_interpreter`, toolCallId: g3.item.id, codeInterpreter: { containerId: g3.item.container_id } }, n3.enqueue({ type: `tool-input-start`, id: g3.item.id, toolName: `code_interpreter` }), n3.enqueue({ type: `tool-input-delta`, id: g3.item.id, delta: `{"containerId":"${g3.item.container_id}","code":"` })) : g3.item.type === `file_search_call` ? n3.enqueue({ type: `tool-call`, toolCallId: g3.item.id, toolName: `file_search`, input: `{}`, providerExecuted: true }) : g3.item.type === `image_generation_call` ? n3.enqueue({ type: `tool-call`, toolCallId: g3.item.id, toolName: `image_generation`, input: `{}`, providerExecuted: true }) : g3.item.type === `message` ? n3.enqueue({ type: `text-start`, id: g3.item.id, providerMetadata: { openai: { itemId: g3.item.id } } }) : ki(g3) && (p3[g3.item.id] = { encryptedContent: g3.item.encrypted_content, summaryParts: [0] }, n3.enqueue({ type: `reasoning-start`, id: `${g3.item.id}:0`, providerMetadata: { openai: { itemId: g3.item.id, reasoningEncryptedContent: g3.item.encrypted_content ?? null } } }));\n else if (xi(g3)) {\n if (g3.item.type === `function_call`)\n d2[g3.output_index] = undefined, f3 = true, n3.enqueue({ type: `tool-input-end`, id: g3.item.call_id }), n3.enqueue({ type: `tool-call`, toolCallId: g3.item.call_id, toolName: g3.item.name, input: g3.item.arguments, providerMetadata: { openai: { itemId: g3.item.id } } });\n else if (g3.item.type === `web_search_call`)\n d2[g3.output_index] = undefined, n3.enqueue({ type: `tool-input-end`, id: g3.item.id }), n3.enqueue({ type: `tool-call`, toolCallId: g3.item.id, toolName: `web_search`, input: JSON.stringify({ action: g3.item.action }), providerExecuted: true }), n3.enqueue({ type: `tool-result`, toolCallId: g3.item.id, toolName: `web_search`, result: { status: g3.item.status }, providerExecuted: true });\n else if (g3.item.type === `computer_call`)\n d2[g3.output_index] = undefined, n3.enqueue({ type: `tool-input-end`, id: g3.item.id }), n3.enqueue({ type: `tool-call`, toolCallId: g3.item.id, toolName: `computer_use`, input: ``, providerExecuted: true }), n3.enqueue({ type: `tool-result`, toolCallId: g3.item.id, toolName: `computer_use`, result: { type: `computer_use_tool_result`, status: g3.item.status || `completed` }, providerExecuted: true });\n else if (g3.item.type === `file_search_call`)\n d2[g3.output_index] = undefined, n3.enqueue({ type: `tool-result`, toolCallId: g3.item.id, toolName: `file_search`, result: { queries: g3.item.queries, results: g3.item.results?.map((e5) => ({ attributes: e5.attributes, fileId: e5.file_id, filename: e5.filename, score: e5.score, text: e5.text })) ?? null }, providerExecuted: true });\n else if (g3.item.type === `code_interpreter_call`)\n d2[g3.output_index] = undefined, n3.enqueue({ type: `tool-result`, toolCallId: g3.item.id, toolName: `code_interpreter`, result: { outputs: g3.item.outputs }, providerExecuted: true });\n else if (g3.item.type === `image_generation_call`)\n n3.enqueue({ type: `tool-result`, toolCallId: g3.item.id, toolName: `image_generation`, result: { result: g3.item.result }, providerExecuted: true });\n else if (g3.item.type === `local_shell_call`)\n d2[g3.output_index] = undefined, n3.enqueue({ type: `tool-call`, toolCallId: g3.item.call_id, toolName: `local_shell`, input: JSON.stringify({ action: { type: `exec`, command: g3.item.action.command, timeoutMs: g3.item.action.timeout_ms, user: g3.item.action.user, workingDirectory: g3.item.action.working_directory, env: g3.item.action.env } }), providerMetadata: { openai: { itemId: g3.item.id } } });\n else if (g3.item.type === `message`)\n n3.enqueue({ type: `text-end`, id: g3.item.id });\n else if (Si(g3)) {\n let e5 = p3[g3.item.id];\n for (let t4 of e5.summaryParts)\n n3.enqueue({ type: `reasoning-end`, id: `${g3.item.id}:${t4}`, providerMetadata: { openai: { itemId: g3.item.id, reasoningEncryptedContent: g3.item.encrypted_content ?? null } } });\n delete p3[g3.item.id];\n }\n } else if (Ti(g3)) {\n let e5 = d2[g3.output_index];\n e5 != null && n3.enqueue({ type: `tool-input-delta`, id: e5.toolCallId, delta: g3.delta });\n } else if (Ei(g3)) {\n let e5 = d2[g3.output_index];\n e5 != null && n3.enqueue({ type: `tool-input-delta`, id: e5.toolCallId, delta: JSON.stringify(g3.delta).slice(1, -1) });\n } else if (Di(g3)) {\n let e5 = d2[g3.output_index];\n e5 != null && (n3.enqueue({ type: `tool-input-delta`, id: e5.toolCallId, delta: `"}` }), n3.enqueue({ type: `tool-input-end`, id: e5.toolCallId }), n3.enqueue({ type: `tool-call`, toolCallId: e5.toolCallId, toolName: `code_interpreter`, input: JSON.stringify({ code: g3.code, containerId: e5.codeInterpreter.containerId }), providerExecuted: true }));\n } else\n wi(g3) ? (u3 = g3.response.id, n3.enqueue({ type: `response-metadata`, id: g3.response.id, timestamp: new Date(g3.response.created_at * 1000), modelId: g3.response.model })) : bi(g3) ? (n3.enqueue({ type: `text-delta`, id: g3.item_id, delta: g3.delta }), e4.providerOptions?.openai?.logprobs && g3.logprobs && l3.push(g3.logprobs)) : ji(g3) ? g3.summary_index > 0 && ((i4 = p3[g3.item_id]) == null || i4.summaryParts.push(g3.summary_index), n3.enqueue({ type: `reasoning-start`, id: `${g3.item_id}:${g3.summary_index}`, providerMetadata: { openai: { itemId: g3.item_id, reasoningEncryptedContent: p3[g3.item_id]?.encryptedContent ?? null } } })) : Mi(g3) ? n3.enqueue({ type: `reasoning-delta`, id: `${g3.item_id}:${g3.summary_index}`, delta: g3.delta, providerMetadata: { openai: { itemId: g3.item_id } } }) : Ci(g3) ? (s4 = Xr({ finishReason: g3.response.incomplete_details?.reason, hasFunctionCall: f3 }), c4.inputTokens = g3.response.usage.input_tokens, c4.outputTokens = g3.response.usage.output_tokens, c4.totalTokens = g3.response.usage.input_tokens + g3.response.usage.output_tokens, c4.reasoningTokens = g3.response.usage.output_tokens_details?.reasoning_tokens ?? undefined, c4.cachedInputTokens = g3.response.usage.input_tokens_details?.cached_tokens ?? undefined, typeof g3.response.service_tier == `string` && (m3 = g3.response.service_tier)) : Ai(g3) ? g3.annotation.type === `url_citation` ? n3.enqueue({ type: `source`, sourceType: `url`, id: (a5 = o3.config).generateId?.call(a5) ?? F2(), url: g3.annotation.url, title: g3.annotation.title }) : g3.annotation.type === `file_citation` && n3.enqueue({ type: `source`, sourceType: `document`, id: (h3 = o3.config).generateId?.call(h3) ?? F2(), mediaType: `text/plain`, title: g3.annotation.quote ?? g3.annotation.filename ?? `Document`, filename: g3.annotation.filename ?? g3.annotation.file_id }) : Ni(g3) && n3.enqueue({ type: `error`, error: g3 });\n }, flush(e5) {\n let t3 = { openai: { responseId: u3 } };\n l3.length > 0 && (t3.openai.logprobs = l3), m3 !== undefined && (t3.openai.serviceTier = m3), e5.enqueue({ type: `finish`, finishReason: s4, usage: c4, providerMetadata: t3 });\n } })), request: { body: t2 }, response: { headers: i3 } };\n }\n};\nvar oi = exports_external.object({ input_tokens: exports_external.number(), input_tokens_details: exports_external.object({ cached_tokens: exports_external.number().nullish() }).nullish(), output_tokens: exports_external.number(), output_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish() }).nullish() });\nvar si = exports_external.object({ type: exports_external.literal(`response.output_text.delta`), item_id: exports_external.string(), delta: exports_external.string(), logprobs: ii.nullish() });\nvar ci = exports_external.object({ type: exports_external.literal(`error`), code: exports_external.string(), message: exports_external.string(), param: exports_external.string().nullish(), sequence_number: exports_external.number() });\nvar li = exports_external.object({ type: exports_external.enum([`response.completed`, `response.incomplete`]), response: exports_external.object({ incomplete_details: exports_external.object({ reason: exports_external.string() }).nullish(), usage: oi, service_tier: exports_external.string().nullish() }) });\nvar ui = exports_external.object({ type: exports_external.literal(`response.created`), response: exports_external.object({ id: exports_external.string(), created_at: exports_external.number(), model: exports_external.string(), service_tier: exports_external.string().nullish() }) });\nvar di = exports_external.object({ type: exports_external.literal(`response.output_item.added`), output_index: exports_external.number(), item: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`message`), id: exports_external.string() }), exports_external.object({ type: exports_external.literal(`reasoning`), id: exports_external.string(), encrypted_content: exports_external.string().nullish() }), exports_external.object({ type: exports_external.literal(`function_call`), id: exports_external.string(), call_id: exports_external.string(), name: exports_external.string(), arguments: exports_external.string() }), exports_external.object({ type: exports_external.literal(`web_search_call`), id: exports_external.string(), status: exports_external.string(), action: exports_external.object({ type: exports_external.literal(`search`), query: exports_external.string().optional() }).nullish() }), exports_external.object({ type: exports_external.literal(`computer_call`), id: exports_external.string(), status: exports_external.string() }), exports_external.object({ type: exports_external.literal(`file_search_call`), id: exports_external.string() }), exports_external.object({ type: exports_external.literal(`image_generation_call`), id: exports_external.string() }), exports_external.object({ type: exports_external.literal(`code_interpreter_call`), id: exports_external.string(), container_id: exports_external.string(), code: exports_external.string().nullable(), outputs: exports_external.array(exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`logs`), logs: exports_external.string() }), exports_external.object({ type: exports_external.literal(`image`), url: exports_external.string() })])).nullable(), status: exports_external.string() })]) });\nvar fi = exports_external.object({ type: exports_external.literal(`response.output_item.done`), output_index: exports_external.number(), item: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`message`), id: exports_external.string() }), exports_external.object({ type: exports_external.literal(`reasoning`), id: exports_external.string(), encrypted_content: exports_external.string().nullish() }), exports_external.object({ type: exports_external.literal(`function_call`), id: exports_external.string(), call_id: exports_external.string(), name: exports_external.string(), arguments: exports_external.string(), status: exports_external.literal(`completed`) }), ei, ni, Qr, $r, ti, exports_external.object({ type: exports_external.literal(`computer_call`), id: exports_external.string(), status: exports_external.literal(`completed`) })]) });\nvar pi = exports_external.object({ type: exports_external.literal(`response.function_call_arguments.delta`), item_id: exports_external.string(), output_index: exports_external.number(), delta: exports_external.string() });\nvar mi = exports_external.object({ type: exports_external.literal(`response.code_interpreter_call_code.delta`), item_id: exports_external.string(), output_index: exports_external.number(), delta: exports_external.string() });\nvar hi = exports_external.object({ type: exports_external.literal(`response.code_interpreter_call_code.done`), item_id: exports_external.string(), output_index: exports_external.number(), code: exports_external.string() });\nvar gi = exports_external.object({ type: exports_external.literal(`response.output_text.annotation.added`), annotation: exports_external.discriminatedUnion(`type`, [exports_external.object({ type: exports_external.literal(`url_citation`), url: exports_external.string(), title: exports_external.string() }), exports_external.object({ type: exports_external.literal(`file_citation`), file_id: exports_external.string(), filename: exports_external.string().nullish(), index: exports_external.number().nullish(), start_index: exports_external.number().nullish(), end_index: exports_external.number().nullish(), quote: exports_external.string().nullish() })]) });\nvar _i = exports_external.object({ type: exports_external.literal(`response.reasoning_summary_part.added`), item_id: exports_external.string(), summary_index: exports_external.number() });\nvar vi = exports_external.object({ type: exports_external.literal(`response.reasoning_summary_text.delta`), item_id: exports_external.string(), summary_index: exports_external.number(), delta: exports_external.string() });\nvar yi = exports_external.union([si, li, ui, di, fi, pi, mi, hi, gi, _i, vi, ci, exports_external.object({ type: exports_external.string() }).loose()]);\nfunction bi(e4) {\n return e4.type === `response.output_text.delta`;\n}\nfunction xi(e4) {\n return e4.type === `response.output_item.done`;\n}\nfunction Si(e4) {\n return xi(e4) && e4.item.type === `reasoning`;\n}\nfunction Ci(e4) {\n return e4.type === `response.completed` || e4.type === `response.incomplete`;\n}\nfunction wi(e4) {\n return e4.type === `response.created`;\n}\nfunction Ti(e4) {\n return e4.type === `response.function_call_arguments.delta`;\n}\nfunction Ei(e4) {\n return e4.type === `response.code_interpreter_call_code.delta`;\n}\nfunction Di(e4) {\n return e4.type === `response.code_interpreter_call_code.done`;\n}\nfunction Oi(e4) {\n return e4.type === `response.output_item.added`;\n}\nfunction ki(e4) {\n return Oi(e4) && e4.item.type === `reasoning`;\n}\nfunction Ai(e4) {\n return e4.type === `response.output_text.annotation.added`;\n}\nfunction ji(e4) {\n return e4.type === `response.reasoning_summary_part.added`;\n}\nfunction Mi(e4) {\n return e4.type === `response.reasoning_summary_text.delta`;\n}\nfunction Ni(e4) {\n return e4.type === `error`;\n}\nfunction Pi(e4) {\n let t2 = e4.startsWith(`o3`) || e4.startsWith(`o4-mini`) || e4.startsWith(`gpt-5`) && !e4.startsWith(`gpt-5-chat`), n2 = e4.startsWith(`gpt-4`) || e4.startsWith(`gpt-5-mini`) || e4.startsWith(`gpt-5`) && !e4.startsWith(`gpt-5-nano`) && !e4.startsWith(`gpt-5-chat`) || e4.startsWith(`o3`) || e4.startsWith(`o4-mini`), r2 = { requiredAutoTruncation: false, systemMessageMode: `system`, supportsFlexProcessing: t2, supportsPriorityProcessing: n2 };\n return e4.startsWith(`gpt-5-chat`) ? { ...r2, isReasoningModel: false } : e4.startsWith(`o`) || e4.startsWith(`gpt-5`) || e4.startsWith(`codex-`) || e4.startsWith(`computer-use`) ? e4.startsWith(`o1-mini`) || e4.startsWith(`o1-preview`) ? { ...r2, isReasoningModel: true, systemMessageMode: `remove` } : { ...r2, isReasoningModel: true, systemMessageMode: `developer` } : { ...r2, isReasoningModel: false };\n}\nvar Fi = exports_external.object({ include: exports_external.array(exports_external.enum([`reasoning.encrypted_content`, `file_search_call.results`, `message.output_text.logprobs`])).nullish(), instructions: exports_external.string().nullish(), logprobs: exports_external.union([exports_external.boolean(), exports_external.number().min(1).max(ri)]).optional(), maxToolCalls: exports_external.number().nullish(), metadata: exports_external.any().nullish(), parallelToolCalls: exports_external.boolean().nullish(), previousResponseId: exports_external.string().nullish(), promptCacheKey: exports_external.string().nullish(), reasoningEffort: exports_external.string().nullish(), reasoningSummary: exports_external.string().nullish(), safetyIdentifier: exports_external.string().nullish(), serviceTier: exports_external.enum([`auto`, `flex`, `priority`]).nullish(), store: exports_external.boolean().nullish(), strictJsonSchema: exports_external.boolean().nullish(), textVerbosity: exports_external.enum([`low`, `medium`, `high`]).nullish(), user: exports_external.string().nullish() });\nvar Ii = exports_external.object({ instructions: exports_external.string().nullish(), speed: exports_external.number().min(0.25).max(4).default(1).nullish() });\nvar Li = class {\n constructor(e4, t2) {\n this.modelId = e4, this.config = t2, this.specificationVersion = `v2`;\n }\n get provider() {\n return this.config.provider;\n }\n async getArgs({ text: e4, voice: t2 = `alloy`, outputFormat: n2 = `mp3`, speed: r2, instructions: i3, language: a4, providerOptions: o3 }) {\n let s4 = [], c4 = await L2({ provider: `openai`, providerOptions: o3, schema: Ii }), l3 = { model: this.modelId, input: e4, voice: t2, response_format: `mp3`, speed: r2, instructions: i3 };\n if (n2 && ([`mp3`, `opus`, `aac`, `flac`, `wav`, `pcm`].includes(n2) ? l3.response_format = n2 : s4.push({ type: `unsupported-setting`, setting: `outputFormat`, details: `Unsupported output format: ${n2}. Using mp3 instead.` })), c4) {\n let e5 = {};\n for (let t3 in e5) {\n let n3 = e5[t3];\n n3 !== undefined && (l3[t3] = n3);\n }\n }\n return a4 && s4.push({ type: `unsupported-setting`, setting: `language`, details: `OpenAI speech models do not support language selection. Language parameter "${a4}" was ignored.` }), { requestBody: l3, warnings: s4 };\n }\n async doGenerate(e4) {\n var t2;\n let n2 = (t2 = this.config._internal)?.currentDate?.call(t2) ?? new Date, { requestBody: r2, warnings: i3 } = await this.getArgs(e4), { value: a4, responseHeaders: o3, rawValue: s4 } = await R2({ url: this.config.url({ path: `/audio/speech`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), body: r2, failedResponseHandler: Q2, successfulResponseHandler: wt(), abortSignal: e4.abortSignal, fetch: this.config.fetch });\n return { audio: a4, warnings: i3, request: { body: JSON.stringify(r2) }, response: { timestamp: n2, modelId: this.modelId, headers: o3, body: s4 } };\n }\n};\nvar Ri = exports_external.object({ include: exports_external.array(exports_external.string()).optional(), language: exports_external.string().optional(), prompt: exports_external.string().optional(), temperature: exports_external.number().min(0).max(1).default(0).optional(), timestampGranularities: exports_external.array(exports_external.enum([`word`, `segment`])).default([`segment`]).optional() });\nvar zi = { afrikaans: `af`, arabic: `ar`, armenian: `hy`, azerbaijani: `az`, belarusian: `be`, bosnian: `bs`, bulgarian: `bg`, catalan: `ca`, chinese: `zh`, croatian: `hr`, czech: `cs`, danish: `da`, dutch: `nl`, english: `en`, estonian: `et`, finnish: `fi`, french: `fr`, galician: `gl`, german: `de`, greek: `el`, hebrew: `he`, hindi: `hi`, hungarian: `hu`, icelandic: `is`, indonesian: `id`, italian: `it`, japanese: `ja`, kannada: `kn`, kazakh: `kk`, korean: `ko`, latvian: `lv`, lithuanian: `lt`, macedonian: `mk`, malay: `ms`, marathi: `mr`, maori: `mi`, nepali: `ne`, norwegian: `no`, persian: `fa`, polish: `pl`, portuguese: `pt`, romanian: `ro`, russian: `ru`, serbian: `sr`, slovak: `sk`, slovenian: `sl`, spanish: `es`, swahili: `sw`, swedish: `sv`, tagalog: `tl`, tamil: `ta`, thai: `th`, turkish: `tr`, ukrainian: `uk`, urdu: `ur`, vietnamese: `vi`, welsh: `cy` };\nvar Bi = class {\n constructor(e4, t2) {\n this.modelId = e4, this.config = t2, this.specificationVersion = `v2`;\n }\n get provider() {\n return this.config.provider;\n }\n async getArgs({ audio: e4, mediaType: t2, providerOptions: n2 }) {\n let r2 = [], i3 = await L2({ provider: `openai`, providerOptions: n2, schema: Ri }), a4 = new FormData, o3 = e4 instanceof Uint8Array ? new Blob([e4]) : new Blob([Dt(e4)]);\n a4.append(`model`, this.modelId);\n let s4 = rt(t2);\n if (a4.append(`file`, new File([o3], `audio`, { type: t2 }), `audio.${s4}`), i3) {\n let e5 = { include: i3.include, language: i3.language, prompt: i3.prompt, response_format: [`gpt-4o-transcribe`, `gpt-4o-mini-transcribe`].includes(this.modelId) ? `json` : `verbose_json`, temperature: i3.temperature, timestamp_granularities: i3.timestampGranularities };\n for (let [t3, n3] of Object.entries(e5))\n if (n3 != null)\n if (Array.isArray(n3))\n for (let e6 of n3)\n a4.append(`${t3}[]`, String(e6));\n else\n a4.append(t3, String(n3));\n }\n return { formData: a4, warnings: r2 };\n }\n async doGenerate(e4) {\n var t2;\n let n2 = (t2 = this.config._internal)?.currentDate?.call(t2) ?? new Date, { formData: r2, warnings: i3 } = await this.getArgs(e4), { value: a4, responseHeaders: o3, rawValue: s4 } = await xt({ url: this.config.url({ path: `/audio/transcriptions`, modelId: this.modelId }), headers: M2(this.config.headers(), e4.headers), formData: r2, failedResponseHandler: Q2, successfulResponseHandler: W2(Vi), abortSignal: e4.abortSignal, fetch: this.config.fetch }), c4 = a4.language != null && a4.language in zi ? zi[a4.language] : undefined;\n return { text: a4.text, segments: a4.segments?.map((e5) => ({ text: e5.text, startSecond: e5.start, endSecond: e5.end })) ?? a4.words?.map((e5) => ({ text: e5.word, startSecond: e5.start, endSecond: e5.end })) ?? [], language: c4, durationInSeconds: a4.duration ?? undefined, warnings: i3, response: { timestamp: n2, modelId: this.modelId, headers: o3, body: s4 } };\n }\n};\nvar Vi = exports_external.object({ text: exports_external.string(), language: exports_external.string().nullish(), duration: exports_external.number().nullish(), words: exports_external.array(exports_external.object({ word: exports_external.string(), start: exports_external.number(), end: exports_external.number() })).nullish(), segments: exports_external.array(exports_external.object({ id: exports_external.number(), seek: exports_external.number(), start: exports_external.number(), end: exports_external.number(), text: exports_external.string(), tokens: exports_external.array(exports_external.number()), temperature: exports_external.number(), avg_logprob: exports_external.number(), compression_ratio: exports_external.number(), no_speech_prob: exports_external.number() })).nullish() });\nvar Hi = `2.0.42`;\nfunction $2(e4 = {}) {\n let t2 = K2(nt({ settingValue: e4.baseURL, environmentVariableName: `OPENAI_BASE_URL` })) ?? `https://api.openai.com/v1`, n2 = e4.name ?? `openai`, r2 = () => P2({ Authorization: `Bearer ${I2({ apiKey: e4.apiKey, environmentVariableName: `OPENAI_API_KEY`, description: `OpenAI` })}`, "OpenAI-Organization": e4.organization, "OpenAI-Project": e4.project, ...e4.headers }, `ai-sdk/openai/${Hi}`), i3 = (i4) => new er(i4, { provider: `${n2}.chat`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch }), a4 = (i4) => new pr(i4, { provider: `${n2}.completion`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch }), o3 = (i4) => new vr(i4, { provider: `${n2}.embedding`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch }), s4 = (i4) => new Sr(i4, { provider: `${n2}.image`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch }), c4 = (i4) => new Bi(i4, { provider: `${n2}.transcription`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch }), l3 = (i4) => new Li(i4, { provider: `${n2}.speech`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch }), u3 = (e5) => {\n if (new.target)\n throw Error(`The OpenAI model function cannot be called with the new keyword.`);\n return d2(e5);\n }, d2 = (i4) => new ai(i4, { provider: `${n2}.responses`, url: ({ path: e5 }) => `${t2}${e5}`, headers: r2, fetch: e4.fetch, fileIdPrefixes: [`file-`] }), f3 = function(e5) {\n return u3(e5);\n };\n return f3.languageModel = u3, f3.chat = i3, f3.completion = a4, f3.responses = d2, f3.embedding = o3, f3.textEmbedding = o3, f3.textEmbeddingModel = o3, f3.image = s4, f3.imageModel = s4, f3.transcription = c4, f3.transcriptionModel = c4, f3.speech = l3, f3.speechModel = l3, f3.tools = Kr, f3;\n}\n$2(), exports_external.object({ user: exports_external.string().optional(), reasoningEffort: exports_external.string().optional() });\nvar Ui = { errorSchema: exports_external.object({ error: exports_external.object({ message: exports_external.string(), type: exports_external.string().nullish(), param: exports_external.any().nullish(), code: exports_external.union([exports_external.string(), exports_external.number()]).nullish() }) }), errorToMessage: (e4) => e4.error.message };\nvar Wi = exports_external.object({ prompt_tokens: exports_external.number().nullish(), completion_tokens: exports_external.number().nullish(), total_tokens: exports_external.number().nullish(), prompt_tokens_details: exports_external.object({ cached_tokens: exports_external.number().nullish() }).nullish(), completion_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish(), accepted_prediction_tokens: exports_external.number().nullish(), rejected_prediction_tokens: exports_external.number().nullish() }).nullish() }).nullish();\nexports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ message: exports_external.object({ role: exports_external.literal(`assistant`).nullish(), content: exports_external.string().nullish(), reasoning_content: exports_external.string().nullish(), reasoning: exports_external.string().nullish(), tool_calls: exports_external.array(exports_external.object({ id: exports_external.string().nullish(), function: exports_external.object({ name: exports_external.string(), arguments: exports_external.string() }) })).nullish() }), finish_reason: exports_external.string().nullish() })), usage: Wi }), exports_external.object({ echo: exports_external.boolean().optional(), logitBias: exports_external.record(exports_external.string(), exports_external.number()).optional(), suffix: exports_external.string().optional(), user: exports_external.string().optional() });\nvar Gi = exports_external.object({ prompt_tokens: exports_external.number(), completion_tokens: exports_external.number(), total_tokens: exports_external.number() });\nexports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ text: exports_external.string(), finish_reason: exports_external.string() })), usage: Gi.nullish() }), exports_external.object({ dimensions: exports_external.number().optional(), user: exports_external.string().optional() }), exports_external.object({ data: exports_external.array(exports_external.object({ embedding: exports_external.array(exports_external.number()) })), usage: exports_external.object({ prompt_tokens: exports_external.number() }).nullish(), providerMetadata: exports_external.record(exports_external.string(), exports_external.record(exports_external.string(), exports_external.any())).optional() });\nvar Ki = class {\n constructor(e4, t2) {\n this.modelId = e4, this.config = t2, this.specificationVersion = `v2`, this.maxImagesPerCall = 10;\n }\n get provider() {\n return this.config.provider;\n }\n async doGenerate({ prompt: e4, n: t2, size: n2, aspectRatio: r2, seed: i3, providerOptions: a4, headers: o3, abortSignal: s4 }) {\n var c4;\n let l3 = [];\n r2 != null && l3.push({ type: `unsupported-setting`, setting: `aspectRatio`, details: "This model does not support aspect ratio. Use `size` instead." }), i3 != null && l3.push({ type: `unsupported-setting`, setting: `seed` });\n let u3 = (c4 = this.config._internal)?.currentDate?.call(c4) ?? new Date, { value: d2, responseHeaders: f3 } = await R2({ url: this.config.url({ path: `/images/generations`, modelId: this.modelId }), headers: M2(this.config.headers(), o3), body: { model: this.modelId, prompt: e4, n: t2, size: n2, ...a4.openai ?? {}, response_format: `b64_json` }, failedResponseHandler: H2(this.config.errorStructure ?? Ui), successfulResponseHandler: W2(qi), abortSignal: s4, fetch: this.config.fetch });\n return { images: d2.data.map((e5) => e5.b64_json), warnings: l3, response: { timestamp: u3, modelId: this.modelId, headers: f3 } };\n }\n};\nvar qi = exports_external.object({ data: exports_external.array(exports_external.object({ b64_json: exports_external.string() })) });\nfunction Ji(e4) {\n let t2 = [], n2 = [];\n for (let { role: n3, content: r2 } of e4)\n switch (n3) {\n case `system`:\n t2.push({ role: `system`, content: r2 });\n break;\n case `user`:\n if (r2.length === 1 && r2[0].type === `text`) {\n t2.push({ role: `user`, content: r2[0].text });\n break;\n }\n t2.push({ role: `user`, content: r2.map((e5) => {\n switch (e5.type) {\n case `text`:\n return { type: `text`, text: e5.text };\n case `file`:\n if (e5.mediaType.startsWith(`image/`)) {\n let t3 = e5.mediaType === `image/*` ? `image/jpeg` : e5.mediaType;\n return { type: `image_url`, image_url: { url: e5.data instanceof URL ? e5.data.toString() : `data:${t3};base64,${G2(e5.data)}` } };\n } else\n throw new j2({ functionality: `file part media type ${e5.mediaType}` });\n }\n }) });\n break;\n case `assistant`: {\n let e5 = ``, n4 = [];\n for (let t3 of r2)\n switch (t3.type) {\n case `text`:\n e5 += t3.text;\n break;\n case `tool-call`:\n n4.push({ id: t3.toolCallId, type: `function`, function: { name: t3.toolName, arguments: JSON.stringify(t3.input) } });\n break;\n }\n t2.push({ role: `assistant`, content: e5, tool_calls: n4.length > 0 ? n4 : undefined });\n break;\n }\n case `tool`:\n for (let e5 of r2) {\n let n4 = e5.output, r3;\n switch (n4.type) {\n case `text`:\n case `error-text`:\n r3 = n4.value;\n break;\n case `content`:\n case `json`:\n case `error-json`:\n r3 = JSON.stringify(n4.value);\n break;\n }\n t2.push({ role: `tool`, tool_call_id: e5.toolCallId, content: r3 });\n }\n break;\n default: {\n let e5 = n3;\n throw Error(`Unsupported role: ${e5}`);\n }\n }\n return { messages: t2, warnings: n2 };\n}\nfunction Yi({ id: e4, model: t2, created: n2 }) {\n return { id: e4 ?? undefined, modelId: t2 ?? undefined, timestamp: n2 == null ? undefined : new Date(n2 * 1000) };\n}\nfunction Xi(e4) {\n switch (e4) {\n case `stop`:\n return `stop`;\n case `length`:\n return `length`;\n case `tool_calls`:\n case `function_call`:\n return `tool-calls`;\n case `content_filter`:\n return `content-filter`;\n default:\n return `unknown`;\n }\n}\nvar Zi = exports_external.object({ type: exports_external.literal(`web`), country: exports_external.string().length(2).optional(), excludedWebsites: exports_external.array(exports_external.string()).max(5).optional(), allowedWebsites: exports_external.array(exports_external.string()).max(5).optional(), safeSearch: exports_external.boolean().optional() });\nvar Qi = exports_external.object({ type: exports_external.literal(`x`), excludedXHandles: exports_external.array(exports_external.string()).optional(), includedXHandles: exports_external.array(exports_external.string()).optional(), postFavoriteCount: exports_external.number().int().optional(), postViewCount: exports_external.number().int().optional(), xHandles: exports_external.array(exports_external.string()).optional() });\nvar $i = exports_external.object({ type: exports_external.literal(`news`), country: exports_external.string().length(2).optional(), excludedWebsites: exports_external.array(exports_external.string()).max(5).optional(), safeSearch: exports_external.boolean().optional() });\nvar ea = exports_external.object({ type: exports_external.literal(`rss`), links: exports_external.array(exports_external.string().url()).max(1) });\nvar ta = exports_external.discriminatedUnion(`type`, [Zi, Qi, $i, ea]);\nvar na = exports_external.object({ reasoningEffort: exports_external.enum([`low`, `high`]).optional(), searchParameters: exports_external.object({ mode: exports_external.enum([`off`, `auto`, `on`]), returnCitations: exports_external.boolean().optional(), fromDate: exports_external.string().optional(), toDate: exports_external.string().optional(), maxSearchResults: exports_external.number().min(1).max(50).optional(), sources: exports_external.array(ta).optional() }).optional() });\nvar ra = exports_external.object({ error: exports_external.object({ message: exports_external.string(), type: exports_external.string().nullish(), param: exports_external.any().nullish(), code: exports_external.union([exports_external.string(), exports_external.number()]).nullish() }) });\nvar ia = H2({ errorSchema: ra, errorToMessage: (e4) => e4.error.message });\nfunction aa({ tools: e4, toolChoice: t2 }) {\n e4 = e4?.length ? e4 : undefined;\n let n2 = [];\n if (e4 == null)\n return { tools: undefined, toolChoice: undefined, toolWarnings: n2 };\n let r2 = [];\n for (let t3 of e4)\n t3.type === `provider-defined` ? n2.push({ type: `unsupported-tool`, tool: t3 }) : r2.push({ type: `function`, function: { name: t3.name, description: t3.description, parameters: t3.inputSchema } });\n if (t2 == null)\n return { tools: r2, toolChoice: undefined, toolWarnings: n2 };\n let i3 = t2.type;\n switch (i3) {\n case `auto`:\n case `none`:\n return { tools: r2, toolChoice: i3, toolWarnings: n2 };\n case `required`:\n return { tools: r2, toolChoice: `required`, toolWarnings: n2 };\n case `tool`:\n return { tools: r2, toolChoice: { type: `function`, function: { name: t2.toolName } }, toolWarnings: n2 };\n default:\n throw new j2({ functionality: `tool choice type: ${i3}` });\n }\n}\nvar oa = class {\n constructor(e4, t2) {\n this.specificationVersion = `v2`, this.supportedUrls = { "image/*": [/^https?:\\/\\/.*$/] }, this.modelId = e4, this.config = t2;\n }\n get provider() {\n return this.config.provider;\n }\n async getArgs({ prompt: e4, maxOutputTokens: t2, temperature: n2, topP: r2, topK: i3, frequencyPenalty: a4, presencePenalty: o3, stopSequences: s4, seed: c4, responseFormat: l3, providerOptions: u3, tools: d2, toolChoice: f3 }) {\n let p3 = [], m3 = await L2({ provider: `xai`, providerOptions: u3, schema: na }) ?? {};\n i3 != null && p3.push({ type: `unsupported-setting`, setting: `topK` }), a4 != null && p3.push({ type: `unsupported-setting`, setting: `frequencyPenalty` }), o3 != null && p3.push({ type: `unsupported-setting`, setting: `presencePenalty` }), s4 != null && p3.push({ type: `unsupported-setting`, setting: `stopSequences` }), l3 != null && l3.type === `json` && l3.schema != null && p3.push({ type: `unsupported-setting`, setting: `responseFormat`, details: `JSON response format schema is not supported` });\n let { messages: h3, warnings: g3 } = Ji(e4);\n p3.push(...g3);\n let { tools: _3, toolChoice: v3, toolWarnings: y3 } = aa({ tools: d2, toolChoice: f3 });\n return p3.push(...y3), { args: { model: this.modelId, max_tokens: t2, temperature: n2, top_p: r2, seed: c4, reasoning_effort: m3.reasoningEffort, response_format: l3?.type === `json` ? l3.schema == null ? { type: `json_object` } : { type: `json_schema`, json_schema: { name: l3.name ?? `response`, schema: l3.schema, strict: true } } : undefined, search_parameters: m3.searchParameters ? { mode: m3.searchParameters.mode, return_citations: m3.searchParameters.returnCitations, from_date: m3.searchParameters.fromDate, to_date: m3.searchParameters.toDate, max_search_results: m3.searchParameters.maxSearchResults, sources: m3.searchParameters.sources?.map((e5) => ({ type: e5.type, ...e5.type === `web` && { country: e5.country, excluded_websites: e5.excludedWebsites, allowed_websites: e5.allowedWebsites, safe_search: e5.safeSearch }, ...e5.type === `x` && { excluded_x_handles: e5.excludedXHandles, included_x_handles: e5.includedXHandles ?? e5.xHandles, post_favorite_count: e5.postFavoriteCount, post_view_count: e5.postViewCount }, ...e5.type === `news` && { country: e5.country, excluded_websites: e5.excludedWebsites, safe_search: e5.safeSearch }, ...e5.type === `rss` && { links: e5.links } })) } : undefined, messages: h3, tools: _3, tool_choice: v3 }, warnings: p3 };\n }\n async doGenerate(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), { responseHeaders: r2, value: i3, rawValue: a4 } = await R2({ url: `${this.config.baseURL ?? `https://api.x.ai/v1`}/chat/completions`, headers: M2(this.config.headers(), e4.headers), body: t2, failedResponseHandler: ia, successfulResponseHandler: W2(ca), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = i3.choices[0], s4 = [];\n if (o3.message.content != null && o3.message.content.length > 0) {\n let e5 = o3.message.content, n3 = t2.messages[t2.messages.length - 1];\n n3?.role === `assistant` && e5 === n3.content && (e5 = ``), e5.length > 0 && s4.push({ type: `text`, text: e5 });\n }\n if (o3.message.reasoning_content != null && o3.message.reasoning_content.length > 0 && s4.push({ type: `reasoning`, text: o3.message.reasoning_content }), o3.message.tool_calls != null)\n for (let e5 of o3.message.tool_calls)\n s4.push({ type: `tool-call`, toolCallId: e5.id, toolName: e5.function.name, input: e5.function.arguments });\n if (i3.citations != null)\n for (let e5 of i3.citations)\n s4.push({ type: `source`, sourceType: `url`, id: this.config.generateId(), url: e5 });\n return { content: s4, finishReason: Xi(o3.finish_reason), usage: { inputTokens: i3.usage.prompt_tokens, outputTokens: i3.usage.completion_tokens, totalTokens: i3.usage.total_tokens, reasoningTokens: i3.usage.completion_tokens_details?.reasoning_tokens ?? undefined }, request: { body: t2 }, response: { ...Yi(i3), headers: r2, body: a4 }, warnings: n2 };\n }\n async doStream(e4) {\n let { args: t2, warnings: n2 } = await this.getArgs(e4), r2 = { ...t2, stream: true, stream_options: { include_usage: true } }, { responseHeaders: i3, value: a4 } = await R2({ url: `${this.config.baseURL ?? `https://api.x.ai/v1`}/chat/completions`, headers: M2(this.config.headers(), e4.headers), body: r2, failedResponseHandler: ia, successfulResponseHandler: U2(la), abortSignal: e4.abortSignal, fetch: this.config.fetch }), o3 = `unknown`, s4 = { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined }, c4 = true, l3 = {}, u3 = {}, d2 = this;\n return { stream: a4.pipeThrough(new TransformStream({ start(e5) {\n e5.enqueue({ type: `stream-start`, warnings: n2 });\n }, transform(t3, n3) {\n if (e4.includeRawChunks && n3.enqueue({ type: `raw`, rawValue: t3.rawValue }), !t3.success) {\n n3.enqueue({ type: `error`, error: t3.error });\n return;\n }\n let i4 = t3.value;\n if (c4 &&= (n3.enqueue({ type: `response-metadata`, ...Yi(i4) }), false), i4.citations != null)\n for (let e5 of i4.citations)\n n3.enqueue({ type: `source`, sourceType: `url`, id: d2.config.generateId(), url: e5 });\n i4.usage != null && (s4.inputTokens = i4.usage.prompt_tokens, s4.outputTokens = i4.usage.completion_tokens, s4.totalTokens = i4.usage.total_tokens, s4.reasoningTokens = i4.usage.completion_tokens_details?.reasoning_tokens ?? undefined);\n let a5 = i4.choices[0];\n if (a5?.finish_reason != null && (o3 = Xi(a5.finish_reason)), a5?.delta == null)\n return;\n let { delta: f3, index: p3 } = a5;\n if (f3.content != null && f3.content.length > 0) {\n let e5 = f3.content, t4 = r2.messages[r2.messages.length - 1];\n if (t4?.role === `assistant` && e5 === t4.content)\n return;\n let a6 = `text-${i4.id || p3}`;\n l3[a6] ?? (l3[a6] = { type: `text` }, n3.enqueue({ type: `text-start`, id: a6 })), n3.enqueue({ type: `text-delta`, id: a6, delta: e5 });\n }\n if (f3.reasoning_content != null && f3.reasoning_content.length > 0) {\n let e5 = `reasoning-${i4.id || p3}`;\n if (u3[e5] === f3.reasoning_content)\n return;\n u3[e5] = f3.reasoning_content, l3[e5] ?? (l3[e5] = { type: `reasoning` }, n3.enqueue({ type: `reasoning-start`, id: e5 })), n3.enqueue({ type: `reasoning-delta`, id: e5, delta: f3.reasoning_content });\n }\n if (f3.tool_calls != null)\n for (let e5 of f3.tool_calls) {\n let t4 = e5.id;\n n3.enqueue({ type: `tool-input-start`, id: t4, toolName: e5.function.name }), n3.enqueue({ type: `tool-input-delta`, id: t4, delta: e5.function.arguments }), n3.enqueue({ type: `tool-input-end`, id: t4 }), n3.enqueue({ type: `tool-call`, toolCallId: t4, toolName: e5.function.name, input: e5.function.arguments });\n }\n }, flush(e5) {\n for (let [t3, n3] of Object.entries(l3))\n e5.enqueue({ type: n3.type === `text` ? `text-end` : `reasoning-end`, id: t3 });\n e5.enqueue({ type: `finish`, finishReason: o3, usage: s4 });\n } })), request: { body: r2 }, response: { headers: i3 } };\n }\n};\nvar sa = exports_external.object({ prompt_tokens: exports_external.number(), completion_tokens: exports_external.number(), total_tokens: exports_external.number(), completion_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish() }).nullish() });\nvar ca = exports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ message: exports_external.object({ role: exports_external.literal(`assistant`), content: exports_external.string().nullish(), reasoning_content: exports_external.string().nullish(), tool_calls: exports_external.array(exports_external.object({ id: exports_external.string(), type: exports_external.literal(`function`), function: exports_external.object({ name: exports_external.string(), arguments: exports_external.string() }) })).nullish() }), index: exports_external.number(), finish_reason: exports_external.string().nullish() })), object: exports_external.literal(`chat.completion`), usage: sa, citations: exports_external.array(exports_external.string().url()).nullish() });\nvar la = exports_external.object({ id: exports_external.string().nullish(), created: exports_external.number().nullish(), model: exports_external.string().nullish(), choices: exports_external.array(exports_external.object({ delta: exports_external.object({ role: exports_external.enum([`assistant`]).optional(), content: exports_external.string().nullish(), reasoning_content: exports_external.string().nullish(), tool_calls: exports_external.array(exports_external.object({ id: exports_external.string(), type: exports_external.literal(`function`), function: exports_external.object({ name: exports_external.string(), arguments: exports_external.string() }) })).nullish() }), finish_reason: exports_external.string().nullish(), index: exports_external.number() })), usage: sa.nullish(), citations: exports_external.array(exports_external.string().url()).nullish() });\nvar ua = `2.0.23`;\nvar da = { errorSchema: ra, errorToMessage: (e4) => e4.error.message };\nfunction fa(e4 = {}) {\n let t2 = K2(e4.baseURL ?? `https://api.x.ai/v1`), n2 = () => P2({ Authorization: `Bearer ${I2({ apiKey: e4.apiKey, environmentVariableName: `XAI_API_KEY`, description: `xAI API key` })}`, ...e4.headers }, `ai-sdk/xai/${ua}`), r2 = (r3) => new oa(r3, { provider: `xai.chat`, baseURL: t2, headers: n2, generateId: F2, fetch: e4.fetch }), i3 = (r3) => new Ki(r3, { provider: `xai.image`, url: ({ path: e5 }) => `${t2}${e5}`, headers: n2, fetch: e4.fetch, errorStructure: da }), a4 = (e5) => r2(e5);\n return a4.languageModel = r2, a4.chat = r2, a4.textEmbeddingModel = (e5) => {\n throw new k2({ modelId: e5, modelType: `textEmbeddingModel` });\n }, a4.imageModel = i3, a4.image = i3, a4;\n}\nfa();\nvar ma = `BLINK_API_URL`;\n\n// src/server.ts\nfunction startInternalAPIServer() {\n let blinkAuthToken;\n const getClient = () => {\n return new AgentInvocationClient({\n baseURL: process.env[InternalAPIServerURLEnvironmentVariable],\n authToken: blinkAuthToken\n });\n };\n const port = process.env[InternalAPIServerListenPortEnvironmentVariable] ? parseInt(process.env[InternalAPIServerListenPortEnvironmentVariable]) : 12345;\n const store = {\n get(key) {\n return getClient().getStorage(key);\n },\n set(key, value) {\n return getClient().setStorage(key, value);\n },\n delete(key) {\n return getClient().deleteStorage(key);\n },\n list(prefix, options) {\n return getClient().listStorage(prefix, options);\n }\n };\n const otlp = {\n traces(request) {\n return getClient().proxyOtlpTraces(request);\n }\n };\n const chat = {\n upsert: async (key) => {\n const resp = await getClient().upsertChat(JSON.stringify(key));\n return {\n created: resp.created,\n id: resp.id,\n createdAt: resp.created_at\n };\n },\n delete: async (id) => {\n await getClient().deleteChat(id);\n },\n deleteMessages: async (id, messageIds) => {\n await getClient().deleteMessages(id, messageIds);\n },\n get: async (id) => {\n const resp = await getClient().getChat(id);\n if (!resp) {\n return;\n }\n return {\n id: resp.id,\n createdAt: resp.createdAt\n };\n },\n getMessages: async (id) => {\n const messages = await getClient().getMessages(id);\n return messages.map((message) => ({\n id: message.id,\n role: message.role,\n parts: message.parts,\n metadata: message.metadata\n }));\n },\n start: async (id) => {\n await getClient().startChat(id);\n },\n stop: async (id) => {\n await getClient().stopChat(id);\n },\n sendMessages: async (id, messages, options) => {\n await getClient().sendMessages(id, {\n messages: messages.map((msg) => ({\n id: msg.id,\n role: msg.role,\n parts: msg.parts,\n metadata: msg.metadata\n })),\n behavior: options?.behavior ?? "enqueue"\n });\n }\n };\n const server = createServer(createServerAdapter((request) => {\n return ve.fetch(request, {\n chat,\n store,\n otlp\n });\n }));\n server.listen(port, "127.0.0.1");\n process.env[ma] = `http://127.0.0.1:${port}`;\n return {\n server,\n port,\n setAuthToken(authToken) {\n blinkAuthToken = authToken;\n process.env["BLINK_INVOCATION_AUTH_TOKEN"] = authToken;\n }\n };\n}\nasync function startAgentServer(entrypoint, port, unref = false) {\n const priorEnvPort = process.env.PORT;\n process.env.PORT = port.toString();\n const originalListen = Server.prototype.listen;\n const listeningPromise = new Promise((resolve, reject) => {\n Server.prototype.listen = function(...args) {\n this.on("listening", () => {\n resolve(undefined);\n });\n this.on("error", (err) => {\n reject(err);\n });\n if (unref) {\n this.unref();\n }\n return originalListen.apply(this, args);\n };\n });\n await import(entrypoint);\n process.env.PORT = priorEnvPort;\n const agentUrl = `http://127.0.0.1:${port}`;\n const handler = createServerAdapter((request) => {\n const reqURL = new URL(request.url);\n const newURL = new URL(agentUrl);\n newURL.pathname = reqURL.pathname;\n newURL.search = reqURL.search;\n return fetch(newURL.toString(), request);\n });\n await listeningPromise;\n return handler;\n}\n\n// src/lambda/wrapper-lambda.ts\nvar { setAuthToken, server, port } = startInternalAPIServer();\nserver.unref();\nif (!process.env.ENTRYPOINT) {\n throw new Error("developer error: ENTRYPOINT is not set");\n}\nvar agent = await startAgentServer(resolve(process.env.ENTRYPOINT), port + 1, true);\nvar handler = awslambda.streamifyResponse(async (event, responseStream, context) => {\n const waitUntilSymbol = Symbol.for("@blink/waitUntil");\n let waitUntilPromises = [];\n globalThis[waitUntilSymbol] = (promise2) => {\n waitUntilPromises.push(promise2);\n };\n const isV2 = "rawPath" in event;\n const path = isV2 ? event.rawPath : event.path;\n const query = isV2 ? event.rawQueryString : new URLSearchParams(event.queryStringParameters || {}).toString();\n const method = isV2 ? event.requestContext?.http?.method : event.httpMethod;\n const url2 = new URL(path + (query ? `?${query}` : ""), "https://lambda.internal");\n const headers = buildHeaders(event);\n for (const [k3, v3] of headers.entries()) {\n if (k3.toLowerCase() === BlinkInvocationTokenHeader.toLowerCase()) {\n setAuthToken(v3);\n headers.delete(k3);\n break;\n }\n }\n let body;\n if (event.body != null && method !== "GET" && method !== "HEAD") {\n body = event.isBase64Encoded ? Buffer.from(event.body, "base64") : event.body;\n }\n const controller = new AbortController;\n const onCloseOrError = () => {\n controller.abort();\n };\n responseStream.on("close", onCloseOrError);\n responseStream.on("error", onCloseOrError);\n const msLeft = Math.max(0, context.getRemainingTimeInMillis() - 5000);\n const timeout = setTimeout(() => controller.abort(), msLeft);\n try {\n const res = await agent.fetch(url2, { method, body, headers, signal: controller.signal }, { event, lambdaContext: context });\n const resHeaders = {};\n res.headers.forEach((value, key) => {\n resHeaders[key] = value;\n });\n const cookies = res.headers.getSetCookie?.() ?? (res.headers.get("set-cookie") ? [res.headers.get("set-cookie")] : []);\n const http = awslambda.HttpResponseStream.from(responseStream, {\n statusCode: res.status,\n headers: resHeaders,\n cookies\n });\n if (res.body) {\n await res.body.pipeTo(Writable.toWeb(http), { signal: controller.signal });\n } else {\n http.end();\n }\n } catch (err) {\n try {\n const http = awslambda.HttpResponseStream.from(responseStream, {\n statusCode: controller.signal.aborted ? 499 : 502,\n headers: { "content-type": "application/json" }\n });\n http.write(JSON.stringify({\n message: controller.signal.aborted ? "client closed" : "upstream error"\n }));\n http.end();\n } catch {}\n } finally {\n clearTimeout(timeout);\n responseStream.off("close", onCloseOrError);\n responseStream.off("error", onCloseOrError);\n const flushController = new AbortController;\n const flushTimeout = setTimeout(() => flushController.abort("timeout"), 5000);\n try {\n await Promise.allSettled(waitUntilPromises);\n await agent.fetch(new URL("/_agent/flush-otel", "http://lambda.internal"), {\n method: "POST",\n signal: flushController.signal\n });\n } catch {} finally {\n clearTimeout(flushTimeout);\n }\n }\n});\nfunction buildHeaders(event) {\n const out = new Headers;\n const hv1 = event?.headers ?? {};\n for (const [k3, v3] of Object.entries(hv1)) {\n if (v3 == null)\n continue;\n out.set(k3, String(v3));\n }\n const mv = event?.multiValueHeaders ?? {};\n for (const [k3, arr] of Object.entries(mv)) {\n if (!Array.isArray(arr))\n continue;\n out.delete(k3);\n for (const v3 of arr)\n out.append(k3, String(v3));\n }\n if (Array.isArray(event?.cookies) && event.cookies.length) {\n const existing = out.get("cookie");\n const merged = [existing, event.cookies.join("; ")].filter(Boolean).join("; ");\n out.set("cookie", merged);\n }\n if (!out.has("x-forwarded-proto"))\n out.set("x-forwarded-proto", "https");\n if (!out.has("x-forwarded-host") && out.has("host")) {\n out.set("x-forwarded-host", out.get("host"));\n }\n const sourceIp = event?.requestContext?.http?.sourceIp ?? event?.requestContext?.identity?.sourceIp;\n if (sourceIp) {\n const xff = out.get("x-forwarded-for");\n out.set("x-forwarded-for", xff ? `${xff}, ${sourceIp}` : sourceIp);\n }\n return out;\n}\nexport {\n handler\n};\n'; diff --git a/packages/runtime/src/lambda/wrapper-lambda.test.ts b/packages/runtime/src/lambda/wrapper-lambda.test.ts new file mode 100644 index 0000000..f0729af --- /dev/null +++ b/packages/runtime/src/lambda/wrapper-lambda.test.ts @@ -0,0 +1,194 @@ +import { generateAgentInvocationToken } from "@blink.so/api/agents/me/server"; +import { serve } from "@blink.so/api/test"; +import { + BlinkInvocationTokenHeader, + InternalAPIServerListenPortEnvironmentVariable, + InternalAPIServerURLEnvironmentVariable, +} from "@blink.so/runtime/types"; +import { afterAll, beforeAll, beforeEach, expect, test } from "bun:test"; +import { rm } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { Writable } from "node:stream"; +import { TransformStream, WritableStream } from "node:stream/web"; +import llambaWrapper from "./wrapper-lambda.generated"; + +let testFile: string; +let toRemove: string[]; + +// Track active HTTP servers so we can forcefully close them after tests +const activeServers: Set = new Set(); + +beforeAll(async () => { + delete process.env.ENTRYPOINT; + testFile = join(tmpdir(), `${crypto.randomUUID()}.js`); + await Bun.write(testFile, llambaWrapper); + toRemove = [testFile]; + + // Monkey-patch Server.prototype.listen to track all servers + const http = await import("node:http"); + const Server = http.Server; + const originalListen = Server.prototype.listen; + Server.prototype.listen = function (...args: any[]) { + activeServers.add(this); + return originalListen.apply(this, args); + }; +}); + +const seen: number[] = []; +beforeEach(() => { + let port = Math.floor(Math.random() * 20000 + 10000); + while (seen.includes(port)) { + port = Math.floor(Math.random() * 20000 + 10000); + } + seen.push(port); + delete require.cache[testFile]; + process.env[InternalAPIServerListenPortEnvironmentVariable] = port.toString(); +}); + +afterAll(async () => { + // Close all HTTP servers created during tests + // This is necessary because even with .unref(), servers created + // by the lambda wrapper and fixture code can keep the process alive + for (const server of activeServers) { + try { + if (server.listening) { + server.close(); + } + } catch (e) { + // Ignore errors + } + } + activeServers.clear(); + + for (const file of toRemove) { + await rm(file); + } +}); + +test( + "using the storage api", + async () => { + const { url, helpers, bindings, stop } = await serve(); + try { + process.env[InternalAPIServerURLEnvironmentVariable] = url.toString(); + const { client } = await helpers.createUser(); + + const org = await client.organizations.create({ + name: "test-org", + }); + const agent = await client.agents.create({ + name: "test-agent", + description: "Test Description", + organization_id: org.id, + }); + + const deployment = await client.agents.deployments.create({ + agent_id: agent.id, + target: "production", + output_files: [ + { + path: "test.js", + data: "console.log('Hello, world!');", + }, + ], + }); + + const target = await ( + await bindings.database() + ).selectAgentDeploymentTargetByName(agent.id, "production"); + if (!target) { + throw new Error("Target not found"); + } + const token = await generateAgentInvocationToken(bindings.AUTH_SECRET, { + agent_id: agent.id, + agent_deployment_id: deployment.id, + agent_deployment_target_id: target.id, + }); + + const fetch = await mockHandler( + require.resolve("./fixtures/client-using-storage") + ); + const resp = await fetch( + new Request("http://localhost:3000/", { + headers: { + [BlinkInvocationTokenHeader]: token, + }, + }) + ); + expect(await resp.text()).toBe("Hello, world!"); + // This test can take a lil. + } finally { + stop(); + // Force close all HTTP servers to prevent hanging + // The lambda wrapper and fixture create servers that need explicit cleanup + for (const server of activeServers) { + try { + if (server.listening) { + server.close(); + } + } catch (e) { + // Ignore errors during cleanup + } + } + activeServers.clear(); + } + }, + { timeout: 10_000 } +); + +// mockHandler mocks out AWS Lambda's handler. +// The fixture should be the path to a TS file. +const mockHandler = async (fixture: string) => { + let statusCode: number; + let headers: Record; + let cookies: string[]; + + globalThis.awslambda = { + streamifyResponse: (h) => { + return h; + }, + HttpResponseStream: { + from: ( + body: WritableStream, + options: { + statusCode: number; + headers: Record; + cookies: string[]; + } + ) => { + statusCode = options.statusCode; + headers = options.headers; + cookies = options.cookies; + return body; + }, + }, + } as any; + + process.env.ENTRYPOINT = require.resolve(fixture); + const result = await import(testFile); + const handler = result.handler; + + return async (request: Request) => { + const url = new URL(request.url); + const event = { + rawPath: url.pathname, + rawQueryString: url.search, + requestContext: { + http: { + method: request.method, + }, + }, + headers: Object.fromEntries(request.headers.entries()), + body: await request.text(), + }; + const transform = new TransformStream(); + handler(event, Writable.fromWeb(transform.writable), { + getRemainingTimeInMillis: () => 10000, + }); + return new Response(transform.readable as ReadableStream, { + status: statusCode, + headers: new Headers(headers), + }); + }; +}; diff --git a/packages/runtime/src/lambda/wrapper-lambda.ts b/packages/runtime/src/lambda/wrapper-lambda.ts new file mode 100644 index 0000000..d8bc491 --- /dev/null +++ b/packages/runtime/src/lambda/wrapper-lambda.ts @@ -0,0 +1,221 @@ +// The purpose of this file is to wrap the Lambda runtime +// request/response handling in a way that is compatible with +// the Blink Agent exports. +// +// After any edits are made, run `./scripts/generate.ts` to +// regenerate this file. The generated file is source-controlled. + +import { BlinkInvocationTokenHeader } from "@blink.so/runtime/types"; +import { resolve } from "node:path"; +import { Writable } from "node:stream"; +import { startAgentServer, startInternalAPIServer } from "../server"; + +const { setAuthToken, server, port } = startInternalAPIServer(); +// It is *extremely* important for Lambda's that we unref the server. +// Otherwise, the Lambda will not exit when requests are made. +// It will hang until the timeout. +server.unref(); + +if (!process.env.ENTRYPOINT) { + throw new Error("developer error: ENTRYPOINT is not set"); +} + +// We must unref here, otherwise the Lambda will stay running. +const agent = await startAgentServer( + resolve(process.env.ENTRYPOINT), + port + 1, + true +); + +export const handler = awslambda.streamifyResponse( + async (event, responseStream, context) => { + // This prevents Lambda's from staying alive after we respond to a request. + // context.callbackWaitsForEmptyEventLoop = false; + + // Lambda's never handle requests concurrently, but they do sequentially. + // + // We can just reset the waitUntil func at the beginning of requests + // to ensure they get a clean context. + // + // This is an internal symbol we use to expose waitUntil to agent code. + // It's not exported from the runtime package, so it's safe to use. + // We use a Symbol to avoid collisions with other libraries. + const waitUntilSymbol = Symbol.for("@blink/waitUntil"); + // Storage for promises registered via waitUntil + const waitUntilPromises: Promise[] = []; + // Expose waitUntil on globalThis + (globalThis as any)[waitUntilSymbol] = (promise: Promise) => { + waitUntilPromises.push(promise); + }; + + const isV2 = "rawPath" in event; + const path = isV2 ? event.rawPath : event.path; + const query = isV2 + ? event.rawQueryString + : new URLSearchParams(event.queryStringParameters || {}).toString(); + const method = isV2 ? event.requestContext?.http?.method : event.httpMethod; + + const url = new URL( + path + (query ? `?${query}` : ""), + "https://lambda.internal" + ); + + // Build canonical Headers + const headers = buildHeaders(event); + + // Strip Blink header (case-insensitive) + for (const [k, v] of headers.entries()) { + if (k.toLowerCase() === BlinkInvocationTokenHeader.toLowerCase()) { + setAuthToken(v); + headers.delete(k); + break; + } + } + + let body: string | Buffer | undefined; + if (event.body != null && method !== "GET" && method !== "HEAD") { + body = event.isBase64Encoded + ? Buffer.from(event.body, "base64") + : event.body; + } + + // It is *extremely* important that we have a controller here. + // If we do not, it's possible upstream that the request closes, + // and we don't notice - then the Lambda's run until timeout. + const controller = new AbortController(); + const onCloseOrError = () => { + controller.abort(); + }; + responseStream.on("close", onCloseOrError); + responseStream.on("error", onCloseOrError); + + // abort a bit before Lambda hard timeout + // we need a bit of extra time to call `/_agent/flush-otel` after the main request is finished + const msLeft = Math.max(0, context.getRemainingTimeInMillis() - 5000); + const timeout = setTimeout(() => controller.abort(), msLeft); + + try { + const res: Response = await agent.fetch( + url, + { method, body, headers, signal: controller.signal }, + { event, lambdaContext: context } + ); + + const resHeaders: Record = {}; + res.headers.forEach((value, key) => { + resHeaders[key] = value; + }); + + const cookies = + res.headers.getSetCookie?.() ?? + (res.headers.get("set-cookie") + ? [res.headers.get("set-cookie") as string] + : []); + + const http = awslambda.HttpResponseStream.from(responseStream, { + statusCode: res.status, + headers: resHeaders, + cookies, + }); + + if (res.body) { + await res.body.pipeTo( + Writable.toWeb(http) as WritableStream>, + { signal: controller.signal } + ); + } else { + http.end(); + } + } catch (err) { + try { + const http = awslambda.HttpResponseStream.from(responseStream, { + statusCode: controller.signal.aborted ? 499 : 502, + headers: { "content-type": "application/json" }, + }); + http.write( + JSON.stringify({ + message: controller.signal.aborted + ? "client closed" + : "upstream error", + }) + ); + http.end(); + } catch {} + } finally { + clearTimeout(timeout); + responseStream.off("close", onCloseOrError); + responseStream.off("error", onCloseOrError); + + const flushController = new AbortController(); + const flushTimeout = setTimeout( + () => flushController.abort("timeout"), + 5000 + ); + try { + // Wait for all waitUntil promises to settle before flushing + await Promise.allSettled(waitUntilPromises); + + // Ensure all OpenTelemetry spans are flushed before the Lambda exits. + await agent.fetch( + new URL("/_agent/flush-otel", "http://lambda.internal"), + { + method: "POST", + signal: flushController.signal, + } + ); + } catch { + // Ignore errors. Older agents may not have the flush endpoint. + } finally { + clearTimeout(flushTimeout); + } + } + } +); + +function buildHeaders(event: any): Headers { + const out = new Headers(); + + // 1) Start with single-value headers + const hv1 = event?.headers ?? {}; + for (const [k, v] of Object.entries(hv1)) { + if (v == null) continue; + out.set(k, String(v)); + } + + // 2) Merge multiValueHeaders (v1) + const mv = event?.multiValueHeaders ?? {}; + for (const [k, arr] of Object.entries(mv)) { + if (!Array.isArray(arr)) continue; + // Remove any single value we might have set, then append all + out.delete(k); + for (const v of arr) out.append(k, String(v)); + } + + // 3) Merge cookies (v2 puts them outside headers) + if (Array.isArray(event?.cookies) && event.cookies.length) { + // If caller already sent Cookie header(s), append + const existing = out.get("cookie"); + const merged = [existing, event.cookies.join("; ")] + .filter(Boolean) + .join("; "); + out.set("cookie", merged); + } + + // 4) Forwarding hints useful to Hono/URL building + // (only set if not already present) + if (!out.has("x-forwarded-proto")) out.set("x-forwarded-proto", "https"); + if (!out.has("x-forwarded-host") && out.has("host")) { + out.set("x-forwarded-host", out.get("host")!); + } + + // 5) Optional: source IP → X-Forwarded-For + const sourceIp = + event?.requestContext?.http?.sourceIp ?? + event?.requestContext?.identity?.sourceIp; + if (sourceIp) { + const xff = out.get("x-forwarded-for"); + out.set("x-forwarded-for", xff ? `${xff}, ${sourceIp}` : sourceIp); + } + + return out; +} diff --git a/packages/runtime/src/node/wrapper-node.generated.ts b/packages/runtime/src/node/wrapper-node.generated.ts new file mode 100644 index 0000000..3a7f0d1 --- /dev/null +++ b/packages/runtime/src/node/wrapper-node.generated.ts @@ -0,0 +1,4 @@ +// This file has been generated by the /home/kyle/projects/coder/blink.so/packages/runtime/scripts/generate.ts script. +// Do not edit this file manually. + +export default 'import{createRequire as $j}from"node:module";var lj=Object.defineProperty;var P=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports);var Xn=(i,n)=>{for(var r in n)lj(i,r,{get:n[r],enumerable:!0,configurable:!0,set:(u)=>n[r]=()=>u})};var T=$j(import.meta.url);var Do=P((wQ,Q0)=>{function Uj(){return Object.keys(globalThis).some((i)=>i.startsWith("__NEXT"))}Q0.exports=function i(){if(globalThis.Deno)return!0;if(globalThis.Bun)return!0;if(Uj())return!0;return!1}});var uw=P((bQ,rw)=>{var{defineProperty:Nu,getOwnPropertyDescriptor:Nj,getOwnPropertyNames:zj}=Object,Wj=Object.prototype.hasOwnProperty,x=(i,n)=>Nu(i,"name",{value:n,configurable:!0}),Dj=(i,n)=>{for(var r in n)Nu(i,r,{get:n[r],enumerable:!0})},Jj=(i,n,r,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of zj(n))!Wj.call(i,t)&&t!==r&&Nu(i,t,{get:()=>n[t],enumerable:!(u=Nj(n,t))||u.enumerable});return i},Ej=(i)=>Jj(Nu({},"__esModule",{value:!0}),i),m0={};Dj(m0,{URLPattern:()=>tw});rw.exports=Ej(m0);var vt=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(i,n,r,u,t,c){this.type=i,this.name=n,this.prefix=r,this.value=u,this.suffix=t,this.modifier=c}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};x(vt,"Part");var Hj=/[$_\\p{ID_Start}]/u,Gj=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,Eo=".*";function S0(i,n){return(n?/^[\\x00-\\xFF]*$/:/^[\\x00-\\x7F]*$/).test(i)}x(S0,"isASCII");function qo(i,n=!1){let r=[],u=0;for(;u{if(gl("OTHER_MODIFIER")??l("ASTERISK"),"tryConsumeModifier"),w=x((j)=>{let O=l(j);if(O!==void 0)return O;let{type:W,index:E}=r[g];throw new TypeError(`Unexpected ${W} at ${E}, expected ${j}`)},"mustConsume"),b=x(()=>{let j="",O;for(;O=l("CHAR")??l("ESCAPED_CHAR");)j+=O;return j},"consumeText"),v=x((j)=>j,"DefaultEncodePart"),f=n.encodePart||v,U="",z=x((j)=>{U+=j},"appendToPendingFixedValue"),J=x(()=>{U.length&&(t.push(new vt(3,"","",f(U),"",3)),U="")},"maybeAddPartFromPendingFixedValue"),N=x((j,O,W,E,X)=>{let H=3;switch(X){case"?":H=1;break;case"*":H=0;break;case"+":H=2;break}if(!O&&!W&&H===3){z(j);return}if(J(),!O&&!W){if(!j)return;t.push(new vt(3,"","",f(j),"",H));return}let Y;W?W==="*"?Y=Eo:Y=W:Y=u;let V=2;Y===u?(V=1,Y=""):Y===Eo&&(V=0,Y="");let Q;if(O?Q=O:W&&(Q=c++),_.has(Q))throw new TypeError(`Duplicate name \'${Q}\'.`);_.add(Q),t.push(new vt(V,Q,f(j),Y,f(E),H))},"addPart");for(;g-1)}return g||(u+=`(?=${c}|${t})`),new RegExp(u,Ho(r))}x(Lo,"partsToRegexp");var In={delimiter:"",prefixes:"",sensitive:!0,strict:!0},qj={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Xj={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function B0(i,n){return i.length?i[0]==="/"?!0:!n||i.length<2?!1:(i[0]=="\\\\"||i[0]=="{")&&i[1]=="/":!1}x(B0,"isAbsolutePathname");function Io(i,n){return i.startsWith(n)?i.substring(n.length,i.length):i}x(Io,"maybeStripPrefix");function K0(i,n){return i.endsWith(n)?i.substr(0,i.length-n.length):i}x(K0,"maybeStripSuffix");function Yo(i){return!i||i.length<2?!1:i[0]==="["||(i[0]==="\\\\"||i[0]==="{")&&i[1]==="["}x(Yo,"treatAsIPv6Hostname");var V0=["ftp","file","http","https","ws","wss"];function Qo(i){if(!i)return!0;for(let n of V0)if(i.test(n))return!0;return!1}x(Qo,"isSpecialScheme");function M0(i,n){if(i=Io(i,"#"),n||i==="")return i;let r=new URL("https://example.com");return r.hash=i,r.hash?r.hash.substring(1,r.hash.length):""}x(M0,"canonicalizeHash");function x0(i,n){if(i=Io(i,"?"),n||i==="")return i;let r=new URL("https://example.com");return r.search=i,r.search?r.search.substring(1,r.search.length):""}x(x0,"canonicalizeSearch");function F0(i,n){return n||i===""?i:Yo(i)?Ao(i):So(i)}x(F0,"canonicalizeHostname");function P0(i,n){if(n||i==="")return i;let r=new URL("https://example.com");return r.password=i,r.password}x(P0,"canonicalizePassword");function y0(i,n){if(n||i==="")return i;let r=new URL("https://example.com");return r.username=i,r.username}x(y0,"canonicalizeUsername");function T0(i,n,r){if(r||i==="")return i;if(n&&!V0.includes(n))return new URL(`${n}:${i}`).pathname;let u=i[0]=="/";return i=new URL(u?i:"/-"+i,"https://example.com").pathname,u||(i=i.substring(2,i.length)),i}x(T0,"canonicalizePathname");function k0(i,n,r){return mo(n)===i&&(i=""),r||i===""?i:Bo(i)}x(k0,"canonicalizePort");function C0(i,n){return i=K0(i,":"),n||i===""?i:zu(i)}x(C0,"canonicalizeProtocol");function mo(i){switch(i){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}x(mo,"defaultPortForProtocol");function zu(i){if(i==="")return i;if(/^[-+.A-Za-z0-9]*$/.test(i))return i.toLowerCase();throw new TypeError(`Invalid protocol \'${i}\'.`)}x(zu,"protocolEncodeCallback");function R0(i){if(i==="")return i;let n=new URL("https://example.com");return n.username=i,n.username}x(R0,"usernameEncodeCallback");function Z0(i){if(i==="")return i;let n=new URL("https://example.com");return n.password=i,n.password}x(Z0,"passwordEncodeCallback");function So(i){if(i==="")return i;if(/[\\t\\n\\r #%/:<>?@[\\]^\\\\|]/g.test(i))throw new TypeError(`Invalid hostname \'${i}\'`);let n=new URL("https://example.com");return n.hostname=i,n.hostname}x(So,"hostnameEncodeCallback");function Ao(i){if(i==="")return i;if(/[^0-9a-fA-F[\\]:]/g.test(i))throw new TypeError(`Invalid IPv6 hostname \'${i}\'`);return i.toLowerCase()}x(Ao,"ipv6HostnameEncodeCallback");function Bo(i){if(i===""||/^[0-9]*$/.test(i)&&parseInt(i)<=65535)return i;throw new TypeError(`Invalid port \'${i}\'.`)}x(Bo,"portEncodeCallback");function e0(i){if(i==="")return i;let n=new URL("https://example.com");return n.pathname=i[0]!=="/"?"/-"+i:i,i[0]!=="/"?n.pathname.substring(2,n.pathname.length):n.pathname}x(e0,"standardURLPathnameEncodeCallback");function p0(i){return i===""?i:new URL(`data:${i}`).pathname}x(p0,"pathURLPathnameEncodeCallback");function d0(i){if(i==="")return i;let n=new URL("https://example.com");return n.search=i,n.search.substring(1,n.search.length)}x(d0,"searchEncodeCallback");function a0(i){if(i==="")return i;let n=new URL("https://example.com");return n.hash=i,n.hash.substring(1,n.hash.length)}x(a0,"hashEncodeCallback");var s0=class{#n;#i=[];#r={};#t=0;#u=1;#c=0;#g=0;#w=0;#b=0;#l=!1;constructor(i){this.#n=i}get result(){return this.#r}parse(){for(this.#i=qo(this.#n,!0);this.#t0)if(this.#G())this.#w-=1;else continue;if(this.#H()){this.#w+=1;continue}switch(this.#g){case 0:this.#W()&&this.#j(1);break;case 1:if(this.#W()){this.#L();let i=7,n=1;this.#D()?(i=2,n=3):this.#l&&(i=2),this.#o(i,n)}break;case 2:this.#N()?this.#j(3):(this.#z()||this.#f()||this.#v())&&this.#j(5);break;case 3:this.#J()?this.#o(4,1):this.#N()&&this.#o(5,1);break;case 4:this.#N()&&this.#o(5,1);break;case 5:this.#q()?this.#b+=1:this.#X()&&(this.#b-=1),this.#E()&&!this.#b?this.#o(6,1):this.#z()?this.#o(7,0):this.#f()?this.#o(8,1):this.#v()&&this.#o(9,1);break;case 6:this.#z()?this.#o(7,0):this.#f()?this.#o(8,1):this.#v()&&this.#o(9,1);break;case 7:this.#f()?this.#o(8,1):this.#v()&&this.#o(9,1);break;case 8:this.#v()&&this.#o(9,1);break;case 9:break;case 10:break}}this.#r.hostname!==void 0&&this.#r.port===void 0&&(this.#r.port="")}#o(i,n){switch(this.#g){case 0:break;case 1:this.#r.protocol=this.#_();break;case 2:break;case 3:this.#r.username=this.#_();break;case 4:this.#r.password=this.#_();break;case 5:this.#r.hostname=this.#_();break;case 6:this.#r.port=this.#_();break;case 7:this.#r.pathname=this.#_();break;case 8:this.#r.search=this.#_();break;case 9:this.#r.hash=this.#_();break;case 10:break}this.#g!==0&&i!==10&&([1,2,3,4].includes(this.#g)&&[6,7,8,9].includes(i)&&(this.#r.hostname??=""),[1,2,3,4,5,6].includes(this.#g)&&[8,9].includes(i)&&(this.#r.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#g)&&i===9&&(this.#r.search??="")),this.#O(i,n)}#O(i,n){this.#g=i,this.#c=this.#t+n,this.#t+=n,this.#u=0}#$(){this.#t=this.#c,this.#u=0}#j(i){this.#$(),this.#g=i}#U(i){return i<0&&(i=this.#i.length-i),i=0&&(i.pathname=si(u.pathname.substring(0,t+1),r)+i.pathname)}i.pathname=T0(i.pathname,i.protocol,r)}return typeof n.search=="string"&&(i.search=x0(n.search,r)),typeof n.hash=="string"&&(i.hash=M0(n.hash,r)),i}x(wt,"applyInit");function bt(i){return i.replace(/([+*?:{}()\\\\])/g,"\\\\$1")}x(bt,"escapePatternString");function iw(i){return i.replace(/([.+*?^${}()[\\]|/\\\\])/g,"\\\\$1")}x(iw,"escapeRegexpString");function nw(i,n){n.delimiter??="/#?",n.prefixes??="./",n.sensitive??=!1,n.strict??=!1,n.end??=!0,n.start??=!0,n.endsWith="";let r=".*",u=`[^${iw(n.delimiter)}]+?`,t=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,c="";for(let g=0;g0?i[g-1]:null,w=g0?w.value[0]:"";l=t.test(b)}else l=!w.hasCustomName();if(!l&&!h.prefix.length&&$&&$.type===3){let b=$.value[$.value.length-1];l=n.prefixes.includes(b)}l&&(c+="{"),c+=bt(h.prefix),_&&(c+=`:${h.name}`),h.type===2?c+=`(${h.value})`:h.type===1?_||(c+=`(${u})`):h.type===0&&(!_&&(!$||$.type===3||$.modifier!==3||l||h.prefix!=="")?c+="*":c+=`(${r})`),h.type===1&&_&&h.suffix.length&&t.test(h.suffix[0])&&(c+="\\\\"),c+=bt(h.suffix),l&&(c+="}"),h.modifier!==3&&(c+=Tn(h.modifier))}return c}x(nw,"partsToPattern");var tw=class{#n;#i={};#r={};#t={};#u={};#c=!1;constructor(i={},n,r){try{let u;if(typeof n=="string"?u=n:r=n,typeof i=="string"){let h=new s0(i);if(h.parse(),i=h.result,u===void 0&&typeof i.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");i.baseURL=u}else{if(!i||typeof i!="object")throw new TypeError("parameter 1 is not of type \'string\' and cannot convert to dictionary.");if(u)throw new TypeError("parameter 1 is not of type \'string\'.")}typeof r>"u"&&(r={ignoreCase:!1});let t={ignoreCase:r.ignoreCase===!0},c={pathname:Ln,protocol:Ln,username:Ln,password:Ln,hostname:Ln,port:Ln,search:Ln,hash:Ln};this.#n=wt(c,i,!0),mo(this.#n.protocol)===this.#n.port&&(this.#n.port="");let g;for(g of Jo){if(!(g in this.#n))continue;let h={},_=this.#n[g];switch(this.#r[g]=[],g){case"protocol":Object.assign(h,In),h.encodePart=zu;break;case"username":Object.assign(h,In),h.encodePart=R0;break;case"password":Object.assign(h,In),h.encodePart=Z0;break;case"hostname":Object.assign(h,qj),Yo(_)?h.encodePart=Ao:h.encodePart=So;break;case"port":Object.assign(h,In),h.encodePart=Bo;break;case"pathname":Qo(this.#i.protocol)?(Object.assign(h,Xj,t),h.encodePart=e0):(Object.assign(h,In,t),h.encodePart=p0);break;case"search":Object.assign(h,In,t),h.encodePart=d0;break;case"hash":Object.assign(h,In,t),h.encodePart=a0;break}try{this.#u[g]=Xo(_,h),this.#i[g]=Lo(this.#u[g],this.#r[g],h),this.#t[g]=nw(this.#u[g],h),this.#c=this.#c||this.#u[g].some((l)=>l.type===2)}catch{throw new TypeError(`invalid ${g} pattern \'${this.#n[g]}\'.`)}}}catch(u){throw new TypeError(`Failed to construct \'URLPattern\': ${u.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test(i={},n){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof i!="string"&&n)throw new TypeError("parameter 1 is not of type \'string\'.");if(typeof i>"u")return!1;try{typeof i=="object"?r=wt(r,i,!1):r=wt(r,Go(i,n),!1)}catch{return!1}let u;for(u of Jo)if(!this.#i[u].exec(r[u]))return!1;return!0}exec(i={},n){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof i!="string"&&n)throw new TypeError("parameter 1 is not of type \'string\'.");if(typeof i>"u")return;try{typeof i=="object"?r=wt(r,i,!1):r=wt(r,Go(i,n),!1)}catch{return null}let u={};n?u.inputs=[i,n]:u.inputs=[i];let t;for(t of Jo){let c=this.#i[t].exec(r[t]);if(!c)return null;let g={};for(let[h,_]of this.#r[t].entries())if(typeof _=="string"||typeof _=="number"){let l=c[h+1];g[_]=l}u[t]={input:r[t]??"",groups:g}}return u}static compareComponent(i,n,r){let u=x((h,_)=>{for(let l of["type","modifier","prefix","value","suffix"]){if(h[l]<_[l])return-1;if(h[l]===_[l])continue;return 1}return 0},"comparePart"),t=new vt(3,"","","","",3),c=new vt(0,"","","","",3),g=x((h,_)=>{let l=0;for(;l{var{URLPattern:cw}=uw();ow.exports={URLPattern:cw};if(!globalThis.URLPattern)globalThis.URLPattern=cw});var Qn=P((bw)=>{Object.defineProperty(bw,"__esModule",{value:!0});bw.isPromise=Wu;bw.isActualPromise=_w;bw.handleMaybePromise=Yn;bw.fakePromise=nn;bw.createDeferredPromise=Lj;bw.iterateAsync=lw;bw.iterateAsyncVoid=lw;bw.fakeRejectPromise=kn;bw.mapMaybePromise=Ij;bw.mapAsyncIterator=Yj;bw.promiseLikeFinally=$w;bw.unfakePromise=ww;var Du=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function Wu(i){return i?.then!=null}function _w(i){let n=i;return n&&n.then&&n.catch&&n.finally}function Yn(i,n,r,u){let t=nn().then(i).then(n,r);if(u)t=t.finally(u);return ww(t)}function nn(i){if(i&&_w(i))return i;if(Wu(i))return{then:(n,r)=>nn(i.then(n,r)),catch:(n)=>nn(i.then((r)=>r,n)),finally:(n)=>nn(n?$w(i,n):i),[Symbol.toStringTag]:"Promise"};return{then(n){if(n)try{return nn(n(i))}catch(r){return kn(r)}return this},catch(){return this},finally(n){if(n)try{return nn(n()).then(()=>i,()=>i)}catch(r){return kn(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:i,[Du]:"resolved"}}function Lj(){if(Promise.withResolvers)return Promise.withResolvers();let i,n;return{promise:new Promise(function u(t,c){i=t,n=c}),get resolve(){return i},get reject(){return n}}}function lw(i,n,r){if(i?.length===0)return;let u=i[Symbol.iterator](),t=0;function c(){let{done:g,value:h}=u.next();if(g)return;let _=!1;function l(){_=!0}return Yn(function $(){return n(h,l,t++)},function $(w){if(w)r?.push(w);if(_)return;return c()})}return c()}function kn(i){return{then(n,r){if(r)try{return nn(r(i))}catch(u){return kn(u)}return this},catch(n){if(n)try{return nn(n(i))}catch(r){return kn(r)}return this},finally(n){if(n)try{n()}catch(r){return kn(r)}return this},__fakeRejectError:i,[Symbol.toStringTag]:"Promise",[Du]:"rejected"}}function Ij(i,n,r){return Yn(()=>i,n,r)}function Yj(i,n,r,u){if(Symbol.asyncIterator in i)i=i[Symbol.asyncIterator]();let t,c,g;if(u){let l;g=($)=>{return l||=Yn(u,()=>$,()=>$),l}}if(typeof i.return==="function")t=i.return,c=(l)=>{let $=()=>{throw l};return t.call(i).then($,$)};function h(l){if(l.done)return g?g(l):l;return Yn(()=>l.value,($)=>Yn(()=>n($),hw,c))}let _;if(r){let l,$=r;_=(w)=>{return l||=Yn(()=>w,(b)=>Yn(()=>$(b),hw,c)),l}}return{next(){return i.next().then(h,_)},return(){let l=t?t.call(i).then(h,_):nn({value:void 0,done:!0});return g?l.then(g):l},throw(l){if(typeof i.throw==="function")return i.throw(l).then(h,_);if(c)return c(l);return kn(l)},[Symbol.asyncIterator](){return this}}}function hw(i){return{value:i,done:!1}}function Qj(i){return i?.[Du]==="resolved"}function mj(i){return i?.[Du]==="rejected"}function $w(i,n){if("finally"in i)return i.finally(n);return i.then((r)=>{let u=n();return Wu(u)?u.then(()=>r):r},(r)=>{let u=n();if(Wu(u))return u.then(()=>{throw r});else throw r})}function ww(i){if(Qj(i))return i.__fakePromiseValue;if(mj(i))throw i.__fakeRejectError;return i}});var Ko=P((NQ,vw)=>{var{EventEmitter:Cj}=T("node:events"),{inherits:Rj}=T("node:util");function Cn(i){if(typeof i==="string")i=Buffer.from(i);if(!Buffer.isBuffer(i))throw new TypeError("The needle has to be a String or a Buffer.");let n=i.length,r=n-1;if(n===0)throw new Error("The needle cannot be an empty String/Buffer.");if(n>256)throw new Error("The needle cannot have a length bigger than 256.");this.maxMatches=1/0,this.matches=0,this._occ=new Uint8Array(256).fill(n),this._lookbehind_size=0,this._needle=i,this._bufpos=0,this._lookbehind=Buffer.alloc(r);for(var u=0;u=0)this.emit("info",!1,this._lookbehind,0,this._lookbehind_size),this._lookbehind_size=0;else{let _=this._lookbehind_size+g;if(_>0)this.emit("info",!1,this._lookbehind,0,_);return this._lookbehind_size-=_,this._lookbehind.copy(this._lookbehind,0,_,this._lookbehind_size),i.copy(this._lookbehind,this._lookbehind_size),this._lookbehind_size+=n,this._bufpos=n,n}}if(g=i.indexOf(r,g+this._bufpos),g!==-1){if(++this.matches,g===0)this.emit("info",!0);else this.emit("info",!0,i,this._bufpos,g);return this._bufpos=g+u}if(g=n-t,g<0)g=0;while(g!==n&&(i[g]!==r[0]||Buffer.compare(i.subarray(g+1,n),r.subarray(1,n-g))!==0))++g;if(g!==n)i.copy(this._lookbehind,0,g,n),this._lookbehind_size=n-g;if(g!==0)this.emit("info",!1,i,this._bufpos,g);return this._bufpos=n,n};Cn.prototype._sbmh_lookup_char=function(i,n){return n<0?this._lookbehind[this._lookbehind_size+n]:i[n]};Cn.prototype._sbmh_memcmp=function(i,n,r){for(var u=0;u{var Zj=T("node:util").inherits,fw=T("node:stream").Readable;function Vo(i){fw.call(this,i)}Zj(Vo,fw);Vo.prototype._read=function(i){};Ow.exports=Vo});var Ju=P((WQ,Uw)=>{Uw.exports=function i(n,r,u){if(!n||n[r]===void 0||n[r]===null)return u;if(typeof n[r]!=="number"||isNaN(n[r]))throw new TypeError("Limit "+r+" is not a valid number");return n[r]}});var Dw=P((DQ,Ww)=>{var zw=T("node:events").EventEmitter,ej=T("node:util").inherits,Nw=Ju(),pj=Ko(),dj=Buffer.from(`\\r\n\\r\n`),aj=/\\r\\n/g,sj=/^([^:]+):[ \\t]?([\\x00-\\xFF]+)?$/;function ft(i){zw.call(this),i=i||{};let n=this;this.nread=0,this.maxed=!1,this.npairs=0,this.maxHeaderPairs=Nw(i,"maxHeaderPairs",2000),this.maxHeaderSize=Nw(i,"maxHeaderSize",81920),this.buffer="",this.header={},this.finished=!1,this.ss=new pj(dj),this.ss.on("info",function(r,u,t,c){if(u&&!n.maxed){if(n.nread+c-t>=n.maxHeaderSize)c=n.maxHeaderSize-n.nread+t,n.nread=n.maxHeaderSize,n.maxed=!0;else n.nread+=c-t;n.buffer+=u.toString("binary",t,c)}if(r)n._finish()})}ej(ft,zw);ft.prototype.push=function(i){let n=this.ss.push(i);if(this.finished)return n};ft.prototype.reset=function(){this.finished=!1,this.buffer="",this.header={},this.ss.reset()};ft.prototype._finish=function(){if(this.buffer)this._parseHeader();this.ss.matches=this.ss.maxMatches;let i=this.header;this.header={},this.buffer="",this.finished=!0,this.nread=this.npairs=0,this.maxed=!1,this.emit("header",i)};ft.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs)return;let i=this.buffer.split(aj),n=i.length,r,u;for(var t=0;t{var Mo=T("node:stream").Writable,iU=T("node:util").inherits,nU=Ko(),Jw=jw(),tU=Dw(),rU=Buffer.from("-"),uU=Buffer.from(`\\r\n`),cU=function(){};function ki(i){if(!(this instanceof ki))return new ki(i);if(Mo.call(this,i),!i||!i.headerFirst&&typeof i.boundary!=="string")throw new TypeError("Boundary required");if(typeof i.boundary==="string")this.setBoundary(i.boundary);else this._bparser=void 0;this._headerFirst=i.headerFirst,this._dashes=0,this._parts=0,this._finished=!1,this._realFinish=!1,this._isPreamble=!0,this._justMatched=!1,this._firstWrite=!0,this._inHeader=!0,this._part=void 0,this._cb=void 0,this._ignoreData=!1,this._partOpts={highWaterMark:i.partHwm},this._pause=!1;let n=this;this._hparser=new tU(i),this._hparser.on("header",function(r){n._inHeader=!1,n._part.emit("header",r)})}iU(ki,Mo);ki.prototype.emit=function(i){if(i==="finish"&&!this._realFinish){if(!this._finished){let n=this;process.nextTick(function(){if(n.emit("error",new Error("Unexpected end of multipart data")),n._part&&!n._ignoreData){let r=n._isPreamble?"Preamble":"Part";n._part.emit("error",new Error(r+" terminated early due to unexpected end of multipart data")),n._part.push(null),process.nextTick(function(){n._realFinish=!0,n.emit("finish"),n._realFinish=!1});return}n._realFinish=!0,n.emit("finish"),n._realFinish=!1})}}else Mo.prototype.emit.apply(this,arguments)};ki.prototype._write=function(i,n,r){if(!this._hparser&&!this._bparser)return r();if(this._headerFirst&&this._isPreamble){if(!this._part)if(this._part=new Jw(this._partOpts),this.listenerCount("preamble")!==0)this.emit("preamble",this._part);else this._ignore();let u=this._hparser.push(i);if(!this._inHeader&&u!==void 0&&u{var Hw=new TextDecoder("utf-8"),Gw=new Map([["utf-8",Hw],["utf8",Hw]]);function oU(i){let n;while(!0)switch(i){case"utf-8":case"utf8":return xt.utf8;case"latin1":case"ascii":case"us-ascii":case"iso-8859-1":case"iso8859-1":case"iso88591":case"iso_8859-1":case"windows-1252":case"iso_8859-1:1987":case"cp1252":case"x-cp1252":return xt.latin1;case"utf16le":case"utf-16le":case"ucs2":case"ucs-2":return xt.utf16le;case"base64":return xt.base64;default:if(n===void 0){n=!0,i=i.toLowerCase();continue}return xt.other.bind(i)}}var xt={utf8:(i,n)=>{if(i.length===0)return"";if(typeof i==="string")i=Buffer.from(i,n);return i.utf8Slice(0,i.length)},latin1:(i,n)=>{if(i.length===0)return"";if(typeof i==="string")return i;return i.latin1Slice(0,i.length)},utf16le:(i,n)=>{if(i.length===0)return"";if(typeof i==="string")i=Buffer.from(i,n);return i.ucs2Slice(0,i.length)},base64:(i,n)=>{if(i.length===0)return"";if(typeof i==="string")i=Buffer.from(i,n);return i.base64Slice(0,i.length)},other:(i,n)=>{if(i.length===0)return"";if(typeof i==="string")i=Buffer.from(i,n);if(Gw.has(Fo.toString()))try{return Gw.get(Fo).decode(i)}catch{}return typeof i==="string"?i:i.toString()}};function gU(i,n,r){if(i)return oU(r)(i,n);return i}qw.exports=gU});var yo=P((EQ,Qw)=>{var Hu=Eu(),Xw=/%[a-fA-F0-9][a-fA-F0-9]/g,hU={"%00":"\\x00","%01":"\\x01","%02":"\\x02","%03":"\\x03","%04":"\\x04","%05":"\\x05","%06":"\\x06","%07":"\\x07","%08":"\\b","%09":"\\t","%0a":`\n`,"%0A":`\n`,"%0b":"\\v","%0B":"\\v","%0c":"\\f","%0C":"\\f","%0d":"\\r","%0D":"\\r","%0e":"\\x0E","%0E":"\\x0E","%0f":"\\x0F","%0F":"\\x0F","%10":"\\x10","%11":"\\x11","%12":"\\x12","%13":"\\x13","%14":"\\x14","%15":"\\x15","%16":"\\x16","%17":"\\x17","%18":"\\x18","%19":"\\x19","%1a":"\\x1A","%1A":"\\x1A","%1b":"\\x1B","%1B":"\\x1B","%1c":"\\x1C","%1C":"\\x1C","%1d":"\\x1D","%1D":"\\x1D","%1e":"\\x1E","%1E":"\\x1E","%1f":"\\x1F","%1F":"\\x1F","%20":" ","%21":"!","%22":\'"\',"%23":"#","%24":"$","%25":"%","%26":"&","%27":"\'","%28":"(","%29":")","%2a":"*","%2A":"*","%2b":"+","%2B":"+","%2c":",","%2C":",","%2d":"-","%2D":"-","%2e":".","%2E":".","%2f":"/","%2F":"/","%30":"0","%31":"1","%32":"2","%33":"3","%34":"4","%35":"5","%36":"6","%37":"7","%38":"8","%39":"9","%3a":":","%3A":":","%3b":";","%3B":";","%3c":"<","%3C":"<","%3d":"=","%3D":"=","%3e":">","%3E":">","%3f":"?","%3F":"?","%40":"@","%41":"A","%42":"B","%43":"C","%44":"D","%45":"E","%46":"F","%47":"G","%48":"H","%49":"I","%4a":"J","%4A":"J","%4b":"K","%4B":"K","%4c":"L","%4C":"L","%4d":"M","%4D":"M","%4e":"N","%4E":"N","%4f":"O","%4F":"O","%50":"P","%51":"Q","%52":"R","%53":"S","%54":"T","%55":"U","%56":"V","%57":"W","%58":"X","%59":"Y","%5a":"Z","%5A":"Z","%5b":"[","%5B":"[","%5c":"\\\\","%5C":"\\\\","%5d":"]","%5D":"]","%5e":"^","%5E":"^","%5f":"_","%5F":"_","%60":"`","%61":"a","%62":"b","%63":"c","%64":"d","%65":"e","%66":"f","%67":"g","%68":"h","%69":"i","%6a":"j","%6A":"j","%6b":"k","%6B":"k","%6c":"l","%6C":"l","%6d":"m","%6D":"m","%6e":"n","%6E":"n","%6f":"o","%6F":"o","%70":"p","%71":"q","%72":"r","%73":"s","%74":"t","%75":"u","%76":"v","%77":"w","%78":"x","%79":"y","%7a":"z","%7A":"z","%7b":"{","%7B":"{","%7c":"|","%7C":"|","%7d":"}","%7D":"}","%7e":"~","%7E":"~","%7f":"","%7F":"","%80":"€","%81":"","%82":"‚","%83":"ƒ","%84":"„","%85":"…","%86":"†","%87":"‡","%88":"ˆ","%89":"‰","%8a":"Š","%8A":"Š","%8b":"‹","%8B":"‹","%8c":"Œ","%8C":"Œ","%8d":"","%8D":"","%8e":"Ž","%8E":"Ž","%8f":"","%8F":"","%90":"","%91":"‘","%92":"’","%93":"“","%94":"”","%95":"•","%96":"–","%97":"—","%98":"˜","%99":"™","%9a":"š","%9A":"š","%9b":"›","%9B":"›","%9c":"œ","%9C":"œ","%9d":"","%9D":"","%9e":"ž","%9E":"ž","%9f":"Ÿ","%9F":"Ÿ","%a0":" ","%A0":" ","%a1":"¡","%A1":"¡","%a2":"¢","%A2":"¢","%a3":"£","%A3":"£","%a4":"¤","%A4":"¤","%a5":"¥","%A5":"¥","%a6":"¦","%A6":"¦","%a7":"§","%A7":"§","%a8":"¨","%A8":"¨","%a9":"©","%A9":"©","%aa":"ª","%Aa":"ª","%aA":"ª","%AA":"ª","%ab":"«","%Ab":"«","%aB":"«","%AB":"«","%ac":"¬","%Ac":"¬","%aC":"¬","%AC":"¬","%ad":"­","%Ad":"­","%aD":"­","%AD":"­","%ae":"®","%Ae":"®","%aE":"®","%AE":"®","%af":"¯","%Af":"¯","%aF":"¯","%AF":"¯","%b0":"°","%B0":"°","%b1":"±","%B1":"±","%b2":"²","%B2":"²","%b3":"³","%B3":"³","%b4":"´","%B4":"´","%b5":"µ","%B5":"µ","%b6":"¶","%B6":"¶","%b7":"·","%B7":"·","%b8":"¸","%B8":"¸","%b9":"¹","%B9":"¹","%ba":"º","%Ba":"º","%bA":"º","%BA":"º","%bb":"»","%Bb":"»","%bB":"»","%BB":"»","%bc":"¼","%Bc":"¼","%bC":"¼","%BC":"¼","%bd":"½","%Bd":"½","%bD":"½","%BD":"½","%be":"¾","%Be":"¾","%bE":"¾","%BE":"¾","%bf":"¿","%Bf":"¿","%bF":"¿","%BF":"¿","%c0":"À","%C0":"À","%c1":"Á","%C1":"Á","%c2":"Â","%C2":"Â","%c3":"Ã","%C3":"Ã","%c4":"Ä","%C4":"Ä","%c5":"Å","%C5":"Å","%c6":"Æ","%C6":"Æ","%c7":"Ç","%C7":"Ç","%c8":"È","%C8":"È","%c9":"É","%C9":"É","%ca":"Ê","%Ca":"Ê","%cA":"Ê","%CA":"Ê","%cb":"Ë","%Cb":"Ë","%cB":"Ë","%CB":"Ë","%cc":"Ì","%Cc":"Ì","%cC":"Ì","%CC":"Ì","%cd":"Í","%Cd":"Í","%cD":"Í","%CD":"Í","%ce":"Î","%Ce":"Î","%cE":"Î","%CE":"Î","%cf":"Ï","%Cf":"Ï","%cF":"Ï","%CF":"Ï","%d0":"Ð","%D0":"Ð","%d1":"Ñ","%D1":"Ñ","%d2":"Ò","%D2":"Ò","%d3":"Ó","%D3":"Ó","%d4":"Ô","%D4":"Ô","%d5":"Õ","%D5":"Õ","%d6":"Ö","%D6":"Ö","%d7":"×","%D7":"×","%d8":"Ø","%D8":"Ø","%d9":"Ù","%D9":"Ù","%da":"Ú","%Da":"Ú","%dA":"Ú","%DA":"Ú","%db":"Û","%Db":"Û","%dB":"Û","%DB":"Û","%dc":"Ü","%Dc":"Ü","%dC":"Ü","%DC":"Ü","%dd":"Ý","%Dd":"Ý","%dD":"Ý","%DD":"Ý","%de":"Þ","%De":"Þ","%dE":"Þ","%DE":"Þ","%df":"ß","%Df":"ß","%dF":"ß","%DF":"ß","%e0":"à","%E0":"à","%e1":"á","%E1":"á","%e2":"â","%E2":"â","%e3":"ã","%E3":"ã","%e4":"ä","%E4":"ä","%e5":"å","%E5":"å","%e6":"æ","%E6":"æ","%e7":"ç","%E7":"ç","%e8":"è","%E8":"è","%e9":"é","%E9":"é","%ea":"ê","%Ea":"ê","%eA":"ê","%EA":"ê","%eb":"ë","%Eb":"ë","%eB":"ë","%EB":"ë","%ec":"ì","%Ec":"ì","%eC":"ì","%EC":"ì","%ed":"í","%Ed":"í","%eD":"í","%ED":"í","%ee":"î","%Ee":"î","%eE":"î","%EE":"î","%ef":"ï","%Ef":"ï","%eF":"ï","%EF":"ï","%f0":"ð","%F0":"ð","%f1":"ñ","%F1":"ñ","%f2":"ò","%F2":"ò","%f3":"ó","%F3":"ó","%f4":"ô","%F4":"ô","%f5":"õ","%F5":"õ","%f6":"ö","%F6":"ö","%f7":"÷","%F7":"÷","%f8":"ø","%F8":"ø","%f9":"ù","%F9":"ù","%fa":"ú","%Fa":"ú","%fA":"ú","%FA":"ú","%fb":"û","%Fb":"û","%fB":"û","%FB":"û","%fc":"ü","%Fc":"ü","%fC":"ü","%FC":"ü","%fd":"ý","%Fd":"ý","%fD":"ý","%FD":"ý","%fe":"þ","%Fe":"þ","%fE":"þ","%FE":"þ","%ff":"ÿ","%Ff":"ÿ","%fF":"ÿ","%FF":"ÿ"};function Lw(i){return hU[i]}var Gu=0,Iw=1,Po=2,Yw=3;function _U(i){let n=[],r=Gu,u="",t=!1,c=!1,g=0,h="",_=i.length;for(var l=0;l<_;++l){let $=i[l];if($==="\\\\"&&t)if(c)c=!1;else{c=!0;continue}else if($===\'"\')if(!c){if(t){t=!1,r=Gu;while(l+1<_&&i[l+1]!==";")++l}else t=!0;continue}else c=!1;else{if(c&&t)h+="\\\\";if(c=!1,(r===Po||r===Yw)&&$==="\'"){if(r===Po)r=Yw,u=h.substring(1);else r=Iw;h="";continue}else if(r===Gu&&($==="*"||$==="=")&&n.length){r=$==="*"?Po:Iw,n[g]=[h,void 0],h="";continue}else if(!t&&$===";"){if(r=Gu,u){if(h.length)h=Hu(h.replace(Xw,Lw),"binary",u);u=""}else if(h.length)h=Hu(h,"binary","utf8");if(n[g]===void 0)n[g]=h;else n[g][1]=h;h="",++g;continue}else if(!t&&($===" "||$==="\\t"))continue}h+=$}if(u&&h.length)h=Hu(h.replace(Xw,Lw),"binary",u);else if(h)h=Hu(h,"binary","utf8");if(n[g]===void 0){if(h)n[g]=h}else n[g][1]=h;return n}Qw.exports=_U});var Sw=P((HQ,mw)=>{mw.exports=function i(n){if(typeof n!=="string")return"";for(var r=n.length-1;r>=0;--r)switch(n.charCodeAt(r)){case 47:case 92:return n=n.slice(r+1),n===".."||n==="."?"":n}return n===".."||n==="."?"":n}});var Vw=P((GQ,Kw)=>{var{Readable:Bw}=T("node:stream"),{inherits:lU}=T("node:util"),$U=xo(),Aw=yo(),wU=Eu(),bU=Sw(),Rn=Ju(),vU=/^boundary$/i,fU=/^form-data$/i,OU=/^charset$/i,jU=/^filename$/i,UU=/^name$/i;qu.detect=/^multipart\\/form-data/i;function qu(i,n){let r,u,t=this,c,g=n.limits,h=n.isPartAFile||((Q,M,p)=>M==="application/octet-stream"||p!==void 0),_=n.parsedConType||[],l=n.defCharset||"utf8",$=n.preservePath,w={highWaterMark:n.fileHwm};for(r=0,u=_.length;rJ)return t.parser.removeListener("part",Q),t.parser.on("part",Ot),i.hitPartsLimit=!0,i.emit("partsLimit"),Ot(M);if(H){let p=H;p.emit("end"),p.removeAllListeners("end")}M.on("header",function(p){let li,Mi,s,Ti,Di,Ni,di=0;if(p["content-type"]){if(s=Aw(p["content-type"][0]),s[0]){li=s[0].toLowerCase();for(r=0,u=s.length;rf){let _n=f-di+ai.length;if(_n>0)Oi.push(ai.slice(0,_n));Oi.truncated=!0,Oi.bytesRead=f,M.removeAllListeners("data"),Oi.emit("limit");return}else if(!Oi.push(ai))t._pause=!0;Oi.bytesRead=di},No=function(){X=void 0,Oi.push(null)}}else{if(W===z){if(!i.hitFieldsLimit)i.hitFieldsLimit=!0,i.emit("fieldsLimit");return Ot(M)}++W,++E;let Oi="",ai=!1;H=M,Uo=function(_n){if((di+=_n.length)>v){let _j=v-(di-_n.length);Oi+=_n.toString("binary",0,_j),ai=!0,M.removeAllListeners("data")}else Oi+=_n.toString("binary")},No=function(){if(H=void 0,Oi.length)Oi=wU(Oi,"binary",Ti);i.emit("field",Mi,Oi,!1,ai,Di,li),--E,b()}}M._readableState.sync=!1,M.on("data",Uo),M.on("end",No)}).on("error",function(p){if(X)X.emit("error",p)})}).on("error",function(Q){i.emit("error",Q)}).on("finish",function(){Y=!0,b()})}qu.prototype.write=function(i,n){let r=this.parser.write(i);if(r&&!this._pause)n();else this._needDrain=!r,this._cb=n};qu.prototype.end=function(){let i=this;if(i.parser.writable)i.parser.end();else if(!i._boy._done)process.nextTick(function(){i._boy._done=!0,i._boy.emit("finish")})};function Ot(i){i.resume()}function To(i){Bw.call(this,i),this.bytesRead=0,this.truncated=!1}lU(To,Bw);To.prototype._read=function(i){};Kw.exports=qu});var xw=P((qQ,Mw)=>{var NU=/\\+/g,zU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function ko(){this.buffer=void 0}ko.prototype.write=function(i){i=i.replace(NU," ");let n="",r=0,u=0,t=i.length;for(;ru)n+=i.substring(u,r),u=r;this.buffer="",++u}if(u{var WU=xw(),jt=Eu(),Co=Ju(),DU=/^charset$/i;Xu.detect=/^application\\/x-www-form-urlencoded/i;function Xu(i,n){let{limits:r,parsedConType:u}=n;this.boy=i,this.fieldSizeLimit=Co(r,"fieldSize",1048576),this.fieldNameSizeLimit=Co(r,"fieldNameSize",100),this.fieldsLimit=Co(r,"fields",1/0);let t;for(var c=0,g=u.length;cc)this._key+=this.decoder.write(i.toString("binary",c,r));this._state="val",this._hitLimit=!1,this._checkingBytes=!0,this._val="",this._bytesVal=0,this._valTrunc=!1,this.decoder.reset(),c=r+1}else if(u!==void 0){++this._fields;let h,_=this._keyTrunc;if(u>c)h=this._key+=this.decoder.write(i.toString("binary",c,u));else h=this._key;if(this._hitLimit=!1,this._checkingBytes=!0,this._key="",this._bytesKey=0,this._keyTrunc=!1,this.decoder.reset(),h.length)this.boy.emit("field",jt(h,"binary",this.charset),"",_,!1);if(c=u+1,this._fields===this.fieldsLimit)return n()}else if(this._hitLimit){if(t>c)this._key+=this.decoder.write(i.toString("binary",c,t));if(c=t,(this._bytesKey=this._key.length)===this.fieldNameSizeLimit)this._checkingBytes=!1,this._keyTrunc=!0}else{if(cc)this._val+=this.decoder.write(i.toString("binary",c,u));if(this.boy.emit("field",jt(this._key,"binary",this.charset),jt(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc),this._state="key",this._hitLimit=!1,this._checkingBytes=!0,this._key="",this._bytesKey=0,this._keyTrunc=!1,this.decoder.reset(),c=u+1,this._fields===this.fieldsLimit)return n()}else if(this._hitLimit){if(t>c)this._val+=this.decoder.write(i.toString("binary",c,t));if(c=t,this._val===""&&this.fieldSizeLimit===0||(this._bytesVal=this._val.length)===this.fieldSizeLimit)this._checkingBytes=!1,this._valTrunc=!0}else{if(c0)this.boy.emit("field",jt(this._key,"binary",this.charset),"",this._keyTrunc,!1);else if(this._state==="val")this.boy.emit("field",jt(this._key,"binary",this.charset),jt(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc);this.boy._done=!0,this.boy.emit("finish")};Fw.exports=Xu});var kw=P((LQ,Ft)=>{var Ro=T("node:stream").Writable,{inherits:JU}=T("node:util"),EU=xo(),yw=Vw(),Tw=Pw(),HU=yo();function $n(i){if(!(this instanceof $n))return new $n(i);if(typeof i!=="object")throw new TypeError("Busboy expected an options-Object.");if(typeof i.headers!=="object")throw new TypeError("Busboy expected an options-Object with headers-attribute.");if(typeof i.headers["content-type"]!=="string")throw new TypeError("Missing Content-Type-header.");let{headers:n,...r}=i;this.opts={autoDestroy:!1,...r},Ro.call(this,this.opts),this._done=!1,this._parser=this.getParserByHeaders(n),this._finished=!1}JU($n,Ro);$n.prototype.emit=function(i){if(i==="finish"){if(!this._done){this._parser?.end();return}else if(this._finished)return;this._finished=!0}Ro.prototype.emit.apply(this,arguments)};$n.prototype.getParserByHeaders=function(i){let n=HU(i["content-type"]),r={defCharset:this.opts.defCharset,fileHwm:this.opts.fileHwm,headers:i,highWaterMark:this.opts.highWaterMark,isPartAFile:this.opts.isPartAFile,limits:this.opts.limits,parsedConType:n,preservePath:this.opts.preservePath};if(yw.detect.test(n[0]))return new yw(this,r);if(Tw.detect.test(n[0]))return new Tw(this,r);throw new Error("Unsupported Content-Type.")};$n.prototype._write=function(i,n,r){this._parser.write(i,r)};Ft.exports=$n;Ft.exports.default=$n;Ft.exports.Busboy=$n;Ft.exports.Dicer=EU});var Ci=P((Zo)=>{Object.defineProperty(Zo,"__esModule",{value:!0});Zo.fakePromise=void 0;Zo.getHeadersObj=qU;Zo.defaultHeadersSerializer=XU;Zo.isArrayBufferView=IU;Zo.isNodeReadable=YU;Zo.isIterable=QU;Zo.shouldRedirect=mU;Zo.pipeThrough=SU;Zo.endStream=AU;Zo.safeWrite=BU;var GU=T("node:events");function Cw(i){return i?.forEach!=null}function qU(i){if(i==null||!Cw(i))return i;if(i.headersInit&&!i._map&&!Cw(i.headersInit))return i.headersInit;return Object.fromEntries(i.entries())}function XU(i,n){let r=[];return i.forEach((u,t)=>{if(n&&t==="content-length")n(u);r.push(`${t}: ${u}`)}),r}var LU=Qn();Object.defineProperty(Zo,"fakePromise",{enumerable:!0,get:function(){return LU.fakePromise}});function IU(i){return i!=null&&i.buffer!=null&&i.byteLength!=null&&i.byteOffset!=null}function YU(i){return i!=null&&i.pipe!=null}function QU(i){return i?.[Symbol.iterator]!=null}function mU(i){return i===301||i===302||i===303||i===307||i===308}function SU({src:i,dest:n,signal:r,onError:u}){if(u)n.once("error",u);if(i.once("error",(t)=>{n.destroy(t)}),n.once("close",()=>{if(!i.destroyed)i.destroy()}),r){let g=function(){c.deref()?.removeEventListener("abort",h),t.deref()?.removeListener("end",g),t.deref()?.removeListener("error",g),t.deref()?.removeListener("close",g)},h=function(){t.deref()?.destroy(new Rw),g()},t=new WeakRef(i),c=new WeakRef(r);r.addEventListener("abort",h,{once:!0}),i.once("end",g),i.once("error",g),i.once("close",g)}i.pipe(n,{end:!0})}function AU(i){return i.end(null,null,null)}function BU(i,n){if(!n.write(i))return GU.once(n,"drain")}class Rw extends Error{constructor(i="The operation was aborted",n=void 0){super(i,n);this.name="AbortError"}}});var Ut=P((dw)=>{Object.defineProperty(dw,"__esModule",{value:!0});dw.PonyfillReadableStream=void 0;var Zw=T("node:buffer"),eo=T("node:events"),po=T("node:stream"),RU=T("node:stream/promises"),ao=Qn(),so=Ci();function ew(i,n){let r=[],u=!1,t=!1;return{desiredSize:i,enqueue(c){let g=typeof c==="string"?Zw.Buffer.from(c):c;if(!t)r.push(g);else n.push(g)},close(){if(r.length>0)this._flush();n.push(null),u=!0},error(c){if(r.length>0)this._flush();n.destroy(c)},get _closed(){return u},_flush(){if(t=!0,r.length>0){let c=r.length>1?Zw.Buffer.concat(r):r[0];n.push(c),r=[]}}}}function ZU(i){return i?.read!=null}function pw(i){return i?.getReader!=null}class Lu{readable;constructor(i){if(i instanceof Lu&&i.readable!=null)this.readable=i.readable;else if(ZU(i))this.readable=i;else if(pw(i))this.readable=po.Readable.fromWeb(i);else{let n=!1,r=!1,u=(c)=>{if(!n){let g=ew(c,this.readable);return n=!0,ao.handleMaybePromise(()=>i?.start?.(g),()=>{if(g._flush(),g._closed)return!1;return!0})}return!0},t=(c)=>{return ao.handleMaybePromise(()=>u(c),(g)=>{if(!g)return;let h=ew(c,this.readable);return ao.handleMaybePromise(()=>i?.pull?.(h),()=>{h._flush(),r=!1})})};this.readable=new po.Readable({read(c){if(r)return;return r=!0,t(c)},destroy(c,g){if(i?.cancel)try{let h=i.cancel(c);if(h?.then)return h.then(()=>{g(null)},(_)=>{g(_)})}catch(h){g(h);return}g(null)}})}}cancel(i){return this.readable.destroy(i),eo.once(this.readable,"close")}locked=!1;getReader(i){let n=this.readable[Symbol.asyncIterator]();this.locked=!0;let r=this.readable;return{read(){return n.next()},releaseLock:()=>{if(n.return){let u=n.return();if(u.then){u.then(()=>{this.locked=!1});return}}this.locked=!1},cancel:(u)=>{if(n.return){let t=n.return(u);if(t.then)return t.then(()=>{this.locked=!1})}return this.locked=!1,so.fakePromise()},get closed(){return Promise.race([eo.once(r,"end"),eo.once(r,"error").then((u)=>Promise.reject(u))])}}}[Symbol.asyncIterator](){let i=this.readable[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return this},next:()=>i.next(),return:()=>{if(!this.readable.destroyed)this.readable.destroy();return i.return?.()||so.fakePromise({done:!0,value:void 0})},throw:(n)=>{if(!this.readable.destroyed)this.readable.destroy(n);return i.throw?.(n)||so.fakePromise({done:!0,value:void 0})}}}tee(){throw new Error("Not implemented")}async pipeToWriter(i){try{for await(let n of this)await i.write(n);await i.close()}catch(n){await i.abort(n)}}pipeTo(i){if(pU(i))return RU.pipeline(this.readable,i.writable,{end:!0});else{let n=i.getWriter();return this.pipeToWriter(n)}}pipeThrough({writable:i,readable:n}){if(this.pipeTo(i).catch((r)=>{this.readable.destroy(r)}),eU(n))n.readable.once("error",(r)=>this.readable.destroy(r)),n.readable.once("finish",()=>this.readable.push(null)),n.readable.once("close",()=>this.readable.push(null));return n}static[Symbol.hasInstance](i){return pw(i)}static from(i){return new Lu(po.Readable.from(i))}[Symbol.toStringTag]="ReadableStream"}dw.PonyfillReadableStream=Lu;function eU(i){return i?.readable!=null}function pU(i){return i?.writable!=null}});var Iu=P((cb)=>{Object.defineProperty(cb,"__esModule",{value:!0});cb.PonyfillBlob=void 0;cb.hasBufferMethod=yt;cb.hasArrayBufferMethod=Tt;cb.hasBytesMethod=kt;cb.hasTextMethod=sw;cb.hasSizeProperty=ib;cb.hasStreamMethod=nb;cb.hasBlobSignature=tb;cb.isArrayBuffer=rb;var qi=T("node:buffer"),ig=Ut(),Gi=Ci();function Pt(i){if(typeof i==="string")return qi.Buffer.from(i);else if(qi.Buffer.isBuffer(i))return i;else if(Gi.isArrayBufferView(i))return qi.Buffer.from(i.buffer,i.byteOffset,i.byteLength);else return qi.Buffer.from(i)}function yt(i){return i!=null&&i.buffer!=null&&typeof i.buffer==="function"}function Tt(i){return i!=null&&i.arrayBuffer!=null&&typeof i.arrayBuffer==="function"}function kt(i){return i!=null&&i.bytes!=null&&typeof i.bytes==="function"}function sw(i){return i!=null&&i.text!=null&&typeof i.text==="function"}function ib(i){return i!=null&&typeof i.size==="number"}function nb(i){return i!=null&&i.stream!=null&&typeof i.stream==="function"}function tb(i){return i!=null&&i[Symbol.toStringTag]==="Blob"}function rb(i){return i!=null&&i.byteLength!=null&&i.slice!=null}class ub{blobParts;type;encoding;_size=null;constructor(i=[],n){if(this.blobParts=i,this.type=n?.type||"application/octet-stream",this.encoding=n?.encoding||"utf8",this._size=n?.size||null,i.length===1&&tb(i[0]))return i[0]}_buffer=null;buffer(){if(this._buffer)return Gi.fakePromise(this._buffer);if(this.blobParts.length===1){let r=this.blobParts[0];if(yt(r))return r.buffer().then((u)=>{return this._buffer=u,this._buffer});if(kt(r))return r.bytes().then((u)=>{return this._buffer=qi.Buffer.from(u),this._buffer});if(Tt(r))return r.arrayBuffer().then((u)=>{return this._buffer=qi.Buffer.from(u,void 0,r.size),this._buffer});return this._buffer=Pt(r),Gi.fakePromise(this._buffer)}let i=[],n=this.blobParts.map((r,u)=>{if(yt(r)){i.push(r.buffer().then((t)=>{n[u]=t}));return}else if(Tt(r)){i.push(r.arrayBuffer().then((t)=>{n[u]=qi.Buffer.from(t,void 0,r.size)}));return}else if(kt(r)){i.push(r.bytes().then((t)=>{n[u]=qi.Buffer.from(t)}));return}else return Pt(r)});if(i.length>0)return Promise.all(i).then(()=>qi.Buffer.concat(n,this._size||void 0));return Gi.fakePromise(qi.Buffer.concat(n,this._size||void 0))}arrayBuffer(){if(this._buffer)return Gi.fakePromise(this._buffer);if(this.blobParts.length===1){if(rb(this.blobParts[0]))return Gi.fakePromise(this.blobParts[0]);if(Tt(this.blobParts[0]))return this.blobParts[0].arrayBuffer()}return this.buffer()}bytes(){if(this._buffer)return Gi.fakePromise(this._buffer);if(this.blobParts.length===1){if(qi.Buffer.isBuffer(this.blobParts[0]))return this._buffer=this.blobParts[0],Gi.fakePromise(this._buffer);if(this.blobParts[0]instanceof Uint8Array)return this._buffer=qi.Buffer.from(this.blobParts[0]),Gi.fakePromise(this._buffer);if(kt(this.blobParts[0]))return this.blobParts[0].bytes();if(yt(this.blobParts[0]))return this.blobParts[0].buffer()}return this.buffer()}_text=null;text(){if(this._text)return Gi.fakePromise(this._text);if(this.blobParts.length===1){let i=this.blobParts[0];if(typeof i==="string")return this._text=i,Gi.fakePromise(this._text);if(sw(i))return i.text().then((r)=>{return this._text=r,this._text});let n=Pt(i);return this._text=n.toString(this.encoding),Gi.fakePromise(this._text)}return this.buffer().then((i)=>{return this._text=i.toString(this.encoding),this._text})}_json=null;json(){if(this._json)return Gi.fakePromise(this._json);return this.text().then((i)=>{return this._json=JSON.parse(i),this._json})}_formData=null;formData(){if(this._formData)return Gi.fakePromise(this._formData);throw new Error("Not implemented")}get size(){if(this._size==null){this._size=0;for(let i of this.blobParts)if(typeof i==="string")this._size+=qi.Buffer.byteLength(i);else if(ib(i))this._size+=i.size;else if(Gi.isArrayBufferView(i))this._size+=i.byteLength}return this._size}stream(){if(this.blobParts.length===1){let n=this.blobParts[0];if(nb(n))return n.stream();let r=Pt(n);return new ig.PonyfillReadableStream({start:(u)=>{u.enqueue(r),u.close()}})}if(this._buffer!=null)return new ig.PonyfillReadableStream({start:(n)=>{n.enqueue(this._buffer),n.close()}});let i;return new ig.PonyfillReadableStream({start:(n)=>{if(this.blobParts.length===0){n.close();return}i=this.blobParts[Symbol.iterator]()},pull:(n)=>{let{value:r,done:u}=i.next();if(u){n.close();return}if(r){if(yt(r))return r.buffer().then((c)=>{n.enqueue(c)});if(kt(r))return r.bytes().then((c)=>{let g=qi.Buffer.from(c);n.enqueue(g)});if(Tt(r))return r.arrayBuffer().then((c)=>{let g=qi.Buffer.from(c,void 0,r.size);n.enqueue(g)});let t=Pt(r);n.enqueue(t)}}})}slice(){throw new Error("Not implemented")}}cb.PonyfillBlob=ub});var ng=P((hb)=>{Object.defineProperty(hb,"__esModule",{value:!0});hb.PonyfillFile=void 0;var cN=Iu();class gb extends cN.PonyfillBlob{name;lastModified;constructor(i,n,r){super(i,r);this.name=n,this.lastModified=r?.lastModified||Date.now()}webkitRelativePath=""}hb.PonyfillFile=gb});var rg=P((SQ,mu)=>{var lb,$b,wb,bb,vb,fb,Ob,jb,Ub,Nb,zb,Wb,Db,Yu,tg,Jb,Eb,Hb,Nt,Gb,qb,Xb,Lb,Ib,Yb,Qb,mb,Sb,Qu,Ab,Bb,Kb;(function(i){var n=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function(u){i(r(n,r(u)))});else if(typeof mu==="object"&&typeof SQ==="object")i(r(n,r(SQ)));else i(r(n));function r(u,t){if(u!==n)if(typeof Object.create==="function")Object.defineProperty(u,"__esModule",{value:!0});else u.__esModule=!0;return function(c,g){return u[c]=t?t(c,g):g}}})(function(i){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,g){c.__proto__=g}||function(c,g){for(var h in g)if(Object.prototype.hasOwnProperty.call(g,h))c[h]=g[h]};lb=function(c,g){if(typeof g!=="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");n(c,g);function h(){this.constructor=c}c.prototype=g===null?Object.create(g):(h.prototype=g.prototype,new h)},$b=Object.assign||function(c){for(var g,h=1,_=arguments.length;h<_;h++){g=arguments[h];for(var l in g)if(Object.prototype.hasOwnProperty.call(g,l))c[l]=g[l]}return c},wb=function(c,g){var h={};for(var _ in c)if(Object.prototype.hasOwnProperty.call(c,_)&&g.indexOf(_)<0)h[_]=c[_];if(c!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var l=0,_=Object.getOwnPropertySymbols(c);l<_.length;l++)if(g.indexOf(_[l])<0&&Object.prototype.propertyIsEnumerable.call(c,_[l]))h[_[l]]=c[_[l]]}return h},bb=function(c,g,h,_){var l=arguments.length,$=l<3?g:_===null?_=Object.getOwnPropertyDescriptor(g,h):_,w;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")$=Reflect.decorate(c,g,h,_);else for(var b=c.length-1;b>=0;b--)if(w=c[b])$=(l<3?w($):l>3?w(g,h,$):w(g,h))||$;return l>3&&$&&Object.defineProperty(g,h,$),$},vb=function(c,g){return function(h,_){g(h,_,c)}},fb=function(c,g,h,_,l,$){function w(E){if(E!==void 0&&typeof E!=="function")throw new TypeError("Function expected");return E}var b=_.kind,v=b==="getter"?"get":b==="setter"?"set":"value",f=!g&&c?_.static?c:c.prototype:null,U=g||(f?Object.getOwnPropertyDescriptor(f,_.name):{}),z,J=!1;for(var N=h.length-1;N>=0;N--){var j={};for(var O in _)j[O]=O==="access"?{}:_[O];for(var O in _.access)j.access[O]=_.access[O];j.addInitializer=function(E){if(J)throw new TypeError("Cannot add initializers after decoration has completed");$.push(w(E||null))};var W=h[N](b==="accessor"?{get:U.get,set:U.set}:U[v],j);if(b==="accessor"){if(W===void 0)continue;if(W===null||typeof W!=="object")throw new TypeError("Object expected");if(z=w(W.get))U.get=z;if(z=w(W.set))U.set=z;if(z=w(W.init))l.unshift(z)}else if(z=w(W))if(b==="field")l.unshift(z);else U[v]=z}if(f)Object.defineProperty(f,_.name,U);J=!0},Ob=function(c,g,h){var _=arguments.length>2;for(var l=0;l0&&$[$.length-1]))&&(f[0]===6||f[0]===2)){h=0;continue}if(f[0]===3&&(!$||f[1]>$[0]&&f[1]<$[3])){h.label=f[1];break}if(f[0]===6&&h.label<$[1]){h.label=$[1],$=f;break}if($&&h.label<$[2]){h.label=$[2],h.ops.push(f);break}if($[2])h.ops.pop();h.trys.pop();continue}f=g.call(c,h)}catch(U){f=[6,U],l=0}finally{_=$=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Db=function(c,g){for(var h in c)if(h!=="default"&&!Object.prototype.hasOwnProperty.call(g,h))Qu(g,c,h)},Qu=Object.create?function(c,g,h,_){if(_===void 0)_=h;var l=Object.getOwnPropertyDescriptor(g,h);if(!l||("get"in l?!g.__esModule:l.writable||l.configurable))l={enumerable:!0,get:function(){return g[h]}};Object.defineProperty(c,_,l)}:function(c,g,h,_){if(_===void 0)_=h;c[_]=g[h]},Yu=function(c){var g=typeof Symbol==="function"&&Symbol.iterator,h=g&&c[g],_=0;if(h)return h.call(c);if(c&&typeof c.length==="number")return{next:function(){if(c&&_>=c.length)c=void 0;return{value:c&&c[_++],done:!c}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")},tg=function(c,g){var h=typeof Symbol==="function"&&c[Symbol.iterator];if(!h)return c;var _=h.call(c),l,$=[],w;try{while((g===void 0||g-- >0)&&!(l=_.next()).done)$.push(l.value)}catch(b){w={error:b}}finally{try{if(l&&!l.done&&(h=_.return))h.call(_)}finally{if(w)throw w.error}}return $},Jb=function(){for(var c=[],g=0;g1||v(N,O)})},j)l[N]=j(l[N])}}function v(N,j){try{f(_[N](j))}catch(O){J($[0][3],O)}}function f(N){N.value instanceof Nt?Promise.resolve(N.value.v).then(U,z):J($[0][2],N)}function U(N){v("next",N)}function z(N){v("throw",N)}function J(N,j){if(N(j),$.shift(),$.length)v($[0][0],$[0][1])}},qb=function(c){var g,h;return g={},_("next"),_("throw",function(l){throw l}),_("return"),g[Symbol.iterator]=function(){return this},g;function _(l,$){g[l]=c[l]?function(w){return(h=!h)?{value:Nt(c[l](w)),done:!1}:$?$(w):w}:$}},Xb=function(c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=c[Symbol.asyncIterator],h;return g?g.call(c):(c=typeof Yu==="function"?Yu(c):c[Symbol.iterator](),h={},_("next"),_("throw"),_("return"),h[Symbol.asyncIterator]=function(){return this},h);function _($){h[$]=c[$]&&function(w){return new Promise(function(b,v){w=c[$](w),l(b,v,w.done,w.value)})}}function l($,w,b,v){Promise.resolve(v).then(function(f){$({value:f,done:b})},w)}},Lb=function(c,g){if(Object.defineProperty)Object.defineProperty(c,"raw",{value:g});else c.raw=g;return c};var r=Object.create?function(c,g){Object.defineProperty(c,"default",{enumerable:!0,value:g})}:function(c,g){c.default=g},u=function(c){return u=Object.getOwnPropertyNames||function(g){var h=[];for(var _ in g)if(Object.prototype.hasOwnProperty.call(g,_))h[h.length]=_;return h},u(c)};Ib=function(c){if(c&&c.__esModule)return c;var g={};if(c!=null){for(var h=u(c),_=0;_{Object.defineProperty(Mb,"__esModule",{value:!0});Mb.PonyfillSuppressedError=void 0;class Vb extends Error{error;suppressed;constructor(i,n,r){super(r);this.error=i,this.suppressed=n,this.name="SuppressedError",Error.captureStackTrace(this,this.constructor)}}Mb.PonyfillSuppressedError=Vb});var Ct=P((Fb)=>{Object.defineProperty(Fb,"__esModule",{value:!0});Fb.DisposableSymbols=void 0;Fb.patchSymbols=oN;Fb.DisposableSymbols={get dispose(){return Symbol.dispose||Symbol.for("dispose")},get asyncDispose(){return Symbol.asyncDispose||Symbol.for("asyncDispose")}};function oN(){Symbol.dispose||=Symbol.for("dispose"),Symbol.asyncDispose||=Symbol.for("asyncDispose")}});var ug=P((Tb)=>{Object.defineProperty(Tb,"__esModule",{value:!0});Tb.isSyncDisposable=hN;Tb.isAsyncDisposable=_N;var yb=Ct();function hN(i){return i?.[yb.DisposableSymbols.dispose]!=null}function _N(i){return i?.[yb.DisposableSymbols.asyncDispose]!=null}});var Zb=P((Cb)=>{Object.defineProperty(Cb,"__esModule",{value:!0});Cb.PonyfillAsyncDisposableStack=void 0;var wN=Qn(),bN=Su(),Au=Ct(),kb=ug(),vN=globalThis.SuppressedError||bN.PonyfillSuppressedError;class cg{callbacks=[];get disposed(){return this.callbacks.length===0}use(i){if(kb.isAsyncDisposable(i))this.callbacks.push(()=>i[Au.DisposableSymbols.asyncDispose]());else if(kb.isSyncDisposable(i))this.callbacks.push(()=>i[Au.DisposableSymbols.dispose]());return i}adopt(i,n){if(n)this.callbacks.push(()=>n(i));return i}defer(i){if(i)this.callbacks.push(i)}move(){let i=new cg;return i.callbacks=this.callbacks,this.callbacks=[],i}disposeAsync(){return this[Au.DisposableSymbols.asyncDispose]()}_error;_iterateCallbacks(){let i=this.callbacks.pop();if(i)return wN.handleMaybePromise(i,()=>this._iterateCallbacks(),(n)=>{return this._error=this._error?new vN(n,this._error):n,this._iterateCallbacks()})}[Au.DisposableSymbols.asyncDispose](){let i=this._iterateCallbacks();if(i?.then)return i.then(()=>{if(this._error){let n=this._error;throw this._error=void 0,n}});if(this._error){let n=this._error;throw this._error=void 0,n}return}[Symbol.toStringTag]="AsyncDisposableStack"}Cb.PonyfillAsyncDisposableStack=cg});var db=P((eb)=>{Object.defineProperty(eb,"__esModule",{value:!0});eb.PonyfillDisposableStack=void 0;var fN=Su(),og=Ct(),ON=ug(),jN=globalThis.SuppressedError||fN.PonyfillSuppressedError;class gg{callbacks=[];get disposed(){return this.callbacks.length===0}use(i){if(ON.isSyncDisposable(i))this.callbacks.push(()=>i[og.DisposableSymbols.dispose]());return i}adopt(i,n){if(n)this.callbacks.push(()=>n(i));return i}defer(i){if(i)this.callbacks.push(i)}move(){let i=new gg;return i.callbacks=this.callbacks,this.callbacks=[],i}dispose(){return this[og.DisposableSymbols.dispose]()}_error;_iterateCallbacks(){let i=this.callbacks.pop();if(i){try{i()}catch(n){this._error=this._error?new jN(n,this._error):n}return this._iterateCallbacks()}}[og.DisposableSymbols.dispose](){if(this._iterateCallbacks(),this._error){let i=this._error;throw this._error=void 0,i}}[Symbol.toStringTag]="DisposableStack"}eb.PonyfillDisposableStack=gg});var sb=P((hg)=>{Object.defineProperty(hg,"__esModule",{value:!0});hg.SuppressedError=hg.AsyncDisposableStack=hg.DisposableStack=void 0;var UN=rg(),NN=Zb(),zN=db(),WN=Su();hg.DisposableStack=globalThis.DisposableStack||zN.PonyfillDisposableStack;hg.AsyncDisposableStack=globalThis.AsyncDisposableStack||NN.PonyfillAsyncDisposableStack;hg.SuppressedError=globalThis.SuppressedError||WN.PonyfillSuppressedError;UN.__exportStar(Ct(),hg)});var Bu=P((t1)=>{Object.defineProperty(t1,"__esModule",{value:!0});t1.PonyfillIteratorObject=void 0;var i1=T("node:util"),EN=sb(),HN=Ci();class n1{iterableIterator;[Symbol.toStringTag]="IteratorObject";constructor(i,n){this.iterableIterator=i,this[Symbol.toStringTag]=n}*map(i){let n=0;for(let r of this.iterableIterator)yield i(r,n++);return}*filter(i){let n=0;for(let r of this.iterableIterator)if(i(r,n++))yield r;return}reduce(i,n){let r=0,u=n;for(let t of this.iterableIterator)u=i(u,t,r++);return u}forEach(i){let n=0;for(let r of this.iterableIterator)i(r,n++)}*take(i){let n=0;for(let r of this.iterableIterator){if(n>=i)break;yield r,n++}return}*drop(i){let n=0;for(let r of this.iterableIterator){if(n>=i)yield r;n++}return}*flatMap(i){let n=0;for(let r of this.iterableIterator){let u=i(r,n++);if(HN.isIterable(u))for(let t of u)yield t;else for(let t of{[Symbol.iterator]:()=>u})yield t}return}some(i){let n=0;for(let r of this.iterableIterator)if(i(r,n++))return!0;return!1}every(i){let n=0;for(let r of this.iterableIterator)if(!i(r,n++))return!1;return!0}find(i){let n=0;for(let r of this.iterableIterator)if(i(r,n++))return r;return}toArray(){return Array.from(this.iterableIterator)}[EN.DisposableSymbols.dispose](){this.iterableIterator.return?.()}next(...[i]){return this.iterableIterator.next(i)}[Symbol.iterator](){return this}[Symbol.for("nodejs.util.inspect.custom")](){let i={};return this.forEach((n,r)=>{let u=i1.inspect(n);i[r]=u.includes(",")?u.split(",").map((t)=>t.trim()):u}),`${this[Symbol.toStringTag]} ${i1.inspect(i)}`}}t1.PonyfillIteratorObject=n1});var lg=P((g1)=>{Object.defineProperty(g1,"__esModule",{value:!0});g1.PonyfillFormData=void 0;g1.getStreamFromFormData=qN;var Zn=T("node:buffer"),_g=Bu(),GN=Ut();class o1{map=new Map;append(i,n,r){let u=this.map.get(i);if(!u)u=[],this.map.set(i,u);let t=c1(n)?u1(i,n,r):n;u.push(t)}delete(i){this.map.delete(i)}get(i){let n=this.map.get(i);return n?n[0]:null}getAll(i){return this.map.get(i)||[]}has(i){return this.map.has(i)}set(i,n,r){let u=c1(n)?u1(i,n,r):n;this.map.set(i,[u])}[Symbol.iterator](){return this._entries()}*_entries(){for(let[i,n]of this.map)for(let r of n)yield[i,r]}entries(){return new _g.PonyfillIteratorObject(this._entries(),"FormDataIterator")}_keys(){return this.map.keys()}keys(){return new _g.PonyfillIteratorObject(this._keys(),"FormDataIterator")}*_values(){for(let i of this.map.values())for(let n of i)yield n}values(){return new _g.PonyfillIteratorObject(this._values(),"FormDataIterator")}forEach(i){for(let[n,r]of this)i(r,n,this)}}g1.PonyfillFormData=o1;function qN(i,n="---"){let r,u=!1,t,c=!1;function g(h){let{done:_,value:l}=r.next();if(_)return h.enqueue(Zn.Buffer.from(`\\r\n--${n}--\\r\n`)),h.close();if(c)h.enqueue(Zn.Buffer.from(`\\r\n--${n}\\r\n`));if(l){let[$,w]=l;if(typeof w==="string")h.enqueue(Zn.Buffer.from(`Content-Disposition: form-data; name="${$}"\\r\n\\r\n`)),h.enqueue(Zn.Buffer.from(w));else{let b="";if(w.name)b=`; filename="${w.name}"`;h.enqueue(Zn.Buffer.from(`Content-Disposition: form-data; name="${$}"${b}\\r\n`)),h.enqueue(Zn.Buffer.from(`Content-Type: ${w.type||"application/octet-stream"}\\r\n\\r\n`)),t=w.stream()[Symbol.asyncIterator]()}c=!0}}return new GN.PonyfillReadableStream({start:()=>{r=i.entries()},pull:(h)=>{if(!u)return u=!0,h.enqueue(Zn.Buffer.from(`--${n}\\r\n`));if(t)return t.next().then(({done:_,value:l})=>{if(_)t=void 0;if(l)return h.enqueue(l);else return g(h)});return g(h)},cancel:(h)=>{r?.return?.(h),t?.return?.(h)}})}function u1(i,n,r){return Object.defineProperty(n,"name",{configurable:!0,enumerable:!0,value:r||n.name||i}),n}function c1(i){return i?.arrayBuffer!=null}});var Vu=P(($1)=>{Object.defineProperty($1,"__esModule",{value:!0});$1.PonyfillBody=void 0;var tn=T("node:buffer"),bn=T("node:stream"),LN=kw(),Ku=Qn(),zt=Iu(),IN=ng(),_1=lg(),wn=Ut(),Wi=Ci(),wi;(function(i){i.ReadableStream="ReadableStream",i.Blob="Blob",i.FormData="FormData",i.String="String",i.Readable="Readable",i.Buffer="Buffer",i.AsyncIterable="AsyncIterable"})(wi||(wi={}));class l1{bodyInit;options;bodyUsed=!1;contentType=null;contentLength=null;constructor(i,n={}){this.bodyInit=i,this.options=n;let{bodyFactory:r,contentType:u,contentLength:t,bodyType:c,buffer:g}=YN(i);this._bodyFactory=r,this.contentType=u,this.contentLength=t,this.bodyType=c,this._buffer=g,this._signal=n.signal}bodyType;_bodyFactory=()=>null;_generatedBody=null;_buffer;_signal;generateBody(){if(this._generatedBody?.readable?.destroyed&&this._buffer)this._generatedBody.readable=bn.Readable.from(this._buffer);if(this._generatedBody)return this._generatedBody;let i=this._bodyFactory();return this._generatedBody=i,i}handleContentLengthHeader(i=!1){let n=this.headers.get("content-type");if(!n){if(this.contentType)this.headers.set("content-type",this.contentType)}else this.contentType=n;let r=this.headers.get("content-length");if(i&&this.bodyInit==null&&!r)this.contentLength=0,this.headers.set("content-length","0");if(!r){if(this.contentLength)this.headers.set("content-length",this.contentLength.toString())}else this.contentLength=parseInt(r,10)}get body(){let i=this.generateBody();if(i!=null){let n=i,r=i.readable;return new Proxy(i.readable,{get(u,t){if(t in n){let c=n[t];if(typeof c==="function")return c.bind(n);return c}if(t in r){let c=r[t];if(typeof c==="function")return c.bind(r);return c}}})}return null}_chunks=null;_doCollectChunksFromReadableJob(){if(this.bodyType===wi.AsyncIterable){if(Array.fromAsync)return Ku.handleMaybePromise(()=>Array.fromAsync(this.bodyInit),(c)=>{return this._chunks=c,this._chunks});let r=this.bodyInit[Symbol.asyncIterator](),u=[],t=()=>Ku.handleMaybePromise(()=>r.next(),({value:c,done:g})=>{if(c)u.push(c);if(!g)return t();return this._chunks=u,this._chunks});return t()}let i=this.generateBody();if(!i)return this._chunks=[],Wi.fakePromise(this._chunks);if(i.readable.destroyed)return Wi.fakePromise(this._chunks=[]);let n=[];return new Promise((r,u)=>{i.readable.on("data",(t)=>{n.push(t)}),i.readable.once("error",u),i.readable.once("end",()=>{r(this._chunks=n)})})}_collectChunksFromReadable(){if(this._chunks)return Wi.fakePromise(this._chunks);return this._chunks||=this._doCollectChunksFromReadableJob(),this._chunks}_blob=null;blob(){if(this._blob)return Wi.fakePromise(this._blob);if(this.bodyType===wi.String)this._text=this.bodyInit,this._blob=new zt.PonyfillBlob([this._text],{type:this.contentType||"text/plain;charset=UTF-8",size:this.contentLength});if(this.bodyType===wi.Blob)return this._blob=this.bodyInit,Wi.fakePromise(this._blob);if(this._buffer)return this._blob=new zt.PonyfillBlob([this._buffer],{type:this.contentType||"",size:this.contentLength}),Wi.fakePromise(this._blob);return Wi.fakePromise(Ku.handleMaybePromise(()=>this._collectChunksFromReadable(),(i)=>{return this._blob=new zt.PonyfillBlob(i,{type:this.contentType||"",size:this.contentLength}),this._blob}))}_formData=null;formData(i){if(this._formData)return Wi.fakePromise(this._formData);if(this.bodyType===wi.FormData)return this._formData=this.bodyInit,Wi.fakePromise(this._formData);if(this._formData=new _1.PonyfillFormData,this.generateBody()==null)return Wi.fakePromise(this._formData);let r={...this.options.formDataLimits,...i?.formDataLimits};return new Promise((u,t)=>{let c=this.body?.readable;if(!c)return t(new Error("No stream available"));let g=null,h=new LN.Busboy({headers:{"content-length":typeof this.contentLength==="number"?this.contentLength.toString():this.contentLength||"","content-type":this.contentType||""},limits:r,defCharset:"utf-8"});if(this._signal)bn.addAbortSignal(this._signal,h);let _=!1,l=($)=>{if(_)return;if(_=!0,c.unpipe(h),h.destroy(),g)g.destroy(),g=null;if($)t($);else u(this._formData)};c.on("error",l),h.on("field",($,w,b,v)=>{if(b)return l(new Error(`Field name size exceeded: ${r?.fieldNameSize} bytes`));if(v)return l(new Error(`Field value size exceeded: ${r?.fieldSize} bytes`));this._formData.set($,w)}),h.on("file",($,w,b,v,f)=>{g=w;let U=[];w.on("data",(z)=>{U.push(z)}),w.on("error",l),w.on("limit",()=>{l(new Error(`File size limit exceeded: ${r?.fileSize} bytes`))}),w.on("close",()=>{if(w.truncated)l(new Error(`File size limit exceeded: ${r?.fileSize} bytes`));g=null;let z=new IN.PonyfillFile(U,b,{type:f});this._formData.set($,z)})}),h.on("fieldsLimit",()=>{l(new Error(`Fields limit exceeded: ${r?.fields}`))}),h.on("filesLimit",()=>{l(new Error(`Files limit exceeded: ${r?.files}`))}),h.on("partsLimit",()=>{l(new Error(`Parts limit exceeded: ${r?.parts}`))}),h.on("end",l),h.on("finish",l),h.on("close",l),h.on("error",l),c.pipe(h)})}buffer(){if(this._buffer)return Wi.fakePromise(this._buffer);if(this._text)return this._buffer=tn.Buffer.from(this._text,"utf-8"),Wi.fakePromise(this._buffer);if(this.bodyType===wi.String)return this.text().then((i)=>{return this._text=i,this._buffer=tn.Buffer.from(i,"utf-8"),this._buffer});if(this.bodyType===wi.Blob){if(zt.hasBufferMethod(this.bodyInit))return this.bodyInit.buffer().then((i)=>{return this._buffer=i,this._buffer});if(zt.hasBytesMethod(this.bodyInit))return this.bodyInit.bytes().then((i)=>{return this._buffer=tn.Buffer.from(i),this._buffer});if(zt.hasArrayBufferMethod(this.bodyInit))return this.bodyInit.arrayBuffer().then((i)=>{return this._buffer=tn.Buffer.from(i,void 0,i.byteLength),this._buffer})}return Wi.fakePromise(Ku.handleMaybePromise(()=>this._collectChunksFromReadable(),(i)=>{if(i.length===1)return this._buffer=i[0],this._buffer;return this._buffer=tn.Buffer.concat(i),this._buffer}))}bytes(){return this.buffer()}arrayBuffer(){return this.buffer()}_json=null;json(){if(this._json)return Wi.fakePromise(this._json);return this.text().then((i)=>{try{this._json=JSON.parse(i)}catch(n){if(n instanceof SyntaxError)n.message+=`, "${i}" is not valid JSON`;throw n}return this._json})}_text=null;text(){if(this._text)return Wi.fakePromise(this._text);if(this.bodyType===wi.String)return this._text=this.bodyInit,Wi.fakePromise(this._text);return this.buffer().then((i)=>{return this._text=i.toString("utf-8"),this._text})}}$1.PonyfillBody=l1;function YN(i){if(i==null)return{bodyFactory:()=>null,contentType:null,contentLength:null};if(typeof i==="string"){let n=tn.Buffer.byteLength(i);return{bodyType:wi.String,contentType:"text/plain;charset=UTF-8",contentLength:n,bodyFactory(){let r=bn.Readable.from(tn.Buffer.from(i,"utf-8"));return new wn.PonyfillReadableStream(r)}}}if(tn.Buffer.isBuffer(i)){let n=i;return{bodyType:wi.Buffer,contentType:null,contentLength:i.length,buffer:i,bodyFactory(){let r=bn.Readable.from(n);return new wn.PonyfillReadableStream(r)}}}if(Wi.isArrayBufferView(i)){let n=tn.Buffer.from(i.buffer,i.byteOffset,i.byteLength);return{bodyType:wi.Buffer,contentLength:i.byteLength,contentType:null,buffer:n,bodyFactory(){let r=bn.Readable.from(n);return new wn.PonyfillReadableStream(r)}}}if(i instanceof wn.PonyfillReadableStream&&i.readable!=null){let n=i;return{bodyType:wi.ReadableStream,bodyFactory:()=>n,contentType:null,contentLength:null}}if(mN(i)){let n=i;return{bodyType:wi.Blob,contentType:i.type,contentLength:i.size,bodyFactory(){return n.stream()}}}if(i instanceof ArrayBuffer){let n=i.byteLength,r=tn.Buffer.from(i,void 0,i.byteLength);return{bodyType:wi.Buffer,contentType:null,contentLength:n,buffer:r,bodyFactory(){let u=bn.Readable.from(r);return new wn.PonyfillReadableStream(u)}}}if(i instanceof bn.Readable)return{bodyType:wi.Readable,contentType:null,contentLength:null,bodyFactory(){return new wn.PonyfillReadableStream(i)}};if(SN(i))return{bodyType:wi.String,contentType:"application/x-www-form-urlencoded;charset=UTF-8",contentLength:null,bodyFactory(){return new wn.PonyfillReadableStream(bn.Readable.from(i.toString()))}};if(QN(i)){let n=Math.random().toString(36).substr(2),r=`multipart/form-data; boundary=${n}`;return{bodyType:wi.FormData,contentType:r,contentLength:null,bodyFactory(){return _1.getStreamFromFormData(i,n)}}}if(AN(i))return{contentType:null,contentLength:null,bodyFactory(){return new wn.PonyfillReadableStream(i)}};if(i[Symbol.iterator]||i[Symbol.asyncIterator])return{contentType:null,contentLength:null,bodyType:wi.AsyncIterable,bodyFactory(){let n=bn.Readable.from(i);return new wn.PonyfillReadableStream(n)}};throw new Error("Unknown body type")}function QN(i){return i?.forEach!=null}function mN(i){return i?.stream!=null&&typeof i.stream==="function"}function SN(i){return i?.sort!=null}function AN(i){return i?.getReader!=null}});var Mu=P((v1)=>{Object.defineProperty(v1,"__esModule",{value:!0});v1.PonyfillHeaders=void 0;v1.isHeadersLike=mn;var BN=T("node:util"),$g=Bu();function mn(i){return i?.get&&i?.forEach}class b1{headersInit;_map;objectNormalizedKeysOfHeadersInit=[];objectOriginalKeysOfHeadersInit=[];_setCookies;constructor(i){this.headersInit=i}_get(i){let n=i.toLowerCase();if(n==="set-cookie"&&this._setCookies?.length)return this._setCookies.join(", ");if(this._map)return this._map.get(n)||null;if(this.headersInit==null)return null;if(Array.isArray(this.headersInit)){let r=this.headersInit.filter(([u])=>u.toLowerCase()===n);if(r.length===0)return null;if(r.length===1)return r[0][1];return r.map(([,u])=>u).join(", ")}else if(mn(this.headersInit))return this.headersInit.get(n);else{let r=this.headersInit[i]||this.headersInit[n];if(r!=null)return r;if(!this.objectNormalizedKeysOfHeadersInit.length)Object.keys(this.headersInit).forEach((c)=>{this.objectOriginalKeysOfHeadersInit.push(c),this.objectNormalizedKeysOfHeadersInit.push(c.toLowerCase())});let u=this.objectNormalizedKeysOfHeadersInit.indexOf(n);if(u===-1)return null;let t=this.objectOriginalKeysOfHeadersInit[u];return this.headersInit[t]}}getMap(){if(!this._map)if(this._setCookies||=[],this.headersInit!=null)if(Array.isArray(this.headersInit)){this._map=new Map;for(let[i,n]of this.headersInit){let r=i.toLowerCase();if(r==="set-cookie"){this._setCookies.push(n);continue}this._map.set(r,n)}}else if(mn(this.headersInit))this._map=new Map,this.headersInit.forEach((i,n)=>{if(n==="set-cookie"){this._setCookies||=[],this._setCookies.push(i);return}this._map.set(n,i)});else{this._map=new Map;for(let i in this.headersInit){let n=this.headersInit[i];if(n!=null){let r=i.toLowerCase();if(r==="set-cookie"){this._setCookies||=[],this._setCookies.push(n);continue}this._map.set(r,n)}}}else this._map=new Map;return this._map}append(i,n){let r=i.toLowerCase();if(r==="set-cookie"){this._setCookies||=[],this._setCookies.push(n);return}let u=this.getMap().get(r),t=u?`${u}, ${n}`:n;this.getMap().set(r,t)}get(i){let n=this._get(i);if(n==null)return null;return n.toString()}has(i){if(i.toLowerCase()==="set-cookie")return!!this._setCookies?.length;return!!this._get(i)}set(i,n){let r=i.toLowerCase();if(r==="set-cookie"){this._setCookies=[n];return}if(!this._map&&this.headersInit!=null)if(Array.isArray(this.headersInit)){let u=this.headersInit.find(([t])=>t.toLowerCase()===r);if(u)u[1]=n;else this.headersInit.push([r,n]);return}else if(mn(this.headersInit)){this.headersInit.set(r,n);return}else{this.headersInit[r]=n;return}this.getMap().set(r,n)}delete(i){let n=i.toLowerCase();if(n==="set-cookie"){this._setCookies=[];return}this.getMap().delete(n)}forEach(i){if(this._setCookies?.forEach((n)=>{i(n,"set-cookie",this)}),!this._map){if(this.headersInit){if(Array.isArray(this.headersInit)){this.headersInit.forEach(([n,r])=>{i(r,n,this)});return}if(mn(this.headersInit)){this.headersInit.forEach(i);return}Object.entries(this.headersInit).forEach(([n,r])=>{if(r!=null)i(r,n,this)})}return}this.getMap().forEach((n,r)=>{i(n,r,this)})}*_keys(){if(this._setCookies?.length)yield"set-cookie";if(!this._map){if(this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit.map(([i])=>i)[Symbol.iterator]();return}if(mn(this.headersInit)){yield*this.headersInit.keys();return}yield*Object.keys(this.headersInit)[Symbol.iterator]();return}}yield*this.getMap().keys()}keys(){return new $g.PonyfillIteratorObject(this._keys(),"HeadersIterator")}*_values(){if(this._setCookies?.length)yield*this._setCookies;if(!this._map){if(this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit.map(([,i])=>i)[Symbol.iterator]();return}if(mn(this.headersInit)){yield*this.headersInit.values();return}yield*Object.values(this.headersInit)[Symbol.iterator]();return}}yield*this.getMap().values()}values(){return new $g.PonyfillIteratorObject(this._values(),"HeadersIterator")}*_entries(){if(this._setCookies?.length)yield*this._setCookies.map((i)=>["set-cookie",i]);if(!this._map){if(this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit;return}if(mn(this.headersInit)){yield*this.headersInit.entries();return}yield*Object.entries(this.headersInit);return}}yield*this.getMap().entries()}entries(){return new $g.PonyfillIteratorObject(this._entries(),"HeadersIterator")}getSetCookie(){if(!this._setCookies)this.getMap();return this._setCookies}[Symbol.iterator](){return this.entries()}[Symbol.for("nodejs.util.inspect.custom")](){let i={};return this.forEach((n,r)=>{if(r==="set-cookie")i["set-cookie"]=this._setCookies||[];else i[r]=n?.includes(",")?n.split(",").map((u)=>u.trim()):n}),`Headers ${BN.inspect(i)}`}}v1.PonyfillHeaders=b1});var et=P((O1)=>{Object.defineProperty(O1,"__esModule",{value:!0});O1.PonyfillResponse=void 0;var VN=T("node:http"),MN=Vu(),wg=Mu(),Rt="application/json; charset=utf-8";class Zt extends MN.PonyfillBody{headers;constructor(i,n){super(i||null,n);this.headers=n?.headers&&wg.isHeadersLike(n.headers)?n.headers:new wg.PonyfillHeaders(n?.headers),this.status=n?.status||200,this.statusText=n?.statusText||VN.STATUS_CODES[this.status]||"OK",this.url=n?.url||"",this.redirected=n?.redirected||!1,this.type=n?.type||"default",this.handleContentLengthHeader()}get ok(){return this.status>=200&&this.status<300}status;statusText;url;redirected;type;clone(){return this}static error(){return new Zt(null,{status:500,statusText:"Internal Server Error"})}static redirect(i,n=302){if(n<300||n>399)throw new RangeError("Invalid status code");return new Zt(null,{headers:{location:i},status:n})}static json(i,n){let r=JSON.stringify(i);if(!n)n={headers:{"content-type":Rt,"content-length":Buffer.byteLength(r).toString()}};else if(!n.headers)n.headers={"content-type":Rt,"content-length":Buffer.byteLength(r).toString()};else if(wg.isHeadersLike(n.headers)){if(!n.headers.has("content-type"))n.headers.set("content-type",Rt);if(!n.headers.has("content-length"))n.headers.set("content-length",Buffer.byteLength(r).toString())}else if(Array.isArray(n.headers)){let u=!1,t=!1;for(let[c]of n.headers){if(t&&u)break;if(!u&&c.toLowerCase()==="content-type")u=!0;else if(!t&&c.toLowerCase()==="content-length")t=!0}if(!u)n.headers.push(["content-type",Rt]);if(!t)n.headers.push(["content-length",Buffer.byteLength(r).toString()])}else if(typeof n.headers==="object"){if(n.headers?.["content-type"]==null)n.headers["content-type"]=Rt;if(n.headers?.["content-length"]==null)n.headers["content-length"]=Buffer.byteLength(r).toString()}return new Zt(r,n)}[Symbol.toStringTag]="Response"}O1.PonyfillResponse=Zt});var z1=P((N1)=>{Object.defineProperty(N1,"__esModule",{value:!0});N1.fetchCurl=yN;var U1=T("node:stream"),xN=T("node:tls"),FN=Qn(),PN=et(),bg=Ci();function yN(i){let{Curl:n,CurlFeature:r,CurlPause:u,CurlProgressFunc:t}=globalThis.libcurl,c=new n;if(c.enable(r.NoDataParsing),c.setOpt("URL",i.url),process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")c.setOpt("SSL_VERIFYPEER",!1);if(process.env.NODE_EXTRA_CA_CERTS)c.setOpt("CAINFO",process.env.NODE_EXTRA_CA_CERTS);else c.setOpt("CAINFO_BLOB",xN.rootCertificates.join(`\n`));c.enable(r.StreamResponse);let g;if(i._signal===null)g=void 0;else if(i._signal)g=i._signal;if(c.setStreamProgressCallback(function(){return g?.aborted?process.env.DEBUG?t.Continue:1:0}),i.bodyType==="String")c.setOpt("POSTFIELDS",i.bodyInit);else{let v=i.body!=null?bg.isNodeReadable(i.body)?i.body:U1.Readable.from(i.body):null;if(v)c.setOpt("UPLOAD",!0),c.setUploadStream(v)}if(process.env.DEBUG)c.setOpt("VERBOSE",!0);c.setOpt("TRANSFER_ENCODING",!1),c.setOpt("HTTP_TRANSFER_DECODING",!0),c.setOpt("FOLLOWLOCATION",i.redirect==="follow"),c.setOpt("MAXREDIRS",20),c.setOpt("ACCEPT_ENCODING",""),c.setOpt("CUSTOMREQUEST",i.method);let h=i.headersSerializer||bg.defaultHeadersSerializer,_,l=h(i.headers,(v)=>{_=Number(v)});if(_!=null)c.setOpt("INFILESIZE",_);c.setOpt("HTTPHEADER",l),c.enable(r.NoHeaderParsing);let $=FN.createDeferredPromise(),w;function b(){if(c.isOpen)try{c.pause(u.Recv)}catch(v){$.reject(v)}}return g?.addEventListener("abort",b,{once:!0}),c.once("end",function v(){try{c.close()}catch(f){$.reject(f)}g?.removeEventListener("abort",b)}),c.once("error",function v(f){if(w&&!w.closed&&!w.destroyed)w.destroy(f);else{if(f.message==="Operation was aborted by an application callback")f.message="The operation was aborted.";$.reject(f)}try{c.close()}catch(U){$.reject(U)}}),c.once("stream",function v(f,U,z){let J=f.pipe(new U1.PassThrough,{end:!0}),j=z.toString("utf8").split(/\\r?\\n|\\r/g).filter((W)=>{if(W&&!W.startsWith("HTTP/")){if(i.redirect==="error"&&W.toLowerCase().includes("location")&&bg.shouldRedirect(U)){if(!f.destroyed)f.resume();J.destroy(),$.reject(new Error("redirect is not allowed"))}return!0}return!1}).map((W)=>W.split(/:\\s(.+)/).slice(0,2)),O=new PN.PonyfillResponse(J,{status:U,headers:j,url:c.getInfo(n.info.REDIRECT_URL)?.toString()||i.url,redirected:Number(c.getInfo(n.info.REDIRECT_COUNT))>0});$.resolve(O),w=J}),setImmediate(()=>{c.perform()}),$.promise}});var pt=P((J1)=>{Object.defineProperty(J1,"__esModule",{value:!0});J1.PonyfillURL=void 0;var kN=rg(),CN=kN.__importDefault(T("node:buffer")),RN=T("node:crypto"),W1=globalThis.URL;class D1 extends W1{static blobRegistry=new Map;static createObjectURL(i){let n=`blob:whatwgnode:${RN.randomUUID()}`;return this.blobRegistry.set(n,i),n}static revokeObjectURL(i){if(!this.blobRegistry.has(i))W1.revokeObjectURL(i);else this.blobRegistry.delete(i)}static getBlobFromURL(i){return this.blobRegistry.get(i)||CN.default?.resolveObjectURL?.(i)}}J1.PonyfillURL=D1});var xu=P((q1)=>{Object.defineProperty(q1,"__esModule",{value:!0});q1.PonyfillRequest=void 0;var ZN=T("node:http"),eN=T("node:https"),pN=Vu(),H1=Mu(),dN=pt();function aN(i){return i[Symbol.toStringTag]==="Request"}function sN(i){return i?.href!=null}class G1 extends pN.PonyfillBody{constructor(i,n){let r,u,t=null,c;if(typeof i==="string")r=i;else if(sN(i))u=i;else if(aN(i)){if(i._parsedUrl)u=i._parsedUrl;else if(i._url)r=i._url;else r=i.url;t=i.body,c=i}if(n!=null)t=n.body||null,c=n;super(t,c);if(this._url=r,this._parsedUrl=u,this.cache=c?.cache||"default",this.credentials=c?.credentials||"same-origin",this.headers=c?.headers&&H1.isHeadersLike(c.headers)?c.headers:new H1.PonyfillHeaders(c?.headers),this.integrity=c?.integrity||"",this.keepalive=c?.keepalive!=null?c?.keepalive:!1,this.method=c?.method?.toUpperCase()||"GET",this.mode=c?.mode||"cors",this.redirect=c?.redirect||"follow",this.referrer=c?.referrer||"about:client",this.referrerPolicy=c?.referrerPolicy||"no-referrer",this.headersSerializer=c?.headersSerializer,this.duplex=c?.duplex||"half",this.destination="document",this.priority="auto",this.method!=="GET"&&this.method!=="HEAD")this.handleContentLengthHeader(!0);if(c?.agent!=null){let g=u?.protocol||r||this.url;if(c.agent===!1)this.agent=!1;else if(g.startsWith("http:")&&c.agent instanceof ZN.Agent)this.agent=c.agent;else if(g.startsWith("https:")&&c.agent instanceof eN.Agent)this.agent=c.agent}}headersSerializer;cache;credentials;destination;headers;integrity;keepalive;method;mode;priority;redirect;referrer;referrerPolicy;_url;get signal(){return this._signal||=new AbortController().signal,this._signal}get url(){if(this._url==null)if(this._parsedUrl)this._url=this._parsedUrl.toString();else throw new TypeError("Invalid URL");return this._url}_parsedUrl;get parsedUrl(){if(this._parsedUrl==null)if(this._url!=null)this._parsedUrl=new dN.PonyfillURL(this._url,"http://localhost");else throw new TypeError("Invalid URL");return this._parsedUrl}duplex;agent;clone(){return this}[Symbol.toStringTag]="Request"}q1.PonyfillRequest=G1});var m1=P((Q1)=>{Object.defineProperty(Q1,"__esModule",{value:!0});Q1.fetchNodeHttp=Y1;var I1=T("node:http"),iz=T("node:https"),L1=T("node:stream"),Fu=T("node:zlib"),nz=Qn(),tz=xu(),rz=et(),uz=pt(),en=Ci();function cz(i){if(i.startsWith("http:"))return I1.request;else if(i.startsWith("https:"))return iz.request;throw new Error(`Unsupported protocol: ${i.split(":")[0]||i}`)}function Y1(i){return new Promise((n,r)=>{try{let u=cz(i.parsedUrl?.protocol||i.url),c=(i.headersSerializer||en.getHeadersObj)(i.headers);c["accept-encoding"]||="gzip, deflate, br",c["user-agent"]||="node";let g;if(i._signal==null)g=void 0;else if(i._signal)g=i._signal;let h;if(i.parsedUrl)h=u(i.parsedUrl,{method:i.method,headers:c,signal:g,agent:i.agent});else h=u(i.url,{method:i.method,headers:c,signal:g,agent:i.agent});if(h.once("error",r),h.once("response",(_)=>{let l;switch(_.headers["content-encoding"]){case"x-gzip":case"gzip":l=Fu.createGunzip();break;case"x-deflate":case"deflate":l=Fu.createInflate();break;case"x-deflate-raw":case"deflate-raw":l=Fu.createInflateRaw();break;case"br":l=Fu.createBrotliDecompress();break}if(_.headers.location&&en.shouldRedirect(_.statusCode)){if(i.redirect==="error"){let f=new Error("Redirects are not allowed");r(f),_.resume();return}if(i.redirect==="follow"){let f=new uz.PonyfillURL(_.headers.location,i.parsedUrl||i.url),U=Y1(new tz.PonyfillRequest(f,i));n(U.then((z)=>{return z.redirected=!0,z})),_.resume();return}}l||=new L1.PassThrough,en.pipeThrough({src:_,dest:l,signal:g,onError:(f)=>{if(!_.destroyed)_.destroy(f);if(!l.destroyed)l.destroy(f);r(f)}});let w=_.statusCode||200,b=_.statusMessage||I1.STATUS_CODES[w];if(b==null)b="";let v=new rz.PonyfillResponse(l||_,{status:w,statusText:b,headers:_.headers,url:i.url,signal:g});n(v)}),i._buffer!=null)nz.handleMaybePromise(()=>en.safeWrite(i._buffer,h),()=>en.endStream(h),r);else{let _=i.body!=null?en.isNodeReadable(i.body)?i.body:L1.Readable.from(i.body):null;if(_)_.pipe(h);else en.endStream(h)}}catch(u){r(u)}})}});var V1=P((K1)=>{Object.defineProperty(K1,"__esModule",{value:!0});K1.fetchPonyfill=B1;var gz=T("node:buffer"),Pu=T("node:fs"),hz=T("node:url"),_z=z1(),lz=m1(),$z=xu(),Wt=et(),wz=pt(),S1=Ci(),A1=";base64";async function bz(i){let n=hz.fileURLToPath(i);try{await Pu.promises.access(n,Pu.promises.constants.R_OK);let r=await Pu.promises.stat(n,{bigint:!0}),u=Pu.createReadStream(n);return new Wt.PonyfillResponse(u,{status:200,statusText:"OK",headers:{"content-type":"application/octet-stream","last-modified":r.mtime.toUTCString()}})}catch(r){if(r.code==="ENOENT")return new Wt.PonyfillResponse(null,{status:404,statusText:"Not Found"});else if(r.code==="EACCES")return new Wt.PonyfillResponse(null,{status:403,statusText:"Forbidden"});throw r}}function vz(i){let[n="text/plain",...r]=i.substring(5).split(","),u=decodeURIComponent(r.join(","));if(n.endsWith(A1)){let t=gz.Buffer.from(u,"base64url"),c=n.slice(0,-A1.length);return new Wt.PonyfillResponse(t,{status:200,statusText:"OK",headers:{"content-type":c}})}return new Wt.PonyfillResponse(u,{status:200,statusText:"OK",headers:{"content-type":n}})}function fz(i){let n=wz.PonyfillURL.getBlobFromURL(i);if(!n)throw new TypeError("Invalid Blob URL");return new Wt.PonyfillResponse(n,{status:200,headers:{"content-type":n.type,"content-length":n.size.toString()}})}function Oz(i){return i!=null&&i.href!=null}function B1(i,n){if(typeof i==="string"||Oz(i)){let u=new $z.PonyfillRequest(i,n);return B1(u)}let r=i;if(r.url.startsWith("data:")){let u=vz(r.url);return S1.fakePromise(u)}if(r.url.startsWith("file:"))return bz(r.url);if(r.url.startsWith("blob:")){let u=fz(r.url);return S1.fakePromise(u)}if(globalThis.libcurl&&!r.agent)return _z.fetchCurl(r);return lz.fetchNodeHttp(r)}});var vg=P((F1)=>{Object.defineProperty(F1,"__esModule",{value:!0});F1.PonyfillTextDecoder=F1.PonyfillTextEncoder=void 0;F1.PonyfillBtoa=Nz;var dt=T("node:buffer"),Uz=Ci();class M1{encoding;constructor(i="utf-8"){this.encoding=i}encode(i){return dt.Buffer.from(i,this.encoding)}encodeInto(i,n){let u=this.encode(i).copy(n);return{read:u,written:u}}}F1.PonyfillTextEncoder=M1;class x1{encoding;fatal=!1;ignoreBOM=!1;constructor(i="utf-8",n){if(this.encoding=i,n)this.fatal=n.fatal||!1,this.ignoreBOM=n.ignoreBOM||!1}decode(i){if(dt.Buffer.isBuffer(i))return i.toString(this.encoding);if(Uz.isArrayBufferView(i))return dt.Buffer.from(i.buffer,i.byteOffset,i.byteLength).toString(this.encoding);return dt.Buffer.from(i).toString(this.encoding)}}F1.PonyfillTextDecoder=x1;function Nz(i){return dt.Buffer.from(i,"binary").toString("base64")}});var k1=P((y1)=>{Object.defineProperty(y1,"__esModule",{value:!0});y1.PonyfillURLSearchParams=void 0;y1.PonyfillURLSearchParams=globalThis.URLSearchParams});var Og=P((Z1)=>{Object.defineProperty(Z1,"__esModule",{value:!0});Z1.PonyfillWritableStream=void 0;var yu=T("node:events"),fg=T("node:stream"),C1=Qn(),Sn=Ci();class R1{writable;constructor(i){if(i instanceof fg.Writable)this.writable=i;else if(i){let n=new fg.Writable({write(t,c,g){try{let h=i.write?.(t,u);if(h instanceof Promise)h.then(()=>{g()},(_)=>{g(_)});else g()}catch(h){g(h)}},final(t){let c=i.close?.();if(c instanceof Promise)c.then(()=>{t()},(g)=>{t(g)});else t()}});this.writable=n;let r=new AbortController,u={signal:r.signal,error(t){n.destroy(t)}};n.once("error",(t)=>r.abort(t)),n.once("close",()=>r.abort())}else this.writable=new fg.Writable}getWriter(){let i=this.writable;return{get closed(){return yu.once(i,"close")},get desiredSize(){return i.writableLength},get ready(){return yu.once(i,"drain")},releaseLock(){},write(n){let r=Sn.fakePromise();if(n==null)return r;return r.then(()=>Sn.safeWrite(n,i))},close(){if(!i.errored&&i.closed)return Sn.fakePromise();if(i.errored)return C1.fakeRejectPromise(i.errored);return Sn.fakePromise().then(()=>Sn.endStream(i))},abort(n){return i.destroy(n),yu.once(i,"close")}}}close(){if(!this.writable.errored&&this.writable.closed)return Sn.fakePromise();if(this.writable.errored)return C1.fakeRejectPromise(this.writable.errored);return Sn.fakePromise().then(()=>Sn.endStream(this.writable))}abort(i){return this.writable.destroy(i),yu.once(this.writable,"close")}locked=!1}Z1.PonyfillWritableStream=R1});var at=P((d1)=>{Object.defineProperty(d1,"__esModule",{value:!0});d1.PonyfillTransformStream=void 0;var jg=T("node:stream"),Dz=Ut(),Jz=Ci(),Ez=Og();class p1{transform;writable;readable;constructor(i){if(i instanceof jg.Transform)this.transform=i;else if(i){let n={enqueue(u){r.push(u)},error(u){r.destroy(u)},terminate(){Jz.endStream(r)},get desiredSize(){return r.writableLength}},r=new jg.Transform({read(){},write(u,t,c){try{let g=i.transform?.(u,n);if(g instanceof Promise)g.then(()=>{c()},(h)=>{c(h)});else c()}catch(g){c(g)}},final(u){try{let t=i.flush?.(n);if(t instanceof Promise)t.then(()=>{u()},(c)=>{u(c)});else u()}catch(t){u(t)}}});this.transform=r}else this.transform=new jg.Transform;this.writable=new Ez.PonyfillWritableStream(this.transform),this.readable=new Dz.PonyfillReadableStream(this.transform)}}d1.PonyfillTransformStream=p1});var tv=P((iv)=>{Object.defineProperty(iv,"__esModule",{value:!0});iv.PonyfillCompressionStream=void 0;var Tu=T("node:zlib"),Hz=at();class s1 extends Hz.PonyfillTransformStream{static supportedFormats=globalThis.process?.version?.startsWith("v2")?["gzip","deflate","br"]:["gzip","deflate","deflate-raw","br"];constructor(i){switch(i){case"x-gzip":case"gzip":super(Tu.createGzip());break;case"x-deflate":case"deflate":super(Tu.createDeflate());break;case"deflate-raw":super(Tu.createDeflateRaw());break;case"br":super(Tu.createBrotliCompress());break;default:throw new Error(`Unsupported compression format: ${i}`)}}}iv.PonyfillCompressionStream=s1});var ov=P((uv)=>{Object.defineProperty(uv,"__esModule",{value:!0});uv.PonyfillDecompressionStream=void 0;var ku=T("node:zlib"),Gz=at();class rv extends Gz.PonyfillTransformStream{static supportedFormats=globalThis.process?.version?.startsWith("v2")?["gzip","deflate","br"]:["gzip","deflate","deflate-raw","br"];constructor(i){switch(i){case"x-gzip":case"gzip":super(ku.createGunzip());break;case"x-deflate":case"deflate":super(ku.createInflate());break;case"deflate-raw":super(ku.createInflateRaw());break;case"br":super(ku.createBrotliDecompress());break;default:throw new TypeError(`Unsupported compression format: \'${i}\'`)}}}uv.PonyfillDecompressionStream=rv});var bv=P(($v)=>{Object.defineProperty($v,"__esModule",{value:!0});$v.PonyfillTextEncoderStream=$v.PonyfillTextDecoderStream=void 0;var gv=vg(),hv=at();class _v extends hv.PonyfillTransformStream{textDecoder;constructor(i,n){super({transform:(r,u)=>u.enqueue(this.textDecoder.decode(r,{stream:!0}))});this.textDecoder=new gv.PonyfillTextDecoder(i,n)}get encoding(){return this.textDecoder.encoding}get fatal(){return this.textDecoder.fatal}get ignoreBOM(){return this.textDecoder.ignoreBOM}}$v.PonyfillTextDecoderStream=_v;class lv extends hv.PonyfillTransformStream{textEncoder;constructor(i){super({transform:(n,r)=>r.enqueue(this.textEncoder.encode(n))});this.textEncoder=new gv.PonyfillTextEncoder(i)}get encoding(){return this.textEncoder.encoding}encode(i){return this.textEncoder.encode(i)}}$v.PonyfillTextEncoderStream=lv});var fv=P((ti)=>{Object.defineProperty(ti,"__esModule",{value:!0});ti.TextEncoderStream=ti.TextDecoderStream=ti.IteratorObject=ti.DecompressionStream=ti.CompressionStream=ti.TransformStream=ti.WritableStream=ti.URLSearchParams=ti.URL=ti.btoa=ti.TextDecoder=ti.TextEncoder=ti.Blob=ti.FormData=ti.File=ti.ReadableStream=ti.Response=ti.Request=ti.Body=ti.Headers=ti.fetch=void 0;var Xz=V1();Object.defineProperty(ti,"fetch",{enumerable:!0,get:function(){return Xz.fetchPonyfill}});var Lz=Mu();Object.defineProperty(ti,"Headers",{enumerable:!0,get:function(){return Lz.PonyfillHeaders}});var Iz=Vu();Object.defineProperty(ti,"Body",{enumerable:!0,get:function(){return Iz.PonyfillBody}});var Yz=xu();Object.defineProperty(ti,"Request",{enumerable:!0,get:function(){return Yz.PonyfillRequest}});var Qz=et();Object.defineProperty(ti,"Response",{enumerable:!0,get:function(){return Qz.PonyfillResponse}});var mz=Ut();Object.defineProperty(ti,"ReadableStream",{enumerable:!0,get:function(){return mz.PonyfillReadableStream}});var Sz=ng();Object.defineProperty(ti,"File",{enumerable:!0,get:function(){return Sz.PonyfillFile}});var Az=lg();Object.defineProperty(ti,"FormData",{enumerable:!0,get:function(){return Az.PonyfillFormData}});var Bz=Iu();Object.defineProperty(ti,"Blob",{enumerable:!0,get:function(){return Bz.PonyfillBlob}});var Ug=vg();Object.defineProperty(ti,"TextEncoder",{enumerable:!0,get:function(){return Ug.PonyfillTextEncoder}});Object.defineProperty(ti,"TextDecoder",{enumerable:!0,get:function(){return Ug.PonyfillTextDecoder}});Object.defineProperty(ti,"btoa",{enumerable:!0,get:function(){return Ug.PonyfillBtoa}});var Kz=pt();Object.defineProperty(ti,"URL",{enumerable:!0,get:function(){return Kz.PonyfillURL}});var Vz=k1();Object.defineProperty(ti,"URLSearchParams",{enumerable:!0,get:function(){return Vz.PonyfillURLSearchParams}});var Mz=Og();Object.defineProperty(ti,"WritableStream",{enumerable:!0,get:function(){return Mz.PonyfillWritableStream}});var xz=at();Object.defineProperty(ti,"TransformStream",{enumerable:!0,get:function(){return xz.PonyfillTransformStream}});var Fz=tv();Object.defineProperty(ti,"CompressionStream",{enumerable:!0,get:function(){return Fz.PonyfillCompressionStream}});var Pz=ov();Object.defineProperty(ti,"DecompressionStream",{enumerable:!0,get:function(){return Pz.PonyfillDecompressionStream}});var yz=Bu();Object.defineProperty(ti,"IteratorObject",{enumerable:!0,get:function(){return yz.PonyfillIteratorObject}});var vv=bv();Object.defineProperty(ti,"TextDecoderStream",{enumerable:!0,get:function(){return vv.PonyfillTextDecoderStream}});Object.defineProperty(ti,"TextEncoderStream",{enumerable:!0,get:function(){return vv.PonyfillTextEncoderStream}})});var jv=P((H9,Ov)=>{var kz=Do(),ri;Ov.exports=function i(n={}){let r={};if(r.URLPattern=globalThis.URLPattern,!r.URLPattern){let u=gw();r.URLPattern=u.URLPattern}if(n.skipPonyfill||kz())return{fetch:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response,FormData:globalThis.FormData,ReadableStream:globalThis.ReadableStream,WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,CompressionStream:globalThis.CompressionStream,DecompressionStream:globalThis.DecompressionStream,TextDecoderStream:globalThis.TextDecoderStream,TextEncoderStream:globalThis.TextEncoderStream,Blob:globalThis.Blob,File:globalThis.File,crypto:globalThis.crypto,btoa:globalThis.btoa,TextEncoder:globalThis.TextEncoder,TextDecoder:globalThis.TextDecoder,URLPattern:r.URLPattern,URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams};if(ri||=fv(),r.fetch=ri.fetch,r.Request=ri.Request,r.Response=ri.Response,r.Headers=ri.Headers,r.FormData=ri.FormData,r.ReadableStream=ri.ReadableStream,r.URL=ri.URL,r.URLSearchParams=ri.URLSearchParams,r.WritableStream=ri.WritableStream,r.TransformStream=ri.TransformStream,r.CompressionStream=ri.CompressionStream,r.DecompressionStream=ri.DecompressionStream,r.TextDecoderStream=ri.TextDecoderStream,r.TextEncoderStream=ri.TextEncoderStream,r.Blob=ri.Blob,r.File=ri.File,r.crypto=globalThis.crypto,r.btoa=ri.btoa,r.TextEncoder=ri.TextEncoder,r.TextDecoder=ri.TextDecoder,n.formDataLimits)r.Body=class u extends ri.Body{constructor(t,c){super(t,{formDataLimits:n.formDataLimits,...c})}},r.Request=class u extends ri.Request{constructor(t,c){super(t,{formDataLimits:n.formDataLimits,...c})}},r.Response=class u extends ri.Response{constructor(t,c){super(t,{formDataLimits:n.formDataLimits,...c})}};if(!r.crypto){let u=T("crypto");r.crypto=u.webcrypto}return r}});var H0="x-blink-invocation-token",G0="INTERNAL_BLINK_API_SERVER_URL",zo="INTERNAL_BLINK_API_SERVER_LISTEN_PORT";import AY from"http";import{resolve as BY}from"node:path";import{createServer as SY,Server as oj}from"node:http";var vu=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function ln(i){return i?.then!=null}function wj(i){let n=i;return n&&n.then&&n.catch&&n.finally}function ji(i,n,r,u){let t=zi().then(i).then(n,r);if(u)t=t.finally(u);return Wo(t)}function zi(i){if(i&&wj(i))return i;if(ln(i))return{then:(n,r)=>zi(i.then(n,r)),catch:(n)=>zi(i.then((r)=>r,n)),finally:(n)=>zi(n?fj(i,n):i),[Symbol.toStringTag]:"Promise"};return{then(n){if(n)try{return zi(n(i))}catch(r){return Mt(r)}return this},catch(){return this},finally(n){if(n)try{return zi(n()).then(()=>i,()=>i)}catch(r){return Mt(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:i,[vu]:"resolved"}}function q0(){if(Promise.withResolvers)return Promise.withResolvers();let i,n;return{promise:new Promise(function u(t,c){i=t,n=c}),get resolve(){return i},get reject(){return n}}}function fu(i,n,r){if(i?.length===0)return;let u=i[Symbol.iterator](),t=0;function c(){let{done:g,value:h}=u.next();if(g)return;let _=!1;function l(){_=!0}return ji(function $(){return n(h,l,t++)},function $(w){if(w)r?.push(w);if(_)return;return c()})}return c()}function Mt(i){return{then(n,r){if(r)try{return zi(r(i))}catch(u){return Mt(u)}return this},catch(n){if(n)try{return zi(n(i))}catch(r){return Mt(r)}return this},finally(n){if(n)try{n()}catch(r){return Mt(r)}return this},__fakeRejectError:i,[Symbol.toStringTag]:"Promise",[vu]:"rejected"}}function bj(i){return i?.[vu]==="resolved"}function vj(i){return i?.[vu]==="rejected"}function fj(i,n){if("finally"in i)return i.finally(n);return i.then((r)=>{let u=n();return ln(u)?u.then(()=>r):r},(r)=>{let u=n();if(ln(u))return u.then(()=>{throw r});else throw r})}function Wo(i){if(bj(i))return i.__fakePromiseValue;if(vj(i))throw i.__fakeRejectError;return i}function X0(i,n){let r={...n,...i};for(let u of Object.keys(r))if(u in i&&u in n)r[u]=(t,c)=>i[u](t,()=>n[u](t,c));return r}var L0=(i)=>({fn(n,r){if(!n)return r;return(...u)=>{let t;return n(i,()=>{t=r(...u)}),t}},asyncFn(n,r){if(!n)return r;return(...u)=>{let t;return ji(()=>n(i,()=>{return t=r(...u),ln(t)?t.then(()=>{return}):void 0}),()=>{return t})}}});class yn extends Error{error;suppressed;constructor(i,n,r){super(r);this.error=i,this.suppressed=n,this.name="SuppressedError",Error.captureStackTrace(this,this.constructor)}}var Ji={get dispose(){return Symbol.dispose||Symbol.for("dispose")},get asyncDispose(){return Symbol.asyncDispose||Symbol.for("asyncDispose")}};function Ou(i){return i?.[Ji.dispose]!=null}function I0(i){return i?.[Ji.asyncDispose]!=null}var Oj=globalThis.SuppressedError||yn;class ju{callbacks=[];get disposed(){return this.callbacks.length===0}use(i){if(I0(i))this.callbacks.push(()=>i[Ji.asyncDispose]());else if(Ou(i))this.callbacks.push(()=>i[Ji.dispose]());return i}adopt(i,n){if(n)this.callbacks.push(()=>n(i));return i}defer(i){if(i)this.callbacks.push(i)}move(){let i=new ju;return i.callbacks=this.callbacks,this.callbacks=[],i}disposeAsync(){return this[Ji.asyncDispose]()}_error;_iterateCallbacks(){let i=this.callbacks.pop();if(i)return ji(i,()=>this._iterateCallbacks(),(n)=>{return this._error=this._error?new Oj(n,this._error):n,this._iterateCallbacks()})}[Ji.asyncDispose](){let i=this._iterateCallbacks();if(i?.then)return i.then(()=>{if(this._error){let n=this._error;throw this._error=void 0,n}});if(this._error){let n=this._error;throw this._error=void 0,n}return}[Symbol.toStringTag]="AsyncDisposableStack"}var jj=globalThis.SuppressedError||yn;class Uu{callbacks=[];get disposed(){return this.callbacks.length===0}use(i){if(Ou(i))this.callbacks.push(()=>i[Ji.dispose]());return i}adopt(i,n){if(n)this.callbacks.push(()=>n(i));return i}defer(i){if(i)this.callbacks.push(i)}move(){let i=new Uu;return i.callbacks=this.callbacks,this.callbacks=[],i}dispose(){return this[Ji.dispose]()}_error;_iterateCallbacks(){let i=this.callbacks.pop();if(i){try{i()}catch(n){this._error=this._error?new jj(n,this._error):n}return this._iterateCallbacks()}}[Ji.dispose](){if(this._iterateCallbacks(),this._error){let i=this._error;throw this._error=void 0,i}}[Symbol.toStringTag]="DisposableStack"}var hQ=globalThis.DisposableStack||Uu,Y0=globalThis.AsyncDisposableStack||ju,_Q=globalThis.SuppressedError||yn;var Ng={};Xn(Ng,{fetch:()=>Nv,crypto:()=>mv,createFetch:()=>xv,btoa:()=>Sv,WritableStream:()=>Hv,URLSearchParams:()=>Mv,URLPattern:()=>Kv,URL:()=>Vv,TransformStream:()=>Gv,TextEncoderStream:()=>Iv,TextEncoder:()=>Av,TextDecoderStream:()=>Lv,TextDecoder:()=>Bv,Response:()=>Dv,Request:()=>Wv,ReadableStream:()=>Ev,Headers:()=>zv,FormData:()=>Jv,File:()=>Qv,DecompressionStream:()=>Xv,CompressionStream:()=>qv,Blob:()=>Yv});var Uv=jv(),Cz=Do(),hi=Uv();if(!Cz())try{globalThis.libcurl=globalThis.libcurl||(()=>{throw new Error("Cannot require module "+"node-libcurl");})()}catch(i){}var{fetch:Nv,Headers:zv,Request:Wv,Response:Dv,FormData:Jv,ReadableStream:Ev,WritableStream:Hv,TransformStream:Gv,CompressionStream:qv,DecompressionStream:Xv,TextDecoderStream:Lv,TextEncoderStream:Iv,Blob:Yv,File:Qv,crypto:mv,btoa:Sv,TextEncoder:Av,TextDecoder:Bv,URLPattern:Kv,URL:Vv,URLSearchParams:Mv}=hi,xv=Uv;function Pv(i){return i!=null&&typeof i==="object"&&typeof i[Symbol.asyncIterator]==="function"}function Rz(i){if(i.socket?.localPort)return i.socket?.localPort;let r=(i.headers?.[":authority"]||i.headers?.host)?.split(":")?.[1];if(r)return r;return 80}function Zz(i){if(i.headers?.[":authority"])return i.headers?.[":authority"];if(i.headers?.host)return i.headers?.host;let n=Rz(i);if(i.hostname)return i.hostname+":"+n;let r=i.socket?.localAddress;if(r&&!r?.includes("::")&&!r?.includes("ffff"))return`${r}:${n}`;return"localhost"}function ez(i){let n=Zz(i),r=i.protocol||(i.socket?.encrypted?"https":"http"),u=i.originalUrl||i.url||"/graphql";return`${r}://${n}${u}`}function pz(i){let n=i[Symbol.toStringTag];if(typeof i==="string"||n==="Uint8Array"||n==="Blob"||n==="FormData"||n==="URLSearchParams"||Pv(i))return!0;return!1}function zg(i,n,r,u){let t=i.raw||i.req||i,c=ez(t);if(i.query){let l=new n.URL(c);for(let $ in i.query)l.searchParams.set($,i.query[$]);c=l.toString()}let g=i.headers;if(i.headers?.[":method"]){g={};for(let l in i.headers)if(!l.startsWith(":"))g[l]=i.headers[l]}let h=u?Hg():new AbortController;if(r?.once){let l=()=>{if(!h.signal.aborted)Object.defineProperty(t,"aborted",{value:!0}),h.abort(r.errored??void 0)};r.once("error",l),r.once("close",l),r.once("finish",()=>{r.removeListener("close",l)})}if(i.method==="GET"||i.method==="HEAD")return new n.Request(c,{method:i.method,headers:g,signal:h.signal});let _=i.body;if(_!=null&&Object.keys(_).length>0){if(pz(_))return new n.Request(c,{method:i.method||"GET",headers:g,body:_,signal:h.signal});let l=new n.Request(c,{method:i.method||"GET",headers:g,signal:h.signal});if(!l.headers.get("content-type")?.includes("json"))l.headers.set("content-type","application/json; charset=utf-8");return new Proxy(l,{get:($,w,b)=>{switch(w){case"json":return()=>zi(_);case"text":return()=>zi(JSON.stringify(_));default:if(globalThis.Bun)return Reflect.get($,w);return Reflect.get($,w,b)}}})}return new n.Request(c,{method:i.method,headers:g,signal:h.signal,body:t,duplex:"half"})}function yv(i){return i.read!=null}function Tv(i){return yv(i)}function Wg(i){return i!=null&&i.setHeader!=null&&i.end!=null&&i.once!=null&&i.write!=null}function dz(i){return i!=null&&i.getReader!=null}function kv(i){return i!=null&&i.request!=null&&i.respondWith!=null}function az(i){i?.socket?.setTimeout?.(0),i?.socket?.setNoDelay?.(!0),i?.socket?.setKeepAlive?.(!0)}function pn(i){i.end(null,null,null)}function sz(i,n){let r=!1,u=()=>{r=!0};i.once("error",u),i.once("close",u),i.once("finish",()=>{i.removeListener("close",u),i.removeListener("error",u)});let t=n[Symbol.asyncIterator](),c=()=>t.next().then(({done:g,value:h})=>{if(r||g)return;return ji(()=>st(h,i),()=>r?pn(i):c())});return c()}function st(i,n){if(!n.write(i))return new Promise((u)=>n.once("drain",u))}function Cv(i,n,r,u){if(n.closed||n.destroyed||n.writableEnded)return;if(!i){n.statusCode=404,pn(n);return}if(u&&i.headers?.headersInit&&!Array.isArray(i.headers.headersInit)&&!i.headers.headersInit.get&&!i.headers._map&&!i.headers._setCookies?.length)n.writeHead(i.status,i.statusText,i.headers.headersInit);else{if(n.setHeaders)n.setHeaders(i.headers);else{let g=!1;i.headers.forEach((h,_)=>{if(_==="set-cookie"){if(g)return;g=!0;let l=i.headers.getSetCookie?.();if(l){n.setHeader("set-cookie",l);return}}n.setHeader(_,h)})}n.writeHead(i.status,i.statusText)}if(i.bodyType==="String")return ji(()=>st(i.bodyInit,n),()=>pn(n));let t=i._buffer;if(t)return ji(()=>st(t,n),()=>pn(n));let c=i.body;if(c==null){pn(n);return}if(c[Symbol.toStringTag]==="Uint8Array")return ji(()=>st(c,n),()=>pn(n));if(az(r),yv(c)){n.once("close",()=>{c.destroy()}),c.pipe(n,{end:!0});return}if(dz(c))return iW(r,n,c);if(Pv(c))return sz(n,c)}function iW(i,n,r){let u=r.getReader();i?.once?.("error",(c)=>{u.cancel(c)});function t(){return u.read().then(({done:c,value:g})=>c?pn(n):ji(()=>st(g,n),t))}return t()}function Rv(i){return i!=null&&typeof i==="object"&&(("body"in i)||("cache"in i)||("credentials"in i)||("headers"in i)||("integrity"in i)||("keepalive"in i)||("method"in i)||("mode"in i)||("redirect"in i)||("referrer"in i)||("referrerPolicy"in i)||("signal"in i)||("window"in i))}function dn(...i){let[n,...r]=i.filter((u)=>u!=null&&typeof u==="object");return r.forEach((u)=>{let t=Object.getOwnPropertyNames(u).reduce((c,g)=>{if(Object.getOwnPropertyDescriptor(u,g))c[g]=Object.getOwnPropertyDescriptor(u,g);return c},{});Object.getOwnPropertySymbols(u).forEach((c)=>{let g=Object.getOwnPropertyDescriptor(u,c);if(g?.enumerable)t[c]=g}),Object.defineProperties(n,t)}),n}function Dg(i,n){return new n(i.stack||i.message||i.toString(),{status:i.status||500})}function Jg(i,n){if(i==null){if(n==null)return{};return{waitUntil:n}}return dn(Object.create(i),{waitUntil:n},i)}function Eg(i,n){if(n?.aborted)throw n.reason;if(ln(i)&&n){let u=function(){r.reject(n.reason)},r=q0();return n.addEventListener("abort",u,{once:!0}),i.then(function t(c){r.resolve(c)}).catch(function t(c){r.reject(c)}).finally(()=>{n.removeEventListener("abort",u)}),r.promise}return i}var nW=["SIGINT","exit","SIGTERM"],Cu=new Set,Fv=!1;function tW(){if(Fv)return;Fv=!0;for(let i of nW)globalThis.process.once(i,function n(){return Promise.allSettled([...Cu].map((r)=>!r.disposed&&r.disposeAsync()))})}function Zv(i){if(globalThis.process){if(tW(),!Cu.has(i))Cu.add(i),i.defer(()=>{Cu.delete(i)})}}class ev extends EventTarget{aborted=!1;_onabort=null;_reason;constructor(){super();let i=globalThis.process?.getBuiltinModule?.("node:events");if(i?.kMaxEventTargetListeners)this[i.kMaxEventTargetListeners]=0}throwIfAborted(){if(this._nativeCtrl?.signal?.throwIfAborted)return this._nativeCtrl.signal.throwIfAborted();if(this.aborted)throw this._reason}_nativeCtrl;ensureNativeCtrl(){if(!this._nativeCtrl){let i=this.aborted;if(this._nativeCtrl=new AbortController,i)this._nativeCtrl.abort(this._reason)}return this._nativeCtrl}abort(i){if(this._nativeCtrl?.abort)return this._nativeCtrl?.abort(i);this._reason=i||new DOMException("This operation was aborted","AbortError"),this.aborted=!0,this.dispatchEvent(new Event("abort"))}get signal(){if(this._nativeCtrl?.signal)return this._nativeCtrl.signal;return this}get reason(){if(this._nativeCtrl?.signal)return this._nativeCtrl.signal.reason;return this._reason}get onabort(){if(this._onabort)return this._onabort;return this._onabort}set onabort(i){if(this._nativeCtrl?.signal){this._nativeCtrl.signal.onabort=i;return}if(this._onabort)this.removeEventListener("abort",this._onabort);if(this._onabort=i,i)this.addEventListener("abort",i)}}function Hg(){if(globalThis.Bun||globalThis.Deno)return new AbortController;return new Proxy(new ev,{get(i,n,r){if(n.toString().includes("kDependantSignals")){let u=i.ensureNativeCtrl();return Reflect.get(u.signal,n,u.signal)}return Reflect.get(i,n,r)},set(i,n,r,u){if(n.toString().includes("kDependantSignals")){let t=i.ensureNativeCtrl();return Reflect.set(t.signal,n,r,t.signal)}return Reflect.set(i,n,r,u)},getPrototypeOf(){return AbortSignal.prototype}})}function pv(i){return!!i.onData}function dv({req:i,res:n,fetchAPI:r,controller:u}){let t=i.getMethod(),c,g=[],h=[(W)=>{g.push(W)}],_=(W)=>{for(let E of h)E(W)},l=!1,$=[()=>{l=!0}],w=()=>{for(let W of $)W()};n.onData(function(W,E){if(_(Buffer.from(Buffer.from(W,0,W.byteLength))),E)w()});let b;if(t!=="get"&&t!=="head"){c="half",u.signal.addEventListener("abort",()=>{w()},{once:!0});let W;b=()=>{if(!W)W=new r.ReadableStream({start(E){for(let X of g)E.enqueue(X);if(l){E.close();return}h.push((X)=>{E.enqueue(X)}),$.push(()=>{if(u.signal.reason){E.error(u.signal.reason);return}if(E.desiredSize)E.close()})}});return W}}let v=new r.Headers;i.forEach((W,E)=>{v.append(W,E)});let f=`http://localhost${i.getUrl()}`,U=i.getQuery();if(U)f+=`?${U}`;let z;function J(){if(!b)return null;if(l)return j();return b()}let N=new r.Request(f,{method:t,headers:v,get body(){return J()},signal:u.signal,duplex:c});function j(){if(!z)z=g.length===1?g[0]:Buffer.concat(g);return z}function O(){if(l)return zi(j());return new Promise((W,E)=>{try{$.push(()=>{W(j())})}catch(X){E(X)}})}return Object.defineProperties(N,{body:{get(){return J()},configurable:!0,enumerable:!0},json:{value(){return O().then((W)=>W.toString("utf8")).then((W)=>JSON.parse(W))},configurable:!0,enumerable:!0},text:{value(){return O().then((W)=>W.toString("utf8"))},configurable:!0,enumerable:!0},arrayBuffer:{value(){return O()},configurable:!0,enumerable:!0}}),N}function rW(i,n){return new n.WritableStream({write(r){i.cork(()=>{i.write(r)})},close(){i.cork(()=>{i.end()})}})}function av(i,n,r,u){if(!n){i.writeStatus("404 Not Found"),i.end();return}let t=n._buffer,c=n.bodyType==="String"?n.bodyInit:void 0;if(r.signal.aborted)return;if(i.cork(()=>{i.writeStatus(`${n.status} ${n.statusText}`);for(let[g,h]of n.headers)if(g!=="content-length"){if(g==="set-cookie"){let _=n.headers.getSetCookie?.();if(_){for(let l of _)i.writeHeader(g,l);continue}}i.writeHeader(g,h)}if(c)i.end(c);else if(t)i.end(t);else if(!n.body)i.end()}),c||t||!n.body)return;return r.signal.addEventListener("abort",()=>{if(!n.body?.locked)n.body?.cancel(r.signal.reason)},{once:!0}),n.body.pipeTo(rW(i,u),{signal:r.signal}).catch((g)=>{if(r.signal.aborted)return;throw g})}function uW(i){try{return!!i?.request}catch{return!1}}var cW={};function Gg(i,n){let r=n?.__useSingleWriteHead==null?!0:n.__useSingleWriteHead,u={...Ng,...n?.fetchAPI},t=n?.__useCustomAbortCtrl==null?u.Request!==globalThis.Request:n.__useCustomAbortCtrl,c=typeof i==="function"?i:i.handle,g=[],h=[],_,l=new Set,$;function w(){if(!$){if($=new Y0,n?.disposeOnProcessTerminate)Zv($);$.defer(()=>{if(l.size>0)return Promise.allSettled(l).then(()=>{l.clear()},()=>{l.clear()})})}return $}function b(H){if(ln(H))w(),l.add(H),H.then(()=>{l.delete(H)},(Y)=>{console.error(`Unexpected error while waiting: ${Y.message||Y}`),l.delete(H)})}if(n?.plugins!=null)for(let H of n.plugins){if(H.instrumentation)_=_?X0(_,H.instrumentation):H.instrumentation;if(H.onRequest)g.push(H.onRequest);if(H.onResponse)h.push(H.onResponse);let Y=H[Ji.dispose];if(Y)w().defer(Y);let V=H[Ji.asyncDispose];if(V)w().defer(V);if(H.onDispose)w().defer(H.onDispose)}let v=g.length>0||h.length>0?function H(Y,V){let Q=c,M;if(g.length===0)return Mi();let p=Y.parsedUrl||new Proxy(cW,{get(s,Ti,Di){return p=new u.URL(Y.url,"http://localhost"),Reflect.get(p,Ti,p)}});function li(s){if(h.length===0)return s;return ji(()=>fu(h,(Ti)=>Ti({request:Y,response:s,serverContext:V,setResponse(Di){s=Di},fetchAPI:u})),()=>s)}function Mi(){if(!M)return ji(()=>Q(Y,V),li);return li(M)}return ji(()=>fu(g,(s,Ti)=>s({request:Y,setRequest(Di){Y=Di},serverContext:V,fetchAPI:u,url:p,requestHandler:Q,setRequestHandler(Di){Q=Di},endResponse(Di){if(M=Di,Di)Ti()}})),Mi)}:c;if(_?.request){let H=v;v=(Y,V)=>{return L0({request:Y}).asyncFn(_.request,H)(Y,V)}}function f(H,...Y){let V=Y.length>1?dn(...Y):Y[0]||{};if(!V.waitUntil)V.waitUntil=b;let Q=zg(H,u,void 0,t);return v(Q,V)}function U(H,Y,...V){let Q=Y.raw||Y,M=V.length>1?dn(...V):V[0]||{};if(!M.waitUntil)M.waitUntil=b;let p=zg(H,u,Q,t);return v(p,M)}function z(H,Y,...V){let Q={req:H,res:Y,waitUntil:b};return Wo(zi().then(()=>U(H,Y,Q,...V)).catch((M)=>Dg(M,u.Response)).then((M)=>Cv(M,Y,H,r)).catch((M)=>console.error(`Unexpected error while handling request: ${M.message||M}`)))}function J(H,Y,...V){let Q={res:H,req:Y,waitUntil:b},p=V.filter((Ni)=>Ni!=null).length>0?dn(Q,...V):Q,li=t?Hg():new AbortController,Mi=H.end.bind(H),s=!1;H.end=function(Ni){return s=!0,Mi(Ni)},H.onAborted.bind(H)(function(){li.abort()}),H.onAborted=function(Ni){li.signal.addEventListener("abort",Ni,{once:!0})};let Di=dv({req:Y,res:H,fetchAPI:u,controller:li});return ji(()=>ji(()=>v(Di,p),(Ni)=>Ni,(Ni)=>Dg(Ni,u.Response)),(Ni)=>{if(!li.signal.aborted&&!s)return ji(()=>av(H,Ni,li,u),(di)=>di,(di)=>{console.error(`Unexpected error while handling request: ${di.message||di}`)})})}function N(H,...Y){if(!H.respondWith||!H.request)throw new TypeError(`Expected FetchEvent, got ${H}`);let V=Y.filter((p)=>p!=null),Q=V.length>0?dn({},H,...V):Jg(H),M=v(H.request,Q);H.respondWith(M)}function j(H,...Y){let V=Y.filter((M)=>M!=null),Q=V.length>1?dn({},...V):Jg(V[0],V[0]==null||V[0].waitUntil==null?b:void 0);return v(H,Q)}let O=(H,...Y)=>{if(typeof H==="string"||"href"in H){let[Q,...M]=Y;if(Rv(Q)){let li=new u.Request(H,Q),Mi=j(li,...M),s=Q.signal;if(s)return Eg(Mi,s);return Mi}let p=new u.Request(H);return j(p,...Y)}let V=j(H,...Y);return Eg(V,H.signal)},W=(H,...Y)=>{let[V,...Q]=Y;if(Tv(H)){if(!Wg(V))throw new TypeError(`Expected ServerResponse, got ${V}`);return z(H,V,...Q)}if(pv(H))return J(H,V,...Q);if(Wg(V))throw new TypeError("Got Node response without Node request");if(uW(H)){if(kv(H))return N(H,...Y);return j(H.request,H,...Y)}return O(H,...Y)},E={handleRequest:j,fetch:O,handleNodeRequest:f,handleNodeRequestAndResponse:U,requestListener:z,handleEvent:N,handleUWS:J,handle:W,get disposableStack(){return w()},[Ji.asyncDispose](){if($&&!$.disposed)return $.disposeAsync();return zi()},dispose(){if($&&!$.disposed)return $.disposeAsync();return zi()},waitUntil:b},X=new Proxy(W,{has:(H,Y)=>{return Y in E||Y in W||i&&Y in i},get:(H,Y)=>{if(globalThis.Deno||Y===Symbol.asyncDispose||Y===Symbol.dispose){let M=Reflect.get(E,Y,E);if(M)return M}let V=E[Y];if(V){if(V.bind)return V.bind(E);return V}let Q=W[Y];if(Q){if(Q.bind)return Q.bind(W);return Q}if(i){let M=i[Y];if(M){if(M.bind)return function(...p){let li=i[Y](...p);if(li===i)return X;return li};return M}}},apply(H,Y,V){return W(...V)}});return X}class Ru{baseURL;authToken;constructor(i){this.baseURL=i?.baseURL??"https://blink.so",this.authToken=i?.authToken}async deleteStorage(i){let n=await this.request("DELETE",`/api/agents/me/storage/${encodeURIComponent(i)}`);await this.assertResponseStatus(n,204)}async setStorage(i,n,r){let u=new URLSearchParams;if(r?.ttl)u.set("ttl",r.ttl.toString());let t=await this.request("PUT",`/api/agents/me/storage/${encodeURIComponent(i)}?${u.toString()}`,n);await this.assertResponseStatus(t,204)}async getStorage(i){let n=await this.request("GET",`/api/agents/me/storage/${encodeURIComponent(i)}`);if(n.status===404)return;return await this.assertResponseStatus(n,200),await n.text()}async listStorage(i,n){let r=await this.request("GET","/api/agents/me/storage",JSON.stringify({prefix:i,limit:n?.limit,cursor:n?.cursor}));return await this.assertResponseStatus(r,200),await r.json()}async upsertChat(i){let n=await this.request("PUT",`/api/agents/me/chats/${encodeURIComponent(i)}`);if(n.status!==200&&n.status!==204)await this.assertResponseStatus(n,200);return await n.json()}async sendMessages(i,n){let r=await this.request("POST",`/api/agents/me/chats/${encodeURIComponent(i)}/messages`,JSON.stringify(n));await this.assertResponseStatus(r,204)}async getChat(i){let n=await this.request("GET",`/api/agents/me/chats/${encodeURIComponent(i)}`);if(n.status===404)return;return await this.assertResponseStatus(n,200),await n.json()}async deleteChat(i){let n=await this.request("DELETE",`/api/agents/me/chats/${encodeURIComponent(i)}`);await this.assertResponseStatus(n,204)}async startChat(i){let n=await this.request("POST",`/api/agents/me/chats/${encodeURIComponent(i)}/start`);await this.assertResponseStatus(n,204)}async stopChat(i){let n=await this.request("POST",`/api/agents/me/chats/${encodeURIComponent(i)}/stop`);await this.assertResponseStatus(n,204)}async getMessages(i){let n=await this.request("GET",`/api/agents/me/chats/${encodeURIComponent(i)}/messages`);return await this.assertResponseStatus(n,200),await n.json()}async deleteMessages(i,n){let r=await this.request("POST",`/api/agents/me/chats/${encodeURIComponent(i)}/messages/delete`,JSON.stringify({message_ids:n}));await this.assertResponseStatus(r,204)}async proxyOtlpTraces(i){if(!this.authToken){if((i.headers.get("content-type")?.toLowerCase()||"").includes("application/x-protobuf"))return new Response(new Uint8Array(0),{status:200,headers:{"Content-Type":"application/x-protobuf"}});return new Response(JSON.stringify({}),{status:200,headers:{"Content-Type":"application/json"}})}let n=new Set(["transfer-encoding","content-length","host","connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","upgrade"]),r={};return i.headers.forEach((u,t)=>{if(n.has(t.toLowerCase()))return;r[t]=u}),this.request(i.method,"/api/otlp/v1/traces",i.body??void 0,{headers:r})}async assertResponseStatus(i,n){if(i.status===n)return;let r=await i.text();try{let u=JSON.parse(r);if(u.error)throw new Error(u.error);throw new Error(r)}catch(u){throw new Error(`Expected status ${n}, got ${i.status}: ${r}`)}}request(i,n,r,u){let t=new URL(n,this.baseURL),c=new Headers;if(this.authToken)c.set("Authorization",`Bearer ${this.authToken}`);if(typeof r==="string")c.set("Content-Type","application/json");if(u?.headers)for(let[h,_]of Object.entries(u.headers))c.set(h,_);let g;if(u?.timeout)g=AbortSignal.timeout(u.timeout);return fetch(t.toString(),{method:i,headers:c,body:r,signal:g,duplex:r?"half":void 0})}}var Xg=(i)=>{let n=i.split("/");return n[0]===""&&n.shift(),n},sv=(i)=>{let{groups:n,path:r}=oW(i),u=Xg(r);return gW(u,n)},oW=(i)=>{let n=[];return i=i.replace(/\\{[^}]+\\}/g,(r,u)=>{let t=`@${u}`;return n.push([t,r]),t}),{groups:n,path:i}},gW=(i,n)=>{for(let r=n.length-1;r>=0;r--){let[u]=n[r];for(let t=i.length-1;t>=0;t--)if(i[t].includes(u)){i[t]=i[t].replace(u,n[r][1]);break}}return i},Zu={},nf=(i,n)=>{if(i==="*")return"*";let r=i.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);if(r){let u=`${i}#${n}`;return Zu[u]||(r[2]?Zu[u]=n&&n[0]!==":"&&n[0]!=="*"?[u,r[1],RegExp(`^${r[2]}(?=/${n})`)]:[i,r[1],RegExp(`^${r[2]}$`)]:Zu[u]=[i,r[1],!0]),Zu[u]}return null},ir=(i,n)=>{try{return n(i)}catch{return i.replace(/(?:%[0-9A-Fa-f]{2})+/g,(r)=>{try{return n(r)}catch{return r}})}},hW=(i)=>ir(i,decodeURI),Lg=(i)=>{let n=i.url,r=n.indexOf("/",n.indexOf(":")+4),u=r;for(;u{let n=Lg(i);return n.length>1&&n.at(-1)==="/"?n.slice(0,-1):n},an=(i,n,...r)=>(r.length&&(n=an(n,...r)),`${i?.[0]==="/"?"":"/"}${i}${n==="/"?"":`${i?.at(-1)==="/"?"":"/"}${n?.[0]==="/"?n.slice(1):n}`}`),Ig=(i)=>{if(i.charCodeAt(i.length-1)!==63||!i.includes(":"))return null;let n=i.split("/"),r=[],u="";return n.forEach((t)=>{if(t!==""&&!/\\:/.test(t))u+="/"+t;else if(/\\:/.test(t))if(/\\?/.test(t)){r.length===0&&u===""?r.push("/"):r.push(u);let c=t.replace("?","");u+="/"+c,r.push(u)}else u+="/"+t}),r.filter((t,c,g)=>g.indexOf(t)===c)},qg=(i)=>/[%+]/.test(i)?(i.indexOf("+")!==-1&&(i=i.replace(/\\+/g," ")),i.indexOf("%")===-1?i:ir(i,eu)):i,rf=(i,n,r)=>{let u;if(!r&&n&&!/[%+]/.test(n)){let g=i.indexOf(`?${n}`,8);for(g===-1&&(g=i.indexOf(`&${n}`,8));g!==-1;){let h=i.charCodeAt(g+n.length+1);if(h===61){let _=g+n.length+2,l=i.indexOf("&",_);return qg(i.slice(_,l===-1?void 0:l))}else if(h==38||isNaN(h))return"";g=i.indexOf(`&${n}`,g+1)}if(u=/[%+]/.test(i),!u)return}let t={};u??=/[%+]/.test(i);let c=i.indexOf("?",8);for(;c!==-1;){let g=i.indexOf("&",c+1),h=i.indexOf("=",c);h>g&&g!==-1&&(h=-1);let _=i.slice(c+1,h===-1?g===-1?void 0:g:h);if(u&&(_=qg(_)),c=g,_==="")continue;let l;h===-1?l="":(l=i.slice(h+1,g===-1?void 0:g),u&&(l=qg(l))),r?(t[_]&&Array.isArray(t[_])||(t[_]=[]),t[_].push(l)):t[_]??=l}return n?t[n]:t},uf=rf,cf=(i,n)=>rf(i,n,!0),eu=decodeURIComponent,_W=/^[\\w!#$%&\'*.^`|~+-]+$/,lW=/^[ !#-:<-[\\]-~]*$/,Yg=(i,n)=>{if(n&&i.indexOf(n)===-1)return{};let r=i.trim().split(";"),u={};for(let t of r){t=t.trim();let c=t.indexOf("=");if(c===-1)continue;let g=t.substring(0,c).trim();if(n&&n!==g||!_W.test(g))continue;let h=t.substring(c+1).trim();if(h.startsWith(\'"\')&&h.endsWith(\'"\')&&(h=h.slice(1,-1)),lW.test(h)&&(u[g]=h.indexOf("%")===-1?h:ir(h,eu),n))break}return u};var of=(i,n,r)=>(u,t)=>{let c=-1;return g(0);async function g(h){if(h<=c)throw Error("next() called multiple times");c=h;let _,l=!1,$;if(i[h]?($=i[h][0][0],u.req.routeIndex=h):$=h===i.length&&t||void 0,$)try{_=await $(u,()=>g(h+1))}catch(w){if(w instanceof Error&&n)u.error=w,_=await n(w,u),l=!0;else throw w}else u.finalized===!1&&r&&(_=await r(u));return _&&(u.finalized===!1||l)&&(u.res=_),u}},$W=Symbol(),wW=async(i,n=Object.create(null))=>{let{all:r=!1,dot:u=!1}=n,t=(i instanceof lf?i.raw.headers:i.headers).get("Content-Type");return t?.startsWith("multipart/form-data")||t?.startsWith("application/x-www-form-urlencoded")?bW(i,{all:r,dot:u}):{}};async function bW(i,n){let r=await i.formData();return r?vW(r,n):{}}function vW(i,n){let r=Object.create(null);return i.forEach((u,t)=>{n.all||t.endsWith("[]")?fW(r,t,u):r[t]=u}),n.dot&&Object.entries(r).forEach(([u,t])=>{u.includes(".")&&(OW(r,u,t),delete r[u])}),r}var fW=(i,n,r)=>{i[n]===void 0?n.endsWith("[]")?i[n]=[r]:i[n]=r:Array.isArray(i[n])?i[n].push(r):i[n]=[i[n],r]},OW=(i,n,r)=>{let u=i,t=n.split(".");t.forEach((c,g)=>{g===t.length-1?u[c]=r:((!u[c]||typeof u[c]!="object"||Array.isArray(u[c])||u[c]instanceof File)&&(u[c]=Object.create(null)),u=u[c])})},gf=(i)=>ir(i,eu),lf=class{raw;#n;#i;routeIndex=0;path;bodyCache={};constructor(i,n="/",r=[[]]){this.raw=i,this.path=n,this.#i=r,this.#n={}}param(i){return i?this.#r(i):this.#t()}#r(i){let n=this.#i[0][this.routeIndex][1][i],r=this.#u(n);return r&&/\\%/.test(r)?gf(r):r}#t(){let i={},n=Object.keys(this.#i[0][this.routeIndex][1]);for(let r of n){let u=this.#u(this.#i[0][this.routeIndex][1][r]);u!==void 0&&(i[r]=/\\%/.test(u)?gf(u):u)}return i}#u(i){return this.#i[1]?this.#i[1][i]:i}query(i){return uf(this.url,i)}queries(i){return cf(this.url,i)}header(i){if(i)return this.raw.headers.get(i)??void 0;let n={};return this.raw.headers.forEach((r,u)=>{n[u]=r}),n}async parseBody(i){return this.bodyCache.parsedBody??=await wW(this,i)}#c=(i)=>{let{bodyCache:n,raw:r}=this,u=n[i];if(u)return u;let t=Object.keys(n)[0];return t?n[t].then((c)=>(t==="json"&&(c=JSON.stringify(c)),new Response(c)[i]())):n[i]=r[i]()};json(){return this.#c("text").then((i)=>JSON.parse(i))}text(){return this.#c("text")}arrayBuffer(){return this.#c("arrayBuffer")}blob(){return this.#c("blob")}formData(){return this.#c("formData")}addValidatedData(i,n){this.#n[i]=n}valid(i){return this.#n[i]}get url(){return this.raw.url}get method(){return this.raw.method}get[$W](){return this.#i}get matchedRoutes(){return this.#i[0].map(([[,i]])=>i)}get routePath(){return this.#i[0].map(([[,i]])=>i)[this.routeIndex].path}},jW={Stringify:1,BeforeStream:2,Stream:3},UW=(i,n)=>{let r=new String(i);return r.isEscaped=!0,r.callbacks=n,r},$f=async(i,n,r,u,t)=>{typeof i=="object"&&!(i instanceof String)&&(i instanceof Promise||(i=i.toString()),i instanceof Promise&&(i=await i));let c=i.callbacks;if(!c?.length)return Promise.resolve(i);t?t[0]+=i:t=[i];let g=Promise.all(c.map((h)=>h({phase:n,buffer:t,context:u}))).then((h)=>Promise.all(h.filter(Boolean).map((_)=>$f(_,n,!1,u,t))).then(()=>t[0]));return r?UW(await g,c):g},NW="text/plain; charset=UTF-8",Qg=(i,n)=>({"Content-Type":i,...n}),zW=class{#n;#i;env={};#r;finalized=!1;error;#t;#u;#c;#g;#w;#b;#l;#o;#O;constructor(i,n){this.#n=i,n&&(this.#u=n.executionCtx,this.env=n.env,this.#b=n.notFoundHandler,this.#O=n.path,this.#o=n.matchResult)}get req(){return this.#i??=new lf(this.#n,this.#O,this.#o),this.#i}get event(){if(this.#u&&"respondWith"in this.#u)return this.#u;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#u)return this.#u;throw Error("This context has no ExecutionContext")}get res(){return this.#c||=new Response(null,{headers:this.#l??=new Headers})}set res(i){if(this.#c&&i){i=new Response(i.body,i);for(let[n,r]of this.#c.headers.entries())if(n!=="content-type")if(n==="set-cookie"){let u=this.#c.headers.getSetCookie();i.headers.delete("set-cookie");for(let t of u)i.headers.append("set-cookie",t)}else i.headers.set(n,r)}this.#c=i,this.finalized=!0}render=(...i)=>(this.#w??=(n)=>this.html(n),this.#w(...i));setLayout=(i)=>this.#g=i;getLayout=()=>this.#g;setRenderer=(i)=>{this.#w=i};header=(i,n,r)=>{this.finalized&&(this.#c=new Response(this.#c.body,this.#c));let u=this.#c?this.#c.headers:this.#l??=new Headers;n===void 0?u.delete(i):r?.append?u.append(i,n):u.set(i,n)};status=(i)=>{this.#t=i};set=(i,n)=>{this.#r??=new Map,this.#r.set(i,n)};get=(i)=>this.#r?this.#r.get(i):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#$(i,n,r){let u=this.#c?new Headers(this.#c.headers):this.#l??new Headers;if(typeof n=="object"&&"headers"in n){let c=n.headers instanceof Headers?n.headers:new Headers(n.headers);for(let[g,h]of c)g.toLowerCase()==="set-cookie"?u.append(g,h):u.set(g,h)}if(r)for(let[c,g]of Object.entries(r))if(typeof g=="string")u.set(c,g);else{u.delete(c);for(let h of g)u.append(c,h)}let t=typeof n=="number"?n:n?.status??this.#t;return new Response(i,{status:t,headers:u})}newResponse=(...i)=>this.#$(...i);body=(i,n,r)=>this.#$(i,n,r);text=(i,n,r)=>!this.#l&&!this.#t&&!n&&!r&&!this.finalized?new Response(i):this.#$(i,n,Qg(NW,r));json=(i,n,r)=>this.#$(JSON.stringify(i),n,Qg("application/json",r));html=(i,n,r)=>{let u=(t)=>this.#$(t,n,Qg("text/html; charset=UTF-8",r));return typeof i=="object"?$f(i,jW.Stringify,!1,{}).then(u):u(i)};redirect=(i,n)=>{let r=String(i);return this.header("Location",/[^\\x00-\\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,n??302)};notFound=()=>(this.#b??=()=>new Response,this.#b(this))},bi="ALL",WW="all",DW=["get","post","put","delete","options","patch"],wf="Can not add a route since the matcher is already built.",bf=class extends Error{},JW="__COMPOSED_HANDLER",EW=(i)=>i.text("404 Not Found",404),hf=(i,n)=>{if("getResponse"in i){let r=i.getResponse();return n.newResponse(r.body,r)}return console.error(i),n.text("Internal Server Error",500)},vf=class{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#n="/";routes=[];constructor(i={}){[...DW,WW].forEach((u)=>{this[u]=(t,...c)=>(typeof t=="string"?this.#n=t:this.#t(u,this.#n,t),c.forEach((g)=>{this.#t(u,this.#n,g)}),this)}),this.on=(u,t,...c)=>{for(let g of[t].flat()){this.#n=g;for(let h of[u].flat())c.map((_)=>{this.#t(h.toUpperCase(),this.#n,_)})}return this},this.use=(u,...t)=>(typeof u=="string"?this.#n=u:(this.#n="*",t.unshift(u)),t.forEach((c)=>{this.#t(bi,this.#n,c)}),this);let{strict:n,...r}=i;Object.assign(this,r),this.getPath=n??!0?i.getPath??Lg:tf}#i(){let i=new vf({router:this.router,getPath:this.getPath});return i.errorHandler=this.errorHandler,i.#r=this.#r,i.routes=this.routes,i}#r=EW;errorHandler=hf;route(i,n){let r=this.basePath(i);return n.routes.map((u)=>{let t;n.errorHandler===hf?t=u.handler:(t=async(c,g)=>(await of([],n.errorHandler)(c,()=>u.handler(c,g))).res,t[JW]=u.handler),r.#t(u.method,u.path,t)}),this}basePath(i){let n=this.#i();return n._basePath=an(this._basePath,i),n}onError=(i)=>(this.errorHandler=i,this);notFound=(i)=>(this.#r=i,this);mount(i,n,r){let u,t;r&&(typeof r=="function"?t=r:(t=r.optionHandler,u=r.replaceRequest===!1?(g)=>g:r.replaceRequest));let c=t?(g)=>{let h=t(g);return Array.isArray(h)?h:[h]}:(g)=>{let h;try{h=g.executionCtx}catch{}return[g.env,h]};return u||=(()=>{let g=an(this._basePath,i),h=g==="/"?0:g.length;return(_)=>{let l=new URL(_.url);return l.pathname=l.pathname.slice(h)||"/",new Request(l,_)}})(),this.#t(bi,an(i,"*"),async(g,h)=>{let _=await n(u(g.req.raw),...c(g));if(_)return _;await h()}),this}#t(i,n,r){i=i.toUpperCase(),n=an(this._basePath,n);let u={basePath:this._basePath,path:n,method:i,handler:r};this.router.add(i,n,[r,u]),this.routes.push(u)}#u(i,n){if(i instanceof Error)return this.errorHandler(i,n);throw i}#c(i,n,r,u){if(u==="HEAD")return(async()=>new Response(null,await this.#c(i,n,r,"GET")))();let t=this.getPath(i,{env:r}),c=this.router.match(u,t),g=new zW(i,{path:t,matchResult:c,env:r,executionCtx:n,notFoundHandler:this.#r});if(c[0].length===1){let _;try{_=c[0][0][0][0](g,async()=>{g.res=await this.#r(g)})}catch(l){return this.#u(l,g)}return _ instanceof Promise?_.then((l)=>l||(g.finalized?g.res:this.#r(g))).catch((l)=>this.#u(l,g)):_??this.#r(g)}let h=of(c[0],this.errorHandler,this.#r);return(async()=>{try{let _=await h(g);if(!_.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return _.res}catch(_){return this.#u(_,g)}})()}fetch=(i,...n)=>this.#c(i,n[1],n[0],i.method);request=(i,n,r,u)=>i instanceof Request?this.fetch(n?new Request(i,n):i,r,u):(i=i.toString(),this.fetch(new Request(/^https?:\\/\\//.test(i)?i:`http://localhost${an("/",i)}`,n),r,u));fire=()=>{addEventListener("fetch",(i)=>{i.respondWith(this.#c(i.request,i,void 0,i.request.method))})}},pu="[^/]+",rr=".*",ur="(?:|/.*)",tr=Symbol(),HW=new Set(".\\\\+*[^]$()");function GW(i,n){return i.length===1?n.length===1?iw!==rr&&w!==ur))throw tr;if(t)return;_=this.#r[$]=new Sg,l!==""&&(_.#i=u.varIndex++)}!t&&l!==""&&r.push([l,_.#i])}else if(_=this.#r[c],!_){if(Object.keys(this.#r).some((l)=>l.length>1&&l!==rr&&l!==ur))throw tr;if(t)return;_=this.#r[c]=new Sg}_.insert(g,n,r,u,t)}buildRegExpStr(){let i=Object.keys(this.#r).sort(GW).map((n)=>{let r=this.#r[n];return(typeof r.#i=="number"?`(${n})@${r.#i}`:HW.has(n)?`\\\\${n}`:n)+r.buildRegExpStr()});return typeof this.#n=="number"&&i.unshift(`#${this.#n}`),i.length===0?"":i.length===1?i[0]:"(?:"+i.join("|")+")"}},qW=class{#n={varIndex:0};#i=new Sg;insert(i,n,r){let u=[],t=[];for(let g=0;;){let h=!1;if(i=i.replace(/\\{[^}]+\\}/g,(_)=>{let l=`@\\\\${g}`;return t[g]=[l,_],g++,h=!0,l}),!h)break}let c=i.match(/(?::[^\\/]+)|(?:\\/\\*$)|./g)||[];for(let g=t.length-1;g>=0;g--){let[h]=t[g];for(let _=c.length-1;_>=0;_--)if(c[_].indexOf(h)!==-1){c[_]=c[_].replace(h,t[g][1]);break}}return this.#i.insert(c,n,u,this.#n,r),u}buildRegExp(){let i=this.#i.buildRegExpStr();if(i==="")return[/^$/,[],[]];let n=0,r=[],u=[];return i=i.replace(/#(\\d+)|@(\\d+)|\\.\\*\\$/g,(t,c,g)=>c===void 0?(g===void 0||(u[Number(g)]=++n),""):(r[++n]=Number(c),"$()")),[RegExp(`^${i}`),r,u]}},ff=[],XW=[/^$/,[],Object.create(null)],Of=Object.create(null);function jf(i){return Of[i]??=RegExp(i==="*"?"":`^${i.replace(/\\/\\*$|([.\\\\+*[^\\]$()])/g,(n,r)=>r?`\\\\${r}`:"(?:|/.*)")}$`)}function LW(){Of=Object.create(null)}function IW(i){let n=new qW,r=[];if(i.length===0)return XW;let u=i.map((l)=>[!/\\*|\\/:/.test(l[0]),...l]).sort(([l,$],[w,b])=>l?1:w?-1:$.length-b.length),t=Object.create(null);for(let l=0,$=-1,w=u.length;l[z,Object.create(null)]),ff]:$++;let U;try{U=n.insert(v,$,b)}catch(z){throw z===tr?new bf(v):z}b||(r[$]=f.map(([z,J])=>{let N=Object.create(null);for(--J;J>=0;J--){let[j,O]=U[J];N[j]=O}return[z,N]}))}let[c,g,h]=n.buildRegExp();for(let l=0,$=r.length;l<$;l++)for(let w=0,b=r[l].length;wt.length-u.length))if(jf(r).test(n))return[...i[r]]}}var YW=class{name="RegExpRouter";#n;#i;constructor(){this.#n={[bi]:Object.create(null)},this.#i={[bi]:Object.create(null)}}add(i,n,r){let u=this.#n,t=this.#i;if(!u||!t)throw Error(wf);u[i]||[u,t].forEach((h)=>{h[i]=Object.create(null),Object.keys(h[bi]).forEach((_)=>{h[i][_]=[...h[bi][_]]})}),n==="/*"&&(n="*");let c=(n.match(/\\/:/g)||[]).length;if(/\\*$/.test(n)){let h=jf(n);i===bi?Object.keys(u).forEach((_)=>{u[_][n]||=Dt(u[_],n)||Dt(u[bi],n)||[]}):u[i][n]||=Dt(u[i],n)||Dt(u[bi],n)||[],Object.keys(u).forEach((_)=>{(i===bi||i===_)&&Object.keys(u[_]).forEach((l)=>{h.test(l)&&u[_][l].push([r,c])})}),Object.keys(t).forEach((_)=>{(i===bi||i===_)&&Object.keys(t[_]).forEach((l)=>h.test(l)&&t[_][l].push([r,c]))});return}let g=Ig(n)||[n];for(let h=0,_=g.length;h<_;h++){let l=g[h];Object.keys(t).forEach(($)=>{(i===bi||i===$)&&(t[$][l]||=[...Dt(u[$],l)||Dt(u[bi],l)||[]],t[$][l].push([r,c-_+h+1]))})}}match(i,n){LW();let r=this.#r();return this.match=(u,t)=>{let c=r[u]||r[bi],g=c[2][t];if(g)return g;let h=t.match(c[0]);if(!h)return[[],ff];let _=h.indexOf("",1);return[c[1][_],h]},this.match(i,n)}#r(){let i=Object.create(null);return Object.keys(this.#i).concat(Object.keys(this.#n)).forEach((n)=>{i[n]||=this.#t(n)}),this.#n=this.#i=void 0,i}#t(i){let n=[],r=i===bi;return[this.#n,this.#i].forEach((u)=>{let t=u[i]?Object.keys(u[i]).map((c)=>[c,u[i][c]]):[];t.length===0?i!==bi&&n.push(...Object.keys(u[bi]).map((c)=>[c,u[bi][c]])):(r||=!0,n.push(...t))}),r?IW(n):null}},QW=class{name="SmartRouter";#n=[];#i=[];constructor(i){this.#n=i.routers}add(i,n,r){if(!this.#i)throw Error(wf);this.#i.push([i,n,r])}match(i,n){if(!this.#i)throw Error("Fatal error");let r=this.#n,u=this.#i,t=r.length,c=0,g;for(;c_.indexOf(g)===h),score:this.#t}}),u}#c(i,n,r,u){let t=[];for(let c=0,g=i.#n.length;c1&&r.sort((g,h)=>g.score-h.score),[r.map(({handler:g,params:h})=>[g,h])]}},mW=class{name="TrieRouter";#n;constructor(){this.#n=new Uf}add(i,n,r){let u=Ig(n);if(u){for(let t=0,c=u.length;t{let u=i.req.raw.headers.get("Cookie");if(typeof n=="string"){if(!u)return;let t=n;return r==="secure"?t="__Secure-"+n:r==="host"&&(t="__Host-"+n),Yg(u,t)[t]}return u?Yg(u):{}},_f=class extends Error{res;status;constructor(i=500,n){super(n?.message,{cause:n?.cause}),this.res=n?.res,this.status=i}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},AW=(i,n)=>new Response(i,{headers:{"Content-Type":n}}).formData(),BW=/^application\\/([a-z-\\.]+\\+)?json(;\\s*[a-zA-Z0-9\\-]+\\=([^;]+))*$/,KW=/^multipart\\/form-data(;\\s?boundary=[a-zA-Z0-9\'"()+_,\\-./:=?]+)?$/,VW=/^application\\/x-www-form-urlencoded(;\\s*[a-zA-Z0-9\\-]+\\=([^;]+))*$/,du=(i,n)=>async(r,u)=>{let t={},c=r.req.header("Content-Type");switch(i){case"json":if(!c||!BW.test(c))break;try{t=await r.req.json()}catch{throw new _f(400,{message:"Malformed JSON in request body"})}break;case"form":{if(!c||!(KW.test(c)||VW.test(c)))break;let h;if(r.req.bodyCache.formData)h=await r.req.bodyCache.formData;else try{let l=await r.req.arrayBuffer();h=await AW(l,c),r.req.bodyCache.formData=h}catch(l){let $="Malformed FormData request.";throw $+=l instanceof Error?` ${l.message}`:` ${String(l)}`,new _f(400,{message:$})}let _={};h.forEach((l,$)=>{$.endsWith("[]")?(_[$]??=[]).push(l):Array.isArray(_[$])?_[$].push(l):($ in _)?_[$]=[_[$],l]:_[$]=l}),t=_;break}case"query":t=Object.fromEntries(Object.entries(r.req.queries()).map(([h,_])=>_.length===1?[h,_[0]]:[h,_]));break;case"param":t=r.req.param();break;case"header":t=r.req.header();break;case"cookie":t=SW(r);break}let g=await n(t,r);if(g instanceof Response)return g;r.req.addValidatedData(i,g),await u()},An=(i,n)=>i.json({error:n},400),mg=(i)=>{let n=i.req.param("key");return!n||n===""?{key:n,err:"Key is required"}:n.length>475?{key:n,err:"Key is too long. Max length is 475 characters."}:{key:n}},Ag=()=>new Nf,MW=Ag().get("/:key",async(i)=>{let{key:n,err:r}=mg(i);if(r)return An(i,r);let u=await i.env.store.get(n);return i.json({value:u},200)}).post("/:key",du("json",(i,n)=>{let r=i.value;return r?typeof r=="string"?r.length>20000?An(n,"Value is too long. Max length is 20,000 characters."):{value:r}:An(n,"Value must be a string"):An(n,"Value is required")}),async(i)=>{let{key:n,err:r}=mg(i);if(r)return An(i,r);let{value:u}=i.req.valid("json");return await i.env.store.set(n,u),i.body(null,204)}).delete("/:key",async(i)=>{let{key:n,err:r}=mg(i);return r?An(i,r):(await i.env.store.delete(n),i.body(null,204))}).get("/",async(i)=>{let{cursor:n,limit:r,prefix:u}=i.req.query(),{entries:t,cursor:c}=await i.env.store.list(u,{cursor:n?String(n):void 0,limit:r?Number(r):100});return i.json({entries:t,cursor:c})}),xW=(i)=>{let n=i.req.param("key");return n?n.length>475?{key:n,err:"Key is too long. Max length is 475 characters."}:{key:n}:{key:n,err:"Key is required"}},Jt=du("param",(i)=>({id:i.id})),FW=Ag().post("/:key",async(i)=>{let{key:n,err:r}=xW(i);return r?An(i,r):i.json(await i.env.chat.upsert(n),200)}).get("/:id",Jt,async(i)=>{let{id:n}=i.req.valid("param");return i.json(await i.env.chat.get(n),200)}).get("/:id/messages",Jt,async(i)=>{let{id:n}=i.req.valid("param");return i.json(await i.env.chat.getMessages(n),200)}).post("/:id/sendMessages",du("json",(i)=>({id:i.id,messages:i.messages,options:i.options})),async(i)=>{let{id:n,messages:r,options:u}=i.req.valid("json");return n?(await i.env.chat.sendMessages(n,r,u),i.body(null,204)):An(i,"ID is required")}).delete("/:id/messages",Jt,du("query",(i)=>(typeof i.message=="string"&&(i.message=[i.message]),{messages:i.message})),async(i)=>{let{id:n}=i.req.valid("param"),{messages:r}=i.req.valid("query");return await i.env.chat.deleteMessages(n,r),i.body(null,204)}).post("/:id/start",Jt,async(i)=>{let{id:n}=i.req.valid("param");return await i.env.chat.start(n),i.body(null,204)}).post("/:id/stop",Jt,async(i)=>{let{id:n}=i.req.valid("param");return await i.env.chat.stop(n),i.body(null,204)}).delete("/:id",Jt,async(i)=>{let{id:n}=i.req.valid("param");return await i.env.chat.delete(n),i.body(null,204)}),PW=Ag().post("/v1/traces",async(i)=>i.env.otlp?i.env.otlp.traces(i.req.raw):i.body(null,204)),zf=new Nf().onError((i,n)=>n.json({error:i instanceof Error?i.message:"Unknown error"},500)).route("/kv",MW).route("/chat",FW).route("/otlp",PW);var Wf="vercel.ai.error",yW=Symbol.for(Wf),Df,TW=class i extends Error{constructor({name:n,message:r,cause:u}){super(r);this[Df]=!0,this.name=n,this.cause=u}static isInstance(n){return i.hasMarker(n,Wf)}static hasMarker(n,r){let u=Symbol.for(r);return n!=null&&typeof n==="object"&&u in n&&typeof n[u]==="boolean"&&n[u]===!0}};Df=yW;var xi=TW,kW="AI_APICallError",CW=`vercel.ai.error.${kW}`,RW=Symbol.for(CW),ZW;ZW=RW;var eW="AI_EmptyResponseBodyError",pW=`vercel.ai.error.${eW}`,dW=Symbol.for(pW),aW;aW=dW;function au(i){if(i==null)return"unknown error";if(typeof i==="string")return i;if(i instanceof Error)return i.message;return JSON.stringify(i)}var Jf="AI_InvalidArgumentError",Ef=`vercel.ai.error.${Jf}`,sW=Symbol.for(Ef),Hf,Gf=class extends xi{constructor({message:i,cause:n,argument:r}){super({name:Jf,message:i,cause:n});this[Hf]=!0,this.argument=r}static isInstance(i){return xi.hasMarker(i,Ef)}};Hf=sW;var iD="AI_InvalidPromptError",nD=`vercel.ai.error.${iD}`,tD=Symbol.for(nD),rD;rD=tD;var uD="AI_InvalidResponseDataError",cD=`vercel.ai.error.${uD}`,oD=Symbol.for(cD),gD;gD=oD;var qf="AI_JSONParseError",Xf=`vercel.ai.error.${qf}`,hD=Symbol.for(Xf),Lf,Bg=class extends xi{constructor({text:i,cause:n}){super({name:qf,message:`JSON parsing failed: Text: ${i}.\nError message: ${au(n)}`,cause:n});this[Lf]=!0,this.text=i}static isInstance(i){return xi.hasMarker(i,Xf)}};Lf=hD;var _D="AI_LoadAPIKeyError",lD=`vercel.ai.error.${_D}`,$D=Symbol.for(lD),wD;wD=$D;var bD="AI_LoadSettingError",vD=`vercel.ai.error.${bD}`,fD=Symbol.for(vD),OD;OD=fD;var jD="AI_NoContentGeneratedError",UD=`vercel.ai.error.${jD}`,ND=Symbol.for(UD),zD;zD=ND;var WD="AI_NoSuchModelError",DD=`vercel.ai.error.${WD}`,JD=Symbol.for(DD),ED;ED=JD;var HD="AI_TooManyEmbeddingValuesForCallError",GD=`vercel.ai.error.${HD}`,qD=Symbol.for(GD),XD;XD=qD;var If="AI_TypeValidationError",Yf=`vercel.ai.error.${If}`,LD=Symbol.for(Yf),Qf,ID=class i extends xi{constructor({value:n,cause:r}){super({name:If,message:`Type validation failed: Value: ${JSON.stringify(n)}.\nError message: ${au(r)}`,cause:r});this[Qf]=!0,this.value=n}static isInstance(n){return xi.hasMarker(n,Yf)}static wrap({value:n,cause:r}){return i.isInstance(r)&&r.value===n?r:new i({value:n,cause:r})}};Qf=LD;var sn=ID,YD="AI_UnsupportedFunctionalityError",QD=`vercel.ai.error.${YD}`,mD=Symbol.for(QD),SD;SD=mD;var o={};Xn(o,{xid:()=>IE,void:()=>pE,uuidv7:()=>JE,uuidv6:()=>DE,uuidv4:()=>WE,uuid:()=>zE,url:()=>EE,uppercase:()=>Xr,unknown:()=>kc,union:()=>sc,undefined:()=>ZE,ulid:()=>LE,uint64:()=>CE,uint32:()=>yE,tuple:()=>rH,trim:()=>Sr,treeifyError:()=>Zg,transform:()=>d$,toUpperCase:()=>Br,toLowerCase:()=>Ar,toJSONSchema:()=>Vr,templateLiteral:()=>wH,symbol:()=>RE,superRefine:()=>C4,success:()=>lH,stringbool:()=>OH,string:()=>G$,strictObject:()=>iH,startsWith:()=>Ir,size:()=>Hr,setErrorMap:()=>DH,set:()=>oH,safeParseAsync:()=>Mr,safeParse:()=>H$,registry:()=>Oc,regexes:()=>rt,regex:()=>Gr,refine:()=>k4,record:()=>z4,readonly:()=>M4,property:()=>$$,promise:()=>bH,prettifyError:()=>eg,preprocess:()=>UH,prefault:()=>Q4,positive:()=>g$,pipe:()=>Zc,partialRecord:()=>uH,parseAsync:()=>E$,parse:()=>J$,overwrite:()=>Un,optional:()=>Cc,object:()=>sE,number:()=>o4,nullish:()=>_H,nullable:()=>Rc,null:()=>$4,normalize:()=>mr,nonpositive:()=>_$,nonoptional:()=>m4,nonnegative:()=>l$,never:()=>pc,negative:()=>h$,nativeEnum:()=>gH,nanoid:()=>GE,nan:()=>$H,multipleOf:()=>ct,minSize:()=>ot,minLength:()=>Vn,mime:()=>Qr,maxSize:()=>qt,maxLength:()=>Xt,map:()=>cH,lte:()=>Fi,lt:()=>On,lowercase:()=>qr,looseObject:()=>nH,locales:()=>Dr,literal:()=>H4,length:()=>Lt,lazy:()=>P4,ksuid:()=>YE,keyof:()=>aE,jwt:()=>ME,json:()=>jH,iso:()=>yc,ipv6:()=>mE,ipv4:()=>QE,intersection:()=>U4,int64:()=>kE,int32:()=>PE,int:()=>q$,instanceof:()=>fH,includes:()=>Lr,guid:()=>NE,gte:()=>Yi,gt:()=>jn,globalRegistry:()=>rn,getErrorMap:()=>JH,function:()=>U$,formatError:()=>Or,float64:()=>FE,float32:()=>xE,flattenError:()=>fr,file:()=>hH,enum:()=>J4,endsWith:()=>Yr,emoji:()=>HE,email:()=>UE,e164:()=>VE,discriminatedUnion:()=>tH,date:()=>dE,custom:()=>vH,cuid2:()=>XE,cuid:()=>qE,core:()=>Nn,config:()=>$i,coerce:()=>n0,clone:()=>Si,cidrv6:()=>AE,cidrv4:()=>SE,check:()=>T4,catch:()=>B4,boolean:()=>g4,bigint:()=>TE,base64url:()=>KE,base64:()=>BE,array:()=>Z$,any:()=>eE,_default:()=>I4,_ZodString:()=>X$,ZodXID:()=>B$,ZodVoid:()=>v4,ZodUnknown:()=>R$,ZodUnion:()=>e$,ZodUndefined:()=>_4,ZodUUID:()=>zn,ZodURL:()=>I$,ZodULID:()=>A$,ZodType:()=>C,ZodTuple:()=>N4,ZodTransform:()=>q4,ZodTemplateLiteral:()=>x4,ZodSymbol:()=>h4,ZodSuccess:()=>S4,ZodStringFormat:()=>ni,ZodString:()=>ec,ZodSet:()=>D4,ZodRecord:()=>p$,ZodRealError:()=>It,ZodReadonly:()=>V4,ZodPromise:()=>y4,ZodPrefault:()=>Y4,ZodPipe:()=>i0,ZodOptional:()=>a$,ZodObject:()=>ac,ZodNumberFormat:()=>Yt,ZodNumber:()=>Fr,ZodNullable:()=>X4,ZodNull:()=>l4,ZodNonOptional:()=>s$,ZodNever:()=>b4,ZodNanoID:()=>Q$,ZodNaN:()=>K4,ZodMap:()=>W4,ZodLiteral:()=>E4,ZodLazy:()=>F4,ZodKSUID:()=>K$,ZodJWT:()=>k$,ZodIssueCode:()=>NH,ZodIntersection:()=>j4,ZodISOTime:()=>Fc,ZodISODuration:()=>Pc,ZodISODateTime:()=>Mc,ZodISODate:()=>xc,ZodIPv6:()=>M$,ZodIPv4:()=>V$,ZodGUID:()=>Tc,ZodFile:()=>G4,ZodError:()=>OE,ZodEnum:()=>xr,ZodEmoji:()=>Y$,ZodEmail:()=>L$,ZodE164:()=>T$,ZodDiscriminatedUnion:()=>O4,ZodDefault:()=>L4,ZodDate:()=>dc,ZodCustom:()=>io,ZodCatch:()=>A4,ZodCUID2:()=>S$,ZodCUID:()=>m$,ZodCIDRv6:()=>F$,ZodCIDRv4:()=>x$,ZodBoolean:()=>Pr,ZodBigIntFormat:()=>C$,ZodBigInt:()=>yr,ZodBase64URL:()=>y$,ZodBase64:()=>P$,ZodArray:()=>f4,ZodAny:()=>w4,NEVER:()=>WH,$output:()=>Yl,$input:()=>Ql,$brand:()=>Kg});var Nn={};Xn(Nn,{version:()=>kh,util:()=>S,treeifyError:()=>Zg,toJSONSchema:()=>Vr,toDotPath:()=>Af,safeParseAsync:()=>dg,safeParse:()=>pg,registry:()=>Oc,regexes:()=>rt,prettifyError:()=>eg,parseAsync:()=>uc,parse:()=>tc,locales:()=>Dr,isValidJWT:()=>sf,isValidBase64URL:()=>af,isValidBase64:()=>w_,globalRegistry:()=>rn,globalConfig:()=>cr,function:()=>U$,formatError:()=>Or,flattenError:()=>fr,config:()=>$i,clone:()=>Si,_xid:()=>Xc,_void:()=>r$,_uuidv7:()=>Wc,_uuidv6:()=>zc,_uuidv4:()=>Nc,_uuid:()=>Uc,_url:()=>Dc,_uppercase:()=>Xr,_unknown:()=>Gt,_union:()=>ZJ,_undefined:()=>sl,_ulid:()=>qc,_uint64:()=>dl,_uint32:()=>kl,_tuple:()=>w$,_trim:()=>Sr,_transform:()=>rE,_toUpperCase:()=>Br,_toLowerCase:()=>Ar,_templateLiteral:()=>wE,_symbol:()=>al,_success:()=>hE,_stringbool:()=>O$,_string:()=>ml,_startsWith:()=>Ir,_size:()=>Hr,_set:()=>sJ,_safeParseAsync:()=>oc,_safeParse:()=>cc,_regex:()=>Gr,_refine:()=>f$,_record:()=>dJ,_readonly:()=>$E,_property:()=>$$,_promise:()=>vE,_positive:()=>g$,_pipe:()=>lE,_parseAsync:()=>rc,_parse:()=>nc,_overwrite:()=>Un,_optional:()=>uE,_number:()=>Ml,_nullable:()=>cE,_null:()=>i$,_normalize:()=>mr,_nonpositive:()=>_$,_nonoptional:()=>gE,_nonnegative:()=>l$,_never:()=>t$,_negative:()=>h$,_nativeEnum:()=>nE,_nanoid:()=>Ec,_nan:()=>o$,_multipleOf:()=>ct,_minSize:()=>ot,_minLength:()=>Vn,_min:()=>Yi,_mime:()=>Qr,_maxSize:()=>qt,_maxLength:()=>Xt,_max:()=>Fi,_map:()=>aJ,_lte:()=>Fi,_lt:()=>On,_lowercase:()=>qr,_literal:()=>tE,_length:()=>Lt,_lazy:()=>bE,_ksuid:()=>Lc,_jwt:()=>Kc,_isoTime:()=>Kl,_isoDuration:()=>Vl,_isoDateTime:()=>Al,_isoDate:()=>Bl,_ipv6:()=>Yc,_ipv4:()=>Ic,_intersection:()=>pJ,_int64:()=>pl,_int32:()=>Tl,_int:()=>Fl,_includes:()=>Lr,_guid:()=>Er,_gte:()=>Yi,_gt:()=>jn,_float64:()=>yl,_float32:()=>Pl,_file:()=>b$,_enum:()=>iE,_endsWith:()=>Yr,_emoji:()=>Jc,_email:()=>jc,_e164:()=>Bc,_discriminatedUnion:()=>eJ,_default:()=>oE,_date:()=>u$,_custom:()=>v$,_cuid2:()=>Gc,_cuid:()=>Hc,_coercedString:()=>Sl,_coercedNumber:()=>xl,_coercedDate:()=>c$,_coercedBoolean:()=>Rl,_coercedBigint:()=>el,_cidrv6:()=>mc,_cidrv4:()=>Qc,_catch:()=>_E,_boolean:()=>Cl,_bigint:()=>Zl,_base64url:()=>Ac,_base64:()=>Sc,_array:()=>Kr,_any:()=>n$,JSONSchemaGenerator:()=>Vc,JSONSchema:()=>r4,Doc:()=>lc,$output:()=>Yl,$input:()=>Ql,$constructor:()=>D,$brand:()=>Kg,$ZodXID:()=>t_,$ZodVoid:()=>E_,$ZodUnknown:()=>Kn,$ZodUnion:()=>fc,$ZodUndefined:()=>z_,$ZodUUID:()=>Zh,$ZodURL:()=>ph,$ZodULID:()=>n_,$ZodType:()=>y,$ZodTuple:()=>ut,$ZodTransform:()=>A_,$ZodTemplateLiteral:()=>k_,$ZodSymbol:()=>N_,$ZodSuccess:()=>F_,$ZodStringFormat:()=>ii,$ZodString:()=>jr,$ZodSet:()=>Y_,$ZodRegistry:()=>Jr,$ZodRecord:()=>L_,$ZodRealError:()=>Et,$ZodReadonly:()=>T_,$ZodPromise:()=>C_,$ZodPrefault:()=>M_,$ZodPipe:()=>zr,$ZodOptional:()=>B_,$ZodObject:()=>G_,$ZodNumberFormat:()=>j_,$ZodNumber:()=>bc,$ZodNullable:()=>K_,$ZodNull:()=>W_,$ZodNonOptional:()=>x_,$ZodNever:()=>J_,$ZodNanoID:()=>ah,$ZodNaN:()=>y_,$ZodMap:()=>I_,$ZodLiteral:()=>m_,$ZodLazy:()=>R_,$ZodKSUID:()=>r_,$ZodJWT:()=>O_,$ZodIntersection:()=>X_,$ZodISOTime:()=>o_,$ZodISODuration:()=>g_,$ZodISODateTime:()=>u_,$ZodISODate:()=>c_,$ZodIPv6:()=>__,$ZodIPv4:()=>h_,$ZodGUID:()=>Rh,$ZodFunction:()=>j$,$ZodFile:()=>S_,$ZodError:()=>vr,$ZodEnum:()=>Q_,$ZodEmoji:()=>dh,$ZodEmail:()=>eh,$ZodE164:()=>f_,$ZodDiscriminatedUnion:()=>q_,$ZodDefault:()=>V_,$ZodDate:()=>H_,$ZodCustom:()=>Z_,$ZodCheckUpperCase:()=>Vh,$ZodCheckStringFormat:()=>Ht,$ZodCheckStartsWith:()=>xh,$ZodCheckSizeEquals:()=>Qh,$ZodCheckRegex:()=>Bh,$ZodCheckProperty:()=>Ph,$ZodCheckOverwrite:()=>Th,$ZodCheckNumberFormat:()=>Xh,$ZodCheckMultipleOf:()=>qh,$ZodCheckMinSize:()=>Yh,$ZodCheckMinLength:()=>Sh,$ZodCheckMimeType:()=>yh,$ZodCheckMaxSize:()=>Ih,$ZodCheckMaxLength:()=>mh,$ZodCheckLowerCase:()=>Kh,$ZodCheckLessThan:()=>hc,$ZodCheckLengthEquals:()=>Ah,$ZodCheckIncludes:()=>Mh,$ZodCheckGreaterThan:()=>_c,$ZodCheckEndsWith:()=>Fh,$ZodCheckBigIntFormat:()=>Lh,$ZodCheck:()=>ui,$ZodCatch:()=>P_,$ZodCUID2:()=>i_,$ZodCUID:()=>sh,$ZodCIDRv6:()=>$_,$ZodCIDRv4:()=>l_,$ZodBoolean:()=>Ur,$ZodBigIntFormat:()=>U_,$ZodBigInt:()=>vc,$ZodBase64URL:()=>v_,$ZodBase64:()=>b_,$ZodAsyncError:()=>vn,$ZodArray:()=>Nr,$ZodAny:()=>D_});function D(i,n,r){function u(h,_){var l;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(l=h._zod).traits??(l.traits=new Set),h._zod.traits.add(i),n(h,_);for(let $ in g.prototype)if(!($ in h))Object.defineProperty(h,$,{value:g.prototype[$].bind(h)});h._zod.constr=g,h._zod.def=_}let t=r?.Parent??Object;class c extends t{}Object.defineProperty(c,"name",{value:i});function g(h){var _;let l=r?.Parent?new c:this;u(l,h),(_=l._zod).deferred??(_.deferred=[]);for(let $ of l._zod.deferred)$();return l}return Object.defineProperty(g,"init",{value:u}),Object.defineProperty(g,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(i)}}),Object.defineProperty(g,"name",{value:i}),g}var Kg=Symbol("zod_brand");class vn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var cr={};function $i(i){if(i)Object.assign(cr,i);return cr}var S={};Xn(S,{unwrapMessage:()=>or,stringifyPrimitive:()=>A,required:()=>pD,randomString:()=>su,propertyKeyTypes:()=>$r,promiseAllObject:()=>FD,primitiveTypes:()=>yg,prefixIssues:()=>Ii,pick:()=>kD,partial:()=>eD,optionalKeys:()=>Tg,omit:()=>CD,numKeys:()=>PD,nullish:()=>Bn,normalizeParams:()=>I,merge:()=>ZD,jsonStringifyReplacer:()=>Mg,joinValues:()=>G,issue:()=>Rg,isPlainObject:()=>lr,isObject:()=>ic,getSizableOrigin:()=>wr,getParsedType:()=>yD,getLengthableOrigin:()=>br,getEnumValues:()=>gr,getElementAtPath:()=>xD,floatSafeRemainder:()=>xg,finalizeIssue:()=>Ai,extend:()=>RD,escapeRegex:()=>fn,esc:()=>it,defineLazy:()=>d,createTransparentProxy:()=>TD,clone:()=>Si,cleanRegex:()=>_r,cleanEnum:()=>dD,cached:()=>hr,assignProp:()=>Fg,assertNotEqual:()=>BD,assertNever:()=>VD,assertIs:()=>KD,assertEqual:()=>AD,assert:()=>MD,allowsEval:()=>Pg,aborted:()=>nt,NUMBER_FORMAT_RANGES:()=>kg,Class:()=>mf,BIGINT_FORMAT_RANGES:()=>Cg});function AD(i){return i}function BD(i){return i}function KD(i){}function VD(i){throw new Error}function MD(i){}function gr(i){let n=Object.values(i).filter((u)=>typeof u==="number");return Object.entries(i).filter(([u,t])=>n.indexOf(+u)===-1).map(([u,t])=>t)}function G(i,n="|"){return i.map((r)=>A(r)).join(n)}function Mg(i,n){if(typeof n==="bigint")return n.toString();return n}function hr(i){return{get value(){{let r=i();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bn(i){return i===null||i===void 0}function _r(i){let n=i.startsWith("^")?1:0,r=i.endsWith("$")?i.length-1:i.length;return i.slice(n,r)}function xg(i,n){let r=(i.toString().split(".")[1]||"").length,u=(n.toString().split(".")[1]||"").length,t=r>u?r:u,c=Number.parseInt(i.toFixed(t).replace(".","")),g=Number.parseInt(n.toFixed(t).replace(".",""));return c%g/10**t}function d(i,n,r){Object.defineProperty(i,n,{get(){{let t=r();return i[n]=t,t}throw new Error("cached value already set")},set(t){Object.defineProperty(i,n,{value:t})},configurable:!0})}function Fg(i,n,r){Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function xD(i,n){if(!n)return i;return n.reduce((r,u)=>r?.[u],i)}function FD(i){let n=Object.keys(i),r=n.map((u)=>i[u]);return Promise.all(r).then((u)=>{let t={};for(let c=0;c{try{return new Function(""),!0}catch(i){return!1}});function lr(i){return typeof i==="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}function PD(i){let n=0;for(let r in i)if(Object.prototype.hasOwnProperty.call(i,r))n++;return n}var yD=(i)=>{let n=typeof i;switch(n){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(i)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(i))return"array";if(i===null)return"null";if(i.then&&typeof i.then==="function"&&i.catch&&typeof i.catch==="function")return"promise";if(typeof Map!=="undefined"&&i instanceof Map)return"map";if(typeof Set!=="undefined"&&i instanceof Set)return"set";if(typeof Date!=="undefined"&&i instanceof Date)return"date";if(typeof File!=="undefined"&&i instanceof File)return"file";return"object";default:throw new Error(`Unknown data type: ${n}`)}},$r=new Set(["string","number","symbol"]),yg=new Set(["string","number","bigint","boolean","symbol","undefined"]);function fn(i){return i.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function Si(i,n,r){let u=new i._zod.constr(n??i._zod.def);if(!n||r?.parent)u._zod.parent=i;return u}function I(i){let n=i;if(!n)return{};if(typeof n==="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}if(delete n.message,typeof n.error==="string")return{...n,error:()=>n.error};return n}function TD(i){let n;return new Proxy({},{get(r,u,t){return n??(n=i()),Reflect.get(n,u,t)},set(r,u,t,c){return n??(n=i()),Reflect.set(n,u,t,c)},has(r,u){return n??(n=i()),Reflect.has(n,u)},deleteProperty(r,u){return n??(n=i()),Reflect.deleteProperty(n,u)},ownKeys(r){return n??(n=i()),Reflect.ownKeys(n)},getOwnPropertyDescriptor(r,u){return n??(n=i()),Reflect.getOwnPropertyDescriptor(n,u)},defineProperty(r,u,t){return n??(n=i()),Reflect.defineProperty(n,u,t)}})}function A(i){if(typeof i==="bigint")return i.toString()+"n";if(typeof i==="string")return`"${i}"`;return`${i}`}function Tg(i){return Object.keys(i).filter((n)=>{return i[n]._zod.optin==="optional"&&i[n]._zod.optout==="optional"})}var kg={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Cg={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kD(i,n){let r={},u=i._zod.def;for(let t in n){if(!(t in u.shape))throw new Error(`Unrecognized key: "${t}"`);if(!n[t])continue;r[t]=u.shape[t]}return Si(i,{...i._zod.def,shape:r,checks:[]})}function CD(i,n){let r={...i._zod.def.shape},u=i._zod.def;for(let t in n){if(!(t in u.shape))throw new Error(`Unrecognized key: "${t}"`);if(!n[t])continue;delete r[t]}return Si(i,{...i._zod.def,shape:r,checks:[]})}function RD(i,n){let r={...i._zod.def,get shape(){let u={...i._zod.def.shape,...n};return Fg(this,"shape",u),u},checks:[]};return Si(i,r)}function ZD(i,n){return Si(i,{...i._zod.def,get shape(){let r={...i._zod.def.shape,...n._zod.def.shape};return Fg(this,"shape",r),r},catchall:n._zod.def.catchall,checks:[]})}function eD(i,n,r){let u=n._zod.def.shape,t={...u};if(r)for(let c in r){if(!(c in u))throw new Error(`Unrecognized key: "${c}"`);if(!r[c])continue;t[c]=i?new i({type:"optional",innerType:u[c]}):u[c]}else for(let c in u)t[c]=i?new i({type:"optional",innerType:u[c]}):u[c];return Si(n,{...n._zod.def,shape:t,checks:[]})}function pD(i,n,r){let u=n._zod.def.shape,t={...u};if(r)for(let c in r){if(!(c in t))throw new Error(`Unrecognized key: "${c}"`);if(!r[c])continue;t[c]=new i({type:"nonoptional",innerType:u[c]})}else for(let c in u)t[c]=new i({type:"nonoptional",innerType:u[c]});return Si(n,{...n._zod.def,shape:t,checks:[]})}function nt(i,n=0){for(let r=n;r{var u;return(u=r).path??(u.path=[]),r.path.unshift(i),r})}function or(i){return typeof i==="string"?i:i?.message}function Ai(i,n,r){let u={...i,path:i.path??[]};if(!i.message){let t=or(i.inst?._zod.def?.error?.(i))??or(n?.error?.(i))??or(r.customError?.(i))??or(r.localeError?.(i))??"Invalid input";u.message=t}if(delete u.inst,delete u.continue,!n?.reportInput)delete u.input;return u}function wr(i){if(i instanceof Set)return"set";if(i instanceof Map)return"map";if(i instanceof File)return"file";return"unknown"}function br(i){if(Array.isArray(i))return"array";if(typeof i==="string")return"string";return"unknown"}function Rg(...i){let[n,r,u]=i;if(typeof n==="string")return{message:n,code:"custom",input:r,inst:u};return{...n}}function dD(i){return Object.entries(i).filter(([n,r])=>{return Number.isNaN(Number.parseInt(n,10))}).map((n)=>n[1])}class mf{constructor(...i){}}var Sf=(i,n)=>{i.name="$ZodError",Object.defineProperty(i,"_zod",{value:i._zod,enumerable:!1}),Object.defineProperty(i,"issues",{value:n,enumerable:!1}),Object.defineProperty(i,"message",{get(){return JSON.stringify(n,Mg,2)},enumerable:!0})},vr=D("$ZodError",Sf),Et=D("$ZodError",Sf,{Parent:Error});function fr(i,n=(r)=>r.message){let r={},u=[];for(let t of i.issues)if(t.path.length>0)r[t.path[0]]=r[t.path[0]]||[],r[t.path[0]].push(n(t));else u.push(n(t));return{formErrors:u,fieldErrors:r}}function Or(i,n){let r=n||function(c){return c.message},u={_errors:[]},t=(c)=>{for(let g of c.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map((h)=>t({issues:h}));else if(g.code==="invalid_key")t({issues:g.issues});else if(g.code==="invalid_element")t({issues:g.issues});else if(g.path.length===0)u._errors.push(r(g));else{let h=u,_=0;while(_{var h,_;for(let l of c.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(($)=>t({issues:$},l.path));else if(l.code==="invalid_key")t({issues:l.issues},l.path);else if(l.code==="invalid_element")t({issues:l.issues},l.path);else{let $=[...g,...l.path];if($.length===0){u.errors.push(r(l));continue}let w=u,b=0;while(b<$.length){let v=$[b],f=b===$.length-1;if(typeof v==="string")w.properties??(w.properties={}),(h=w.properties)[v]??(h[v]={errors:[]}),w=w.properties[v];else w.items??(w.items=[]),(_=w.items)[v]??(_[v]={errors:[]}),w=w.items[v];if(f)w.errors.push(r(l));b++}}};return t(i),u}function Af(i){let n=[];for(let r of i)if(typeof r==="number")n.push(`[${r}]`);else if(typeof r==="symbol")n.push(`[${JSON.stringify(String(r))}]`);else if(/[^\\w$]/.test(r))n.push(`[${JSON.stringify(r)}]`);else{if(n.length)n.push(".");n.push(r)}return n.join("")}function eg(i){let n=[],r=[...i.issues].sort((u,t)=>u.path.length-t.path.length);for(let u of r)if(n.push(`✖ ${u.message}`),u.path?.length)n.push(` → at ${Af(u.path)}`);return n.join(`\n`)}var nc=(i)=>(n,r,u,t)=>{let c=u?Object.assign(u,{async:!1}):{async:!1},g=n._zod.run({value:r,issues:[]},c);if(g instanceof Promise)throw new vn;if(g.issues.length){let h=new(t?.Err??i)(g.issues.map((_)=>Ai(_,c,$i())));throw Error.captureStackTrace(h,t?.callee),h}return g.value},tc=nc(Et),rc=(i)=>async(n,r,u,t)=>{let c=u?Object.assign(u,{async:!0}):{async:!0},g=n._zod.run({value:r,issues:[]},c);if(g instanceof Promise)g=await g;if(g.issues.length){let h=new(t?.Err??i)(g.issues.map((_)=>Ai(_,c,$i())));throw Error.captureStackTrace(h,t?.callee),h}return g.value},uc=rc(Et),cc=(i)=>(n,r,u)=>{let t=u?{...u,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},t);if(c instanceof Promise)throw new vn;return c.issues.length?{success:!1,error:new(i??vr)(c.issues.map((g)=>Ai(g,t,$i())))}:{success:!0,data:c.value}},pg=cc(Et),oc=(i)=>async(n,r,u)=>{let t=u?Object.assign(u,{async:!0}):{async:!0},c=n._zod.run({value:r,issues:[]},t);if(c instanceof Promise)c=await c;return c.issues.length?{success:!1,error:new i(c.issues.map((g)=>Ai(g,t,$i())))}:{success:!0,data:c.value}},dg=oc(Et);var rt={};Xn(rt,{xid:()=>nh,uuid7:()=>tJ,uuid6:()=>nJ,uuid4:()=>iJ,uuid:()=>tt,uppercase:()=>Gh,unicodeEmail:()=>cJ,undefined:()=>Eh,ulid:()=>ih,time:()=>Oh,string:()=>Uh,rfc5322Email:()=>uJ,number:()=>Wh,null:()=>Jh,nanoid:()=>rh,lowercase:()=>Hh,ksuid:()=>th,ipv6:()=>_h,ipv4:()=>hh,integer:()=>zh,html5Email:()=>rJ,hostname:()=>bh,guid:()=>ch,extendedDuration:()=>sD,emoji:()=>gh,email:()=>oh,e164:()=>vh,duration:()=>uh,domain:()=>hJ,datetime:()=>jh,date:()=>fh,cuid2:()=>sg,cuid:()=>ag,cidrv6:()=>$h,cidrv4:()=>lh,browserEmail:()=>oJ,boolean:()=>Dh,bigint:()=>Nh,base64url:()=>gc,base64:()=>wh,_emoji:()=>gJ});var ag=/^[cC][^\\s-]{8,}$/,sg=/^[0-9a-z]+$/,ih=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nh=/^[0-9a-vA-V]{20}$/,th=/^[A-Za-z0-9]{27}$/,rh=/^[a-zA-Z0-9_-]{21}$/,uh=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,sD=/^[-+]?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)?)??$/,ch=/^([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})$/,tt=(i)=>{if(!i)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${i}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},iJ=tt(4),nJ=tt(6),tJ=tt(7),oh=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_\'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,rJ=/^[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])?)*$/,uJ=/^(([^<>()\\[\\]\\\\.,;:\\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,}))$/,cJ=/^[^\\s@"]{1,64}@[^\\s@]{1,255}$/u,oJ=/^[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])?)*$/,gJ="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";function gh(){return new RegExp("^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$","u")}var hh=/^(?:(?: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])$/,_h=/^(([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})$/,lh=/^((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])$/,$h=/^(([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])$/,wh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gc=/^[A-Za-z0-9_-]*$/,bh=/^([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+$/,hJ=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}$/,vh=/^\\+(?:[0-9]){6,14}[0-9]$/,Bf="((\\\\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])))",fh=new RegExp(`^${Bf}$`);function Kf(i){let n="([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d";if(i.precision)n=`${n}\\\\.\\\\d{${i.precision}}`;else if(i.precision==null)n=`${n}(\\\\.\\\\d+)?`;return n}function Oh(i){return new RegExp(`^${Kf(i)}$`)}function jh(i){let n=`${Bf}T${Kf(i)}`,r=[];if(r.push(i.local?"Z?":"Z"),i.offset)r.push("([+-]\\\\d{2}:?\\\\d{2})");return n=`${n}(${r.join("|")})`,new RegExp(`^${n}$`)}var Uh=(i)=>{let n=i?`[\\\\s\\\\S]{${i?.minimum??0},${i?.maximum??""}}`:"[\\\\s\\\\S]*";return new RegExp(`^${n}$`)},Nh=/^\\d+n?$/,zh=/^\\d+$/,Wh=/^-?\\d+(?:\\.\\d+)?/i,Dh=/true|false/i,Jh=/null/i;var Eh=/undefined/i;var Hh=/^[^A-Z]*$/,Gh=/^[^a-z]*$/;var ui=D("$ZodCheck",(i,n)=>{var r;i._zod??(i._zod={}),i._zod.def=n,(r=i._zod).onattach??(r.onattach=[])}),Mf={number:"number",bigint:"bigint",object:"date"},hc=D("$ZodCheckLessThan",(i,n)=>{ui.init(i,n);let r=Mf[typeof n.value];i._zod.onattach.push((u)=>{let t=u._zod.bag,c=(n.inclusive?t.maximum:t.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(n.value{if(n.inclusive?u.value<=n.value:u.value{ui.init(i,n);let r=Mf[typeof n.value];i._zod.onattach.push((u)=>{let t=u._zod.bag,c=(n.inclusive?t.minimum:t.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(n.value>c)if(n.inclusive)t.minimum=n.value;else t.exclusiveMinimum=n.value}),i._zod.check=(u)=>{if(n.inclusive?u.value>=n.value:u.value>n.value)return;u.issues.push({origin:r,code:"too_small",minimum:n.value,input:u.value,inclusive:n.inclusive,inst:i,continue:!n.abort})}}),qh=D("$ZodCheckMultipleOf",(i,n)=>{ui.init(i,n),i._zod.onattach.push((r)=>{var u;(u=r._zod.bag).multipleOf??(u.multipleOf=n.value)}),i._zod.check=(r)=>{if(typeof r.value!==typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%n.value===BigInt(0):xg(r.value,n.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:n.value,input:r.value,inst:i,continue:!n.abort})}}),Xh=D("$ZodCheckNumberFormat",(i,n)=>{ui.init(i,n),n.format=n.format||"float64";let r=n.format?.includes("int"),u=r?"int":"number",[t,c]=kg[n.format];i._zod.onattach.push((g)=>{let h=g._zod.bag;if(h.format=n.format,h.minimum=t,h.maximum=c,r)h.pattern=zh}),i._zod.check=(g)=>{let h=g.value;if(r){if(!Number.isInteger(h)){g.issues.push({expected:u,format:n.format,code:"invalid_type",input:h,inst:i});return}if(!Number.isSafeInteger(h)){if(h>0)g.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:i,origin:u,continue:!n.abort});else g.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:i,origin:u,continue:!n.abort});return}}if(hc)g.issues.push({origin:"number",input:h,code:"too_big",maximum:c,inst:i})}}),Lh=D("$ZodCheckBigIntFormat",(i,n)=>{ui.init(i,n);let[r,u]=Cg[n.format];i._zod.onattach.push((t)=>{let c=t._zod.bag;c.format=n.format,c.minimum=r,c.maximum=u}),i._zod.check=(t)=>{let c=t.value;if(cu)t.issues.push({origin:"bigint",input:c,code:"too_big",maximum:u,inst:i})}}),Ih=D("$ZodCheckMaxSize",(i,n)=>{ui.init(i,n),i._zod.when=(r)=>{let u=r.value;return!Bn(u)&&u.size!==void 0},i._zod.onattach.push((r)=>{let u=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(n.maximum{let u=r.value;if(u.size<=n.maximum)return;r.issues.push({origin:wr(u),code:"too_big",maximum:n.maximum,input:u,inst:i,continue:!n.abort})}}),Yh=D("$ZodCheckMinSize",(i,n)=>{ui.init(i,n),i._zod.when=(r)=>{let u=r.value;return!Bn(u)&&u.size!==void 0},i._zod.onattach.push((r)=>{let u=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(n.minimum>u)r._zod.bag.minimum=n.minimum}),i._zod.check=(r)=>{let u=r.value;if(u.size>=n.minimum)return;r.issues.push({origin:wr(u),code:"too_small",minimum:n.minimum,input:u,inst:i,continue:!n.abort})}}),Qh=D("$ZodCheckSizeEquals",(i,n)=>{ui.init(i,n),i._zod.when=(r)=>{let u=r.value;return!Bn(u)&&u.size!==void 0},i._zod.onattach.push((r)=>{let u=r._zod.bag;u.minimum=n.size,u.maximum=n.size,u.size=n.size}),i._zod.check=(r)=>{let u=r.value,t=u.size;if(t===n.size)return;let c=t>n.size;r.issues.push({origin:wr(u),...c?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},input:r.value,inst:i,continue:!n.abort})}}),mh=D("$ZodCheckMaxLength",(i,n)=>{ui.init(i,n),i._zod.when=(r)=>{let u=r.value;return!Bn(u)&&u.length!==void 0},i._zod.onattach.push((r)=>{let u=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(n.maximum{let u=r.value;if(u.length<=n.maximum)return;let c=br(u);r.issues.push({origin:c,code:"too_big",maximum:n.maximum,inclusive:!0,input:u,inst:i,continue:!n.abort})}}),Sh=D("$ZodCheckMinLength",(i,n)=>{ui.init(i,n),i._zod.when=(r)=>{let u=r.value;return!Bn(u)&&u.length!==void 0},i._zod.onattach.push((r)=>{let u=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(n.minimum>u)r._zod.bag.minimum=n.minimum}),i._zod.check=(r)=>{let u=r.value;if(u.length>=n.minimum)return;let c=br(u);r.issues.push({origin:c,code:"too_small",minimum:n.minimum,inclusive:!0,input:u,inst:i,continue:!n.abort})}}),Ah=D("$ZodCheckLengthEquals",(i,n)=>{ui.init(i,n),i._zod.when=(r)=>{let u=r.value;return!Bn(u)&&u.length!==void 0},i._zod.onattach.push((r)=>{let u=r._zod.bag;u.minimum=n.length,u.maximum=n.length,u.length=n.length}),i._zod.check=(r)=>{let u=r.value,t=u.length;if(t===n.length)return;let c=br(u),g=t>n.length;r.issues.push({origin:c,...g?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:r.value,inst:i,continue:!n.abort})}}),Ht=D("$ZodCheckStringFormat",(i,n)=>{var r;ui.init(i,n),i._zod.onattach.push((u)=>{let t=u._zod.bag;if(t.format=n.format,n.pattern)t.patterns??(t.patterns=new Set),t.patterns.add(n.pattern)}),(r=i._zod).check??(r.check=(u)=>{if(!n.pattern)throw new Error("Not implemented.");if(n.pattern.lastIndex=0,n.pattern.test(u.value))return;u.issues.push({origin:"string",code:"invalid_format",format:n.format,input:u.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:i,continue:!n.abort})})}),Bh=D("$ZodCheckRegex",(i,n)=>{Ht.init(i,n),i._zod.check=(r)=>{if(n.pattern.lastIndex=0,n.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:n.pattern.toString(),inst:i,continue:!n.abort})}}),Kh=D("$ZodCheckLowerCase",(i,n)=>{n.pattern??(n.pattern=Hh),Ht.init(i,n)}),Vh=D("$ZodCheckUpperCase",(i,n)=>{n.pattern??(n.pattern=Gh),Ht.init(i,n)}),Mh=D("$ZodCheckIncludes",(i,n)=>{ui.init(i,n);let r=fn(n.includes),u=new RegExp(typeof n.position==="number"?`^.{${n.position}}${r}`:r);n.pattern=u,i._zod.onattach.push((t)=>{let c=t._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(u)}),i._zod.check=(t)=>{if(t.value.includes(n.includes,n.position))return;t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:t.value,inst:i,continue:!n.abort})}}),xh=D("$ZodCheckStartsWith",(i,n)=>{ui.init(i,n);let r=new RegExp(`^${fn(n.prefix)}.*`);n.pattern??(n.pattern=r),i._zod.onattach.push((u)=>{let t=u._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),i._zod.check=(u)=>{if(u.value.startsWith(n.prefix))return;u.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:u.value,inst:i,continue:!n.abort})}}),Fh=D("$ZodCheckEndsWith",(i,n)=>{ui.init(i,n);let r=new RegExp(`.*${fn(n.suffix)}$`);n.pattern??(n.pattern=r),i._zod.onattach.push((u)=>{let t=u._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),i._zod.check=(u)=>{if(u.value.endsWith(n.suffix))return;u.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:u.value,inst:i,continue:!n.abort})}});function Vf(i,n,r){if(i.issues.length)n.issues.push(...Ii(r,i.issues))}var Ph=D("$ZodCheckProperty",(i,n)=>{ui.init(i,n),i._zod.check=(r)=>{let u=n.schema._zod.run({value:r.value[n.property],issues:[]},{});if(u instanceof Promise)return u.then((t)=>Vf(t,r,n.property));Vf(u,r,n.property);return}}),yh=D("$ZodCheckMimeType",(i,n)=>{ui.init(i,n);let r=new Set(n.mime);i._zod.onattach.push((u)=>{u._zod.bag.mime=n.mime}),i._zod.check=(u)=>{if(r.has(u.value.type))return;u.issues.push({code:"invalid_value",values:n.mime,input:u.value.type,path:["type"],inst:i})}}),Th=D("$ZodCheckOverwrite",(i,n)=>{ui.init(i,n),i._zod.check=(r)=>{r.value=n.tx(r.value)}});class lc{constructor(i=[]){if(this.content=[],this.indent=0,this)this.args=i}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i==="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}let r=i.split(`\n`).filter((c)=>c),u=Math.min(...r.map((c)=>c.length-c.trimStart().length)),t=r.map((c)=>c.slice(u)).map((c)=>" ".repeat(this.indent*2)+c);for(let c of t)this.content.push(c)}compile(){let i=Function,n=this?.args,u=[...(this?.content??[""]).map((t)=>` ${t}`)];return new i(...n,u.join(`\n`))}}var kh={major:4,minor:0,patch:0};var y=D("$ZodType",(i,n)=>{var r;i??(i={}),i._zod.id=n.type+"_"+su(10),i._zod.def=n,i._zod.bag=i._zod.bag||{},i._zod.version=kh;let u=[...i._zod.def.checks??[]];if(i._zod.traits.has("$ZodCheck"))u.unshift(i);for(let t of u)for(let c of t._zod.onattach)c(i);if(u.length===0)(r=i._zod).deferred??(r.deferred=[]),i._zod.deferred?.push(()=>{i._zod.run=i._zod.parse});else{let t=(c,g,h)=>{let _=nt(c),l;for(let $ of g){if($._zod.when){if(!$._zod.when(c))continue}else if(_)continue;let w=c.issues.length,b=$._zod.check(c);if(b instanceof Promise&&h?.async===!1)throw new vn;if(l||b instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await b,c.issues.length===w)return;if(!_)_=nt(c,w)});else{if(c.issues.length===w)continue;if(!_)_=nt(c,w)}}if(l)return l.then(()=>{return c});return c};i._zod.run=(c,g)=>{let h=i._zod.parse(c,g);if(h instanceof Promise){if(g.async===!1)throw new vn;return h.then((_)=>t(_,u,g))}return t(h,u,g)}}i["~standard"]={validate:(t)=>{try{let c=pg(i,t);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return dg(i,t).then((g)=>g.success?{value:g.data}:{issues:g.error?.issues})}},vendor:"zod",version:1}}),jr=D("$ZodString",(i,n)=>{y.init(i,n),i._zod.pattern=[...i?._zod.bag?.patterns??[]].pop()??Uh(i._zod.bag),i._zod.parse=(r,u)=>{if(n.coerce)try{r.value=String(r.value)}catch(t){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:i}),r}}),ii=D("$ZodStringFormat",(i,n)=>{Ht.init(i,n),jr.init(i,n)}),Rh=D("$ZodGUID",(i,n)=>{n.pattern??(n.pattern=ch),ii.init(i,n)}),Zh=D("$ZodUUID",(i,n)=>{if(n.version){let u={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(u===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=tt(u))}else n.pattern??(n.pattern=tt());ii.init(i,n)}),eh=D("$ZodEmail",(i,n)=>{n.pattern??(n.pattern=oh),ii.init(i,n)}),ph=D("$ZodURL",(i,n)=>{ii.init(i,n),i._zod.check=(r)=>{try{let u=new URL(r.value);if(n.hostname){if(n.hostname.lastIndex=0,!n.hostname.test(u.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:bh.source,input:r.value,inst:i})}if(n.protocol){if(n.protocol.lastIndex=0,!n.protocol.test(u.protocol.endsWith(":")?u.protocol.slice(0,-1):u.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:r.value,inst:i})}return}catch(u){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:i})}}}),dh=D("$ZodEmoji",(i,n)=>{n.pattern??(n.pattern=gh()),ii.init(i,n)}),ah=D("$ZodNanoID",(i,n)=>{n.pattern??(n.pattern=rh),ii.init(i,n)}),sh=D("$ZodCUID",(i,n)=>{n.pattern??(n.pattern=ag),ii.init(i,n)}),i_=D("$ZodCUID2",(i,n)=>{n.pattern??(n.pattern=sg),ii.init(i,n)}),n_=D("$ZodULID",(i,n)=>{n.pattern??(n.pattern=ih),ii.init(i,n)}),t_=D("$ZodXID",(i,n)=>{n.pattern??(n.pattern=nh),ii.init(i,n)}),r_=D("$ZodKSUID",(i,n)=>{n.pattern??(n.pattern=th),ii.init(i,n)}),u_=D("$ZodISODateTime",(i,n)=>{n.pattern??(n.pattern=jh(n)),ii.init(i,n)}),c_=D("$ZodISODate",(i,n)=>{n.pattern??(n.pattern=fh),ii.init(i,n)}),o_=D("$ZodISOTime",(i,n)=>{n.pattern??(n.pattern=Oh(n)),ii.init(i,n)}),g_=D("$ZodISODuration",(i,n)=>{n.pattern??(n.pattern=uh),ii.init(i,n)}),h_=D("$ZodIPv4",(i,n)=>{n.pattern??(n.pattern=hh),ii.init(i,n),i._zod.onattach.push((r)=>{let u=r._zod.bag;u.format="ipv4"})}),__=D("$ZodIPv6",(i,n)=>{n.pattern??(n.pattern=_h),ii.init(i,n),i._zod.onattach.push((r)=>{let u=r._zod.bag;u.format="ipv6"}),i._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:i})}}}),l_=D("$ZodCIDRv4",(i,n)=>{n.pattern??(n.pattern=lh),ii.init(i,n)}),$_=D("$ZodCIDRv6",(i,n)=>{n.pattern??(n.pattern=$h),ii.init(i,n),i._zod.check=(r)=>{let[u,t]=r.value.split("/");try{if(!t)throw new Error;let c=Number(t);if(`${c}`!==t)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${u}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:i})}}});function w_(i){if(i==="")return!0;if(i.length%4!==0)return!1;try{return atob(i),!0}catch{return!1}}var b_=D("$ZodBase64",(i,n)=>{n.pattern??(n.pattern=wh),ii.init(i,n),i._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),i._zod.check=(r)=>{if(w_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:i})}});function af(i){if(!gc.test(i))return!1;let n=i.replace(/[-_]/g,(u)=>u==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return w_(r)}var v_=D("$ZodBase64URL",(i,n)=>{n.pattern??(n.pattern=gc),ii.init(i,n),i._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),i._zod.check=(r)=>{if(af(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:i})}}),f_=D("$ZodE164",(i,n)=>{n.pattern??(n.pattern=vh),ii.init(i,n)});function sf(i,n=null){try{let r=i.split(".");if(r.length!==3)return!1;let[u]=r,t=JSON.parse(atob(u));if("typ"in t&&t?.typ!=="JWT")return!1;if(!t.alg)return!1;if(n&&(!("alg"in t)||t.alg!==n))return!1;return!0}catch{return!1}}var O_=D("$ZodJWT",(i,n)=>{ii.init(i,n),i._zod.check=(r)=>{if(sf(r.value,n.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:i})}}),bc=D("$ZodNumber",(i,n)=>{y.init(i,n),i._zod.pattern=i._zod.bag.pattern??Wh,i._zod.parse=(r,u)=>{if(n.coerce)try{r.value=Number(r.value)}catch(g){}let t=r.value;if(typeof t==="number"&&!Number.isNaN(t)&&Number.isFinite(t))return r;let c=typeof t==="number"?Number.isNaN(t)?"NaN":!Number.isFinite(t)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:t,inst:i,...c?{received:c}:{}}),r}}),j_=D("$ZodNumber",(i,n)=>{Xh.init(i,n),bc.init(i,n)}),Ur=D("$ZodBoolean",(i,n)=>{y.init(i,n),i._zod.pattern=Dh,i._zod.parse=(r,u)=>{if(n.coerce)try{r.value=Boolean(r.value)}catch(c){}let t=r.value;if(typeof t==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:t,inst:i}),r}}),vc=D("$ZodBigInt",(i,n)=>{y.init(i,n),i._zod.pattern=Nh,i._zod.parse=(r,u)=>{if(n.coerce)try{r.value=BigInt(r.value)}catch(c){}let{value:t}=r;if(typeof t==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:t,inst:i}),r}}),U_=D("$ZodBigInt",(i,n)=>{Lh.init(i,n),vc.init(i,n)}),N_=D("$ZodSymbol",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let{value:t}=r;if(typeof t==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:t,inst:i}),r}}),z_=D("$ZodUndefined",(i,n)=>{y.init(i,n),i._zod.pattern=Eh,i._zod.values=new Set([void 0]),i._zod.parse=(r,u)=>{let{value:t}=r;if(typeof t==="undefined")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:t,inst:i}),r}}),W_=D("$ZodNull",(i,n)=>{y.init(i,n),i._zod.pattern=Jh,i._zod.values=new Set([null]),i._zod.parse=(r,u)=>{let{value:t}=r;if(t===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:t,inst:i}),r}}),D_=D("$ZodAny",(i,n)=>{y.init(i,n),i._zod.parse=(r)=>r}),Kn=D("$ZodUnknown",(i,n)=>{y.init(i,n),i._zod.parse=(r)=>r}),J_=D("$ZodNever",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{return r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:i}),r}}),E_=D("$ZodVoid",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let{value:t}=r;if(typeof t==="undefined")return r;return r.issues.push({expected:"void",code:"invalid_type",input:t,inst:i}),r}}),H_=D("$ZodDate",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{if(n.coerce)try{r.value=new Date(r.value)}catch(h){}let t=r.value,c=t instanceof Date;if(c&&!Number.isNaN(t.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:t,...c?{received:"Invalid Date"}:{},inst:i}),r}});function Ff(i,n,r){if(i.issues.length)n.issues.push(...Ii(r,i.issues));n.value[r]=i.value}var Nr=D("$ZodArray",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=r.value;if(!Array.isArray(t))return r.issues.push({expected:"array",code:"invalid_type",input:t,inst:i}),r;r.value=Array(t.length);let c=[];for(let g=0;gFf(l,r,g)));else Ff(_,r,g)}if(c.length)return Promise.all(c).then(()=>r);return r}});function $c(i,n,r){if(i.issues.length)n.issues.push(...Ii(r,i.issues));n.value[r]=i.value}function Pf(i,n,r,u){if(i.issues.length)if(u[r]===void 0)if(r in u)n.value[r]=void 0;else n.value[r]=i.value;else n.issues.push(...Ii(r,i.issues));else if(i.value===void 0){if(r in u)n.value[r]=void 0}else n.value[r]=i.value}var G_=D("$ZodObject",(i,n)=>{y.init(i,n);let r=hr(()=>{let w=Object.keys(n.shape);for(let v of w)if(!(n.shape[v]instanceof y))throw new Error(`Invalid element at key "${v}": expected a Zod schema`);let b=Tg(n.shape);return{shape:n.shape,keys:w,keySet:new Set(w),numKeys:w.length,optionalKeys:new Set(b)}});d(i._zod,"propValues",()=>{let w=n.shape,b={};for(let v in w){let f=w[v]._zod;if(f.values){b[v]??(b[v]=new Set);for(let U of f.values)b[v].add(U)}}return b});let u=(w)=>{let b=new lc(["shape","payload","ctx"]),{keys:v,optionalKeys:f}=r.value,U=(N)=>{let j=it(N);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};b.write("const input = payload.value;");let z=Object.create(null);for(let N of v)z[N]=su(15);b.write("const newResult = {}");for(let N of v)if(f.has(N)){let j=z[N];b.write(`const ${j} = ${U(N)};`);let O=it(N);b.write(`\n if (${j}.issues.length) {\n if (input[${O}] === undefined) {\n if (${O} in input) {\n newResult[${O}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${j}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${O}, ...iss.path] : [${O}],\n }))\n );\n }\n } else if (${j}.value === undefined) {\n if (${O} in input) newResult[${O}] = undefined;\n } else {\n newResult[${O}] = ${j}.value;\n }\n `)}else{let j=z[N];b.write(`const ${j} = ${U(N)};`),b.write(`\n if (${j}.issues.length) payload.issues = payload.issues.concat(${j}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${it(N)}, ...iss.path] : [${it(N)}]\n })));`),b.write(`newResult[${it(N)}] = ${j}.value`)}b.write("payload.value = newResult;"),b.write("return payload;");let J=b.compile();return(N,j)=>J(w,N,j)},t,c=ic,g=!cr.jitless,_=g&&Pg.value,{catchall:l}=n,$;i._zod.parse=(w,b)=>{$??($=r.value);let v=w.value;if(!c(v))return w.issues.push({expected:"object",code:"invalid_type",input:v,inst:i}),w;let f=[];if(g&&_&&b?.async===!1&&b.jitless!==!0){if(!t)t=u(n.shape);w=t(w,b)}else{w.value={};let j=$.shape;for(let O of $.keys){let W=j[O],E=W._zod.run({value:v[O],issues:[]},b),X=W._zod.optin==="optional"&&W._zod.optout==="optional";if(E instanceof Promise)f.push(E.then((H)=>X?Pf(H,w,O,v):$c(H,w,O)));else if(X)Pf(E,w,O,v);else $c(E,w,O)}}if(!l)return f.length?Promise.all(f).then(()=>w):w;let U=[],z=$.keySet,J=l._zod,N=J.def.type;for(let j of Object.keys(v)){if(z.has(j))continue;if(N==="never"){U.push(j);continue}let O=J.run({value:v[j],issues:[]},b);if(O instanceof Promise)f.push(O.then((W)=>$c(W,w,j)));else $c(O,w,j)}if(U.length)w.issues.push({code:"unrecognized_keys",keys:U,input:v,inst:i});if(!f.length)return w;return Promise.all(f).then(()=>{return w})}});function yf(i,n,r,u){for(let t of i)if(t.issues.length===0)return n.value=t.value,n;return n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:i.map((t)=>t.issues.map((c)=>Ai(c,u,$i())))}),n}var fc=D("$ZodUnion",(i,n)=>{y.init(i,n),d(i._zod,"values",()=>{if(n.options.every((r)=>r._zod.values))return new Set(n.options.flatMap((r)=>Array.from(r._zod.values)));return}),d(i._zod,"pattern",()=>{if(n.options.every((r)=>r._zod.pattern)){let r=n.options.map((u)=>u._zod.pattern);return new RegExp(`^(${r.map((u)=>_r(u.source)).join("|")})$`)}return}),i._zod.parse=(r,u)=>{let t=!1,c=[];for(let g of n.options){let h=g._zod.run({value:r.value,issues:[]},u);if(h instanceof Promise)c.push(h),t=!0;else{if(h.issues.length===0)return h;c.push(h)}}if(!t)return yf(c,r,i,u);return Promise.all(c).then((g)=>{return yf(g,r,i,u)})}}),q_=D("$ZodDiscriminatedUnion",(i,n)=>{fc.init(i,n);let r=i._zod.parse;d(i._zod,"propValues",()=>{let t={};for(let c of n.options){let g=c._zod.propValues;if(!g||Object.keys(g).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(c)}"`);for(let[h,_]of Object.entries(g)){if(!t[h])t[h]=new Set;for(let l of _)t[h].add(l)}}return t});let u=hr(()=>{let t=n.options,c=new Map;for(let g of t){let h=g._zod.propValues[n.discriminator];if(!h||h.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(g)}"`);for(let _ of h){if(c.has(_))throw new Error(`Duplicate discriminator value "${String(_)}"`);c.set(_,g)}}return c});i._zod.parse=(t,c)=>{let g=t.value;if(!ic(g))return t.issues.push({code:"invalid_type",expected:"object",input:g,inst:i}),t;let h=u.value.get(g?.[n.discriminator]);if(h)return h._zod.run(t,c);if(n.unionFallback)return r(t,c);return t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:g,path:[n.discriminator],inst:i}),t}}),X_=D("$ZodIntersection",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let{value:t}=r,c=n.left._zod.run({value:t,issues:[]},u),g=n.right._zod.run({value:t,issues:[]},u);if(c instanceof Promise||g instanceof Promise)return Promise.all([c,g]).then(([_,l])=>{return Tf(r,_,l)});return Tf(r,c,g)}});function Ch(i,n){if(i===n)return{valid:!0,data:i};if(i instanceof Date&&n instanceof Date&&+i===+n)return{valid:!0,data:i};if(lr(i)&&lr(n)){let r=Object.keys(n),u=Object.keys(i).filter((c)=>r.indexOf(c)!==-1),t={...i,...n};for(let c of u){let g=Ch(i[c],n[c]);if(!g.valid)return{valid:!1,mergeErrorPath:[c,...g.mergeErrorPath]};t[c]=g.data}return{valid:!0,data:t}}if(Array.isArray(i)&&Array.isArray(n)){if(i.length!==n.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let u=0;u{y.init(i,n);let r=n.items,u=r.length-[...r].reverse().findIndex((t)=>t._zod.optin!=="optional");i._zod.parse=(t,c)=>{let g=t.value;if(!Array.isArray(g))return t.issues.push({input:g,inst:i,expected:"tuple",code:"invalid_type"}),t;t.value=[];let h=[];if(!n.rest){let l=g.length>r.length,$=g.length=g.length){if(_>=u)continue}let $=l._zod.run({value:g[_],issues:[]},c);if($ instanceof Promise)h.push($.then((w)=>wc(w,t,_)));else wc($,t,_)}if(n.rest){let l=g.slice(r.length);for(let $ of l){_++;let w=n.rest._zod.run({value:$,issues:[]},c);if(w instanceof Promise)h.push(w.then((b)=>wc(b,t,_)));else wc(w,t,_)}}if(h.length)return Promise.all(h).then(()=>t);return t}});function wc(i,n,r){if(i.issues.length)n.issues.push(...Ii(r,i.issues));n.value[r]=i.value}var L_=D("$ZodRecord",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=r.value;if(!lr(t))return r.issues.push({expected:"record",code:"invalid_type",input:t,inst:i}),r;let c=[];if(n.keyType._zod.values){let g=n.keyType._zod.values;r.value={};for(let _ of g)if(typeof _==="string"||typeof _==="number"||typeof _==="symbol"){let l=n.valueType._zod.run({value:t[_],issues:[]},u);if(l instanceof Promise)c.push(l.then(($)=>{if($.issues.length)r.issues.push(...Ii(_,$.issues));r.value[_]=$.value}));else{if(l.issues.length)r.issues.push(...Ii(_,l.issues));r.value[_]=l.value}}let h;for(let _ in t)if(!g.has(_))h=h??[],h.push(_);if(h&&h.length>0)r.issues.push({code:"unrecognized_keys",input:t,inst:i,keys:h})}else{r.value={};for(let g of Reflect.ownKeys(t)){if(g==="__proto__")continue;let h=n.keyType._zod.run({value:g,issues:[]},u);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:h.issues.map((l)=>Ai(l,u,$i())),input:g,path:[g],inst:i}),r.value[h.value]=h.value;continue}let _=n.valueType._zod.run({value:t[g],issues:[]},u);if(_ instanceof Promise)c.push(_.then((l)=>{if(l.issues.length)r.issues.push(...Ii(g,l.issues));r.value[h.value]=l.value}));else{if(_.issues.length)r.issues.push(...Ii(g,_.issues));r.value[h.value]=_.value}}}if(c.length)return Promise.all(c).then(()=>r);return r}}),I_=D("$ZodMap",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=r.value;if(!(t instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:t,inst:i}),r;let c=[];r.value=new Map;for(let[g,h]of t){let _=n.keyType._zod.run({value:g,issues:[]},u),l=n.valueType._zod.run({value:h,issues:[]},u);if(_ instanceof Promise||l instanceof Promise)c.push(Promise.all([_,l]).then(([$,w])=>{kf($,w,r,g,t,i,u)}));else kf(_,l,r,g,t,i,u)}if(c.length)return Promise.all(c).then(()=>r);return r}});function kf(i,n,r,u,t,c,g){if(i.issues.length)if($r.has(typeof u))r.issues.push(...Ii(u,i.issues));else r.issues.push({origin:"map",code:"invalid_key",input:t,inst:c,issues:i.issues.map((h)=>Ai(h,g,$i()))});if(n.issues.length)if($r.has(typeof u))r.issues.push(...Ii(u,n.issues));else r.issues.push({origin:"map",code:"invalid_element",input:t,inst:c,key:u,issues:n.issues.map((h)=>Ai(h,g,$i()))});r.value.set(i.value,n.value)}var Y_=D("$ZodSet",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=r.value;if(!(t instanceof Set))return r.issues.push({input:t,inst:i,expected:"set",code:"invalid_type"}),r;let c=[];r.value=new Set;for(let g of t){let h=n.valueType._zod.run({value:g,issues:[]},u);if(h instanceof Promise)c.push(h.then((_)=>Cf(_,r)));else Cf(h,r)}if(c.length)return Promise.all(c).then(()=>r);return r}});function Cf(i,n){if(i.issues.length)n.issues.push(...i.issues);n.value.add(i.value)}var Q_=D("$ZodEnum",(i,n)=>{y.init(i,n);let r=gr(n.entries);i._zod.values=new Set(r),i._zod.pattern=new RegExp(`^(${r.filter((u)=>$r.has(typeof u)).map((u)=>typeof u==="string"?fn(u):u.toString()).join("|")})$`),i._zod.parse=(u,t)=>{let c=u.value;if(i._zod.values.has(c))return u;return u.issues.push({code:"invalid_value",values:r,input:c,inst:i}),u}}),m_=D("$ZodLiteral",(i,n)=>{y.init(i,n),i._zod.values=new Set(n.values),i._zod.pattern=new RegExp(`^(${n.values.map((r)=>typeof r==="string"?fn(r):r?r.toString():String(r)).join("|")})$`),i._zod.parse=(r,u)=>{let t=r.value;if(i._zod.values.has(t))return r;return r.issues.push({code:"invalid_value",values:n.values,input:t,inst:i}),r}}),S_=D("$ZodFile",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=r.value;if(t instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:t,inst:i}),r}}),A_=D("$ZodTransform",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=n.transform(r.value,r);if(u.async)return(t instanceof Promise?t:Promise.resolve(t)).then((g)=>{return r.value=g,r});if(t instanceof Promise)throw new vn;return r.value=t,r}}),B_=D("$ZodOptional",(i,n)=>{y.init(i,n),i._zod.optin="optional",i._zod.optout="optional",d(i._zod,"values",()=>{return n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0}),d(i._zod,"pattern",()=>{let r=n.innerType._zod.pattern;return r?new RegExp(`^(${_r(r.source)})?$`):void 0}),i._zod.parse=(r,u)=>{if(r.value===void 0)return r;return n.innerType._zod.run(r,u)}}),K_=D("$ZodNullable",(i,n)=>{y.init(i,n),d(i._zod,"optin",()=>n.innerType._zod.optin),d(i._zod,"optout",()=>n.innerType._zod.optout),d(i._zod,"pattern",()=>{let r=n.innerType._zod.pattern;return r?new RegExp(`^(${_r(r.source)}|null)$`):void 0}),d(i._zod,"values",()=>{return n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0}),i._zod.parse=(r,u)=>{if(r.value===null)return r;return n.innerType._zod.run(r,u)}}),V_=D("$ZodDefault",(i,n)=>{y.init(i,n),i._zod.optin="optional",d(i._zod,"values",()=>n.innerType._zod.values),i._zod.parse=(r,u)=>{if(r.value===void 0)return r.value=n.defaultValue,r;let t=n.innerType._zod.run(r,u);if(t instanceof Promise)return t.then((c)=>Rf(c,n));return Rf(t,n)}});function Rf(i,n){if(i.value===void 0)i.value=n.defaultValue;return i}var M_=D("$ZodPrefault",(i,n)=>{y.init(i,n),i._zod.optin="optional",d(i._zod,"values",()=>n.innerType._zod.values),i._zod.parse=(r,u)=>{if(r.value===void 0)r.value=n.defaultValue;return n.innerType._zod.run(r,u)}}),x_=D("$ZodNonOptional",(i,n)=>{y.init(i,n),d(i._zod,"values",()=>{let r=n.innerType._zod.values;return r?new Set([...r].filter((u)=>u!==void 0)):void 0}),i._zod.parse=(r,u)=>{let t=n.innerType._zod.run(r,u);if(t instanceof Promise)return t.then((c)=>Zf(c,i));return Zf(t,i)}});function Zf(i,n){if(!i.issues.length&&i.value===void 0)i.issues.push({code:"invalid_type",expected:"nonoptional",input:i.value,inst:n});return i}var F_=D("$ZodSuccess",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{let t=n.innerType._zod.run(r,u);if(t instanceof Promise)return t.then((c)=>{return r.value=c.issues.length===0,r});return r.value=t.issues.length===0,r}}),P_=D("$ZodCatch",(i,n)=>{y.init(i,n),d(i._zod,"optin",()=>n.innerType._zod.optin),d(i._zod,"optout",()=>n.innerType._zod.optout),d(i._zod,"values",()=>n.innerType._zod.values),i._zod.parse=(r,u)=>{let t=n.innerType._zod.run(r,u);if(t instanceof Promise)return t.then((c)=>{if(r.value=c.value,c.issues.length)r.value=n.catchValue({...r,error:{issues:c.issues.map((g)=>Ai(g,u,$i()))},input:r.value}),r.issues=[];return r});if(r.value=t.value,t.issues.length)r.value=n.catchValue({...r,error:{issues:t.issues.map((c)=>Ai(c,u,$i()))},input:r.value}),r.issues=[];return r}}),y_=D("$ZodNaN",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:i,expected:"nan",code:"invalid_type"}),r;return r}}),zr=D("$ZodPipe",(i,n)=>{y.init(i,n),d(i._zod,"values",()=>n.in._zod.values),d(i._zod,"optin",()=>n.in._zod.optin),d(i._zod,"optout",()=>n.out._zod.optout),i._zod.parse=(r,u)=>{let t=n.in._zod.run(r,u);if(t instanceof Promise)return t.then((c)=>ef(c,n,u));return ef(t,n,u)}});function ef(i,n,r){if(nt(i))return i;return n.out._zod.run({value:i.value,issues:i.issues},r)}var T_=D("$ZodReadonly",(i,n)=>{y.init(i,n),d(i._zod,"propValues",()=>n.innerType._zod.propValues),d(i._zod,"optin",()=>n.innerType._zod.optin),d(i._zod,"optout",()=>n.innerType._zod.optout),i._zod.parse=(r,u)=>{let t=n.innerType._zod.run(r,u);if(t instanceof Promise)return t.then(pf);return pf(t)}});function pf(i){return i.value=Object.freeze(i.value),i}var k_=D("$ZodTemplateLiteral",(i,n)=>{y.init(i,n);let r=[];for(let u of n.parts)if(u instanceof y){if(!u._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...u._zod.traits].shift()}`);let t=u._zod.pattern instanceof RegExp?u._zod.pattern.source:u._zod.pattern;if(!t)throw new Error(`Invalid template literal part: ${u._zod.traits}`);let c=t.startsWith("^")?1:0,g=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(c,g))}else if(u===null||yg.has(typeof u))r.push(fn(`${u}`));else throw new Error(`Invalid template literal part: ${u}`);i._zod.pattern=new RegExp(`^${r.join("")}$`),i._zod.parse=(u,t)=>{if(typeof u.value!=="string")return u.issues.push({input:u.value,inst:i,expected:"template_literal",code:"invalid_type"}),u;if(i._zod.pattern.lastIndex=0,!i._zod.pattern.test(u.value))return u.issues.push({input:u.value,inst:i,code:"invalid_format",format:"template_literal",pattern:i._zod.pattern.source}),u;return u}}),C_=D("$ZodPromise",(i,n)=>{y.init(i,n),i._zod.parse=(r,u)=>{return Promise.resolve(r.value).then((t)=>n.innerType._zod.run({value:t,issues:[]},u))}}),R_=D("$ZodLazy",(i,n)=>{y.init(i,n),d(i._zod,"innerType",()=>n.getter()),d(i._zod,"pattern",()=>i._zod.innerType._zod.pattern),d(i._zod,"propValues",()=>i._zod.innerType._zod.propValues),d(i._zod,"optin",()=>i._zod.innerType._zod.optin),d(i._zod,"optout",()=>i._zod.innerType._zod.optout),i._zod.parse=(r,u)=>{return i._zod.innerType._zod.run(r,u)}}),Z_=D("$ZodCustom",(i,n)=>{ui.init(i,n),y.init(i,n),i._zod.parse=(r,u)=>{return r},i._zod.check=(r)=>{let u=r.value,t=n.fn(u);if(t instanceof Promise)return t.then((c)=>df(c,r,u,i));df(t,r,u,i);return}});function df(i,n,r,u){if(!i){let t={code:"custom",input:r,inst:u,path:[...u._zod.def.path??[]],continue:!u._zod.def.abort};if(u._zod.def.params)t.params=u._zod.def.params;n.issues.push(Rg(t))}}var Dr={};Xn(Dr,{zhTW:()=>Il,zhCN:()=>Ll,vi:()=>Xl,ur:()=>ql,ua:()=>Gl,tr:()=>Hl,th:()=>El,ta:()=>Jl,sv:()=>Dl,sl:()=>Wl,ru:()=>zl,pt:()=>Nl,pl:()=>Ul,ota:()=>jl,no:()=>Ol,nl:()=>fl,ms:()=>vl,mk:()=>bl,ko:()=>wl,kh:()=>$l,ja:()=>ll,it:()=>_l,id:()=>hl,hu:()=>gl,he:()=>ol,frCA:()=>cl,fr:()=>ul,fi:()=>rl,fa:()=>tl,es:()=>nl,en:()=>Wr,de:()=>il,cs:()=>s_,ca:()=>a_,be:()=>d_,az:()=>p_,ar:()=>e_});var _J=()=>{let i={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(t)=>{switch(t.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${t.expected}، ولكن تم إدخال ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${A(t.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return` أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${c} ${t.maximum.toString()} ${g.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${c} ${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${c} ${t.minimum.toString()} ${g.unit}`;return`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${c} ${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${t.prefix}"`;if(c.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${c.suffix}"`;if(c.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${c.includes}"`;if(c.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${c.pattern}`;return`${u[c.format]??t.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${t.divisor}`;case"unrecognized_keys":return`معرف${t.keys.length>1?"ات":""} غريب${t.keys.length>1?"ة":""}: ${G(t.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${t.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${t.origin}`;default:return"مدخل غير مقبول"}}};function e_(){return{localeError:_J()}}var lJ=()=>{let i={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(t)=>{switch(t.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${t.expected}, daxil olan ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Yanlış dəyər: gözlənilən ${A(t.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${c}${t.maximum.toString()} ${g.unit??"element"}`;return`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Çox kiçik: gözlənilən ${t.origin} ${c}${t.minimum.toString()} ${g.unit}`;return`Çox kiçik: gözlənilən ${t.origin} ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Yanlış mətn: "${c.prefix}" ilə başlamalıdır`;if(c.format==="ends_with")return`Yanlış mətn: "${c.suffix}" ilə bitməlidir`;if(c.format==="includes")return`Yanlış mətn: "${c.includes}" daxil olmalıdır`;if(c.format==="regex")return`Yanlış mətn: ${c.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${u[c.format]??t.format}`}case"not_multiple_of":return`Yanlış ədəd: ${t.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${t.keys.length>1?"lar":""}: ${G(t.keys,", ")}`;case"invalid_key":return`${t.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${t.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function p_(){return{localeError:lJ()}}function n4(i,n,r,u){let t=Math.abs(i),c=t%10,g=t%100;if(g>=11&&g<=19)return u;if(c===1)return n;if(c>=2&&c<=4)return r;return u}var $J=()=>{let i={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"лік";case"object":{if(Array.isArray(t))return"масіў";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(t)=>{switch(t.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${t.expected}, атрымана ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Няправільны ўвод: чакалася ${A(t.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g){let h=Number(t.maximum),_=n4(h,g.unit.one,g.unit.few,g.unit.many);return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна ${g.verb} ${c}${t.maximum.toString()} ${_}`}return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна быць ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g){let h=Number(t.minimum),_=n4(h,g.unit.one,g.unit.few,g.unit.many);return`Занадта малы: чакалася, што ${t.origin} павінна ${g.verb} ${c}${t.minimum.toString()} ${_}`}return`Занадта малы: чакалася, што ${t.origin} павінна быць ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${c.prefix}"`;if(c.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${c.suffix}"`;if(c.format==="includes")return`Няправільны радок: павінен змяшчаць "${c.includes}"`;if(c.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${c.pattern}`;return`Няправільны ${u[c.format]??t.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${t.keys.length>1?"ключы":"ключ"}: ${G(t.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${t.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${t.origin}`;default:return"Няправільны ўвод"}}};function d_(){return{localeError:$J()}}var wJ=()=>{let i={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(t)=>{switch(t.code){case"invalid_type":return`Tipus invàlid: s\'esperava ${t.expected}, s\'ha rebut ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Valor invàlid: s\'esperava ${A(t.values[0])}`;return`Opció invàlida: s\'esperava una de ${G(t.values," o ")}`;case"too_big":{let c=t.inclusive?"com a màxim":"menys de",g=n(t.origin);if(g)return`Massa gran: s\'esperava que ${t.origin??"el valor"} contingués ${c} ${t.maximum.toString()} ${g.unit??"elements"}`;return`Massa gran: s\'esperava que ${t.origin??"el valor"} fos ${c} ${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?"com a mínim":"més de",g=n(t.origin);if(g)return`Massa petit: s\'esperava que ${t.origin} contingués ${c} ${t.minimum.toString()} ${g.unit}`;return`Massa petit: s\'esperava que ${t.origin} fos ${c} ${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Format invàlid: ha de començar amb "${c.prefix}"`;if(c.format==="ends_with")return`Format invàlid: ha d\'acabar amb "${c.suffix}"`;if(c.format==="includes")return`Format invàlid: ha d\'incloure "${c.includes}"`;if(c.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${c.pattern}`;return`Format invàlid per a ${u[c.format]??t.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${t.divisor}`;case"unrecognized_keys":return`Clau${t.keys.length>1?"s":""} no reconeguda${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${t.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${t.origin}`;default:return"Entrada invàlida"}}};function a_(){return{localeError:wJ()}}var bJ=()=>{let i={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(t))return"pole";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(t)=>{switch(t.code){case"invalid_type":return`Neplatný vstup: očekáváno ${t.expected}, obdrženo ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Neplatný vstup: očekáváno ${A(t.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Hodnota je příliš velká: ${t.origin??"hodnota"} musí mít ${c}${t.maximum.toString()} ${g.unit??"prvků"}`;return`Hodnota je příliš velká: ${t.origin??"hodnota"} musí být ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Hodnota je příliš malá: ${t.origin??"hodnota"} musí mít ${c}${t.minimum.toString()} ${g.unit??"prvků"}`;return`Hodnota je příliš malá: ${t.origin??"hodnota"} musí být ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Neplatný řetězec: musí začínat na "${c.prefix}"`;if(c.format==="ends_with")return`Neplatný řetězec: musí končit na "${c.suffix}"`;if(c.format==="includes")return`Neplatný řetězec: musí obsahovat "${c.includes}"`;if(c.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${c.pattern}`;return`Neplatný formát ${u[c.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${t.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${G(t.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function s_(){return{localeError:bJ()}}var vJ=()=>{let i={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"Zahl";case"object":{if(Array.isArray(t))return"Array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(t)=>{switch(t.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${t.expected}, erhalten ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Ungültige Eingabe: erwartet ${A(t.values[0])}`;return`Ungültige Option: erwartet eine von ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Zu groß: erwartet, dass ${t.origin??"Wert"} ${c}${t.maximum.toString()} ${g.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${t.origin??"Wert"} ${c}${t.maximum.toString()} ist`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Zu klein: erwartet, dass ${t.origin} ${c}${t.minimum.toString()} ${g.unit} hat`;return`Zu klein: erwartet, dass ${t.origin} ${c}${t.minimum.toString()} ist`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Ungültiger String: muss mit "${c.prefix}" beginnen`;if(c.format==="ends_with")return`Ungültiger String: muss mit "${c.suffix}" enden`;if(c.format==="includes")return`Ungültiger String: muss "${c.includes}" enthalten`;if(c.format==="regex")return`Ungültiger String: muss dem Muster ${c.pattern} entsprechen`;return`Ungültig: ${u[c.format]??t.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${t.divisor} sein`;case"unrecognized_keys":return`${t.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${G(t.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${t.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${t.origin}`;default:return"Ungültige Eingabe"}}};function il(){return{localeError:vJ()}}var fJ=(i)=>{let n=typeof i;switch(n){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return n},OJ=()=>{let i={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function n(u){return i[u]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(u)=>{switch(u.code){case"invalid_type":return`Invalid input: expected ${u.expected}, received ${fJ(u.input)}`;case"invalid_value":if(u.values.length===1)return`Invalid input: expected ${A(u.values[0])}`;return`Invalid option: expected one of ${G(u.values,"|")}`;case"too_big":{let t=u.inclusive?"<=":"<",c=n(u.origin);if(c)return`Too big: expected ${u.origin??"value"} to have ${t}${u.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${u.origin??"value"} to be ${t}${u.maximum.toString()}`}case"too_small":{let t=u.inclusive?">=":">",c=n(u.origin);if(c)return`Too small: expected ${u.origin} to have ${t}${u.minimum.toString()} ${c.unit}`;return`Too small: expected ${u.origin} to be ${t}${u.minimum.toString()}`}case"invalid_format":{let t=u;if(t.format==="starts_with")return`Invalid string: must start with "${t.prefix}"`;if(t.format==="ends_with")return`Invalid string: must end with "${t.suffix}"`;if(t.format==="includes")return`Invalid string: must include "${t.includes}"`;if(t.format==="regex")return`Invalid string: must match pattern ${t.pattern}`;return`Invalid ${r[t.format]??u.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${u.divisor}`;case"unrecognized_keys":return`Unrecognized key${u.keys.length>1?"s":""}: ${G(u.keys,", ")}`;case"invalid_key":return`Invalid key in ${u.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${u.origin}`;default:return"Invalid input"}}};function Wr(){return{localeError:OJ()}}var jJ=()=>{let i={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"número";case"object":{if(Array.isArray(t))return"arreglo";if(t===null)return"nulo";if(Object.getPrototypeOf(t)!==Object.prototype)return t.constructor.name}}return c},u={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(t)=>{switch(t.code){case"invalid_type":return`Entrada inválida: se esperaba ${t.expected}, recibido ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Entrada inválida: se esperaba ${A(t.values[0])}`;return`Opción inválida: se esperaba una de ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Demasiado grande: se esperaba que ${t.origin??"valor"} tuviera ${c}${t.maximum.toString()} ${g.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${t.origin??"valor"} fuera ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Demasiado pequeño: se esperaba que ${t.origin} tuviera ${c}${t.minimum.toString()} ${g.unit}`;return`Demasiado pequeño: se esperaba que ${t.origin} fuera ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Cadena inválida: debe comenzar con "${c.prefix}"`;if(c.format==="ends_with")return`Cadena inválida: debe terminar en "${c.suffix}"`;if(c.format==="includes")return`Cadena inválida: debe incluir "${c.includes}"`;if(c.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${c.pattern}`;return`Inválido ${u[c.format]??t.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Llave${t.keys.length>1?"s":""} desconocida${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Llave inválida en ${t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${t.origin}`;default:return"Entrada inválida"}}};function nl(){return{localeError:jJ()}}var UJ=()=>{let i={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"عدد";case"object":{if(Array.isArray(t))return"آرایه";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(t)=>{switch(t.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${t.expected} می‌بود، ${r(t.input)} دریافت شد`;case"invalid_value":if(t.values.length===1)return`ورودی نامعتبر: می‌بایست ${A(t.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${G(t.values,"|")} می‌بود`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`خیلی بزرگ: ${t.origin??"مقدار"} باید ${c}${t.maximum.toString()} ${g.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${t.origin??"مقدار"} باید ${c}${t.maximum.toString()} باشد`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`خیلی کوچک: ${t.origin} باید ${c}${t.minimum.toString()} ${g.unit} باشد`;return`خیلی کوچک: ${t.origin} باید ${c}${t.minimum.toString()} باشد`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`رشته نامعتبر: باید با "${c.prefix}" شروع شود`;if(c.format==="ends_with")return`رشته نامعتبر: باید با "${c.suffix}" تمام شود`;if(c.format==="includes")return`رشته نامعتبر: باید شامل "${c.includes}" باشد`;if(c.format==="regex")return`رشته نامعتبر: باید با الگوی ${c.pattern} مطابقت داشته باشد`;return`${u[c.format]??t.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${t.divisor} باشد`;case"unrecognized_keys":return`کلید${t.keys.length>1?"های":""} ناشناس: ${G(t.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${t.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${t.origin}`;default:return"ورودی نامعتبر"}}};function tl(){return{localeError:UJ()}}var NJ=()=>{let i={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(t)=>{switch(t.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${t.expected}, oli ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Virheellinen syöte: täytyy olla ${A(t.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Liian suuri: ${g.subject} täytyy olla ${c}${t.maximum.toString()} ${g.unit}`.trim();return`Liian suuri: arvon täytyy olla ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Liian pieni: ${g.subject} täytyy olla ${c}${t.minimum.toString()} ${g.unit}`.trim();return`Liian pieni: arvon täytyy olla ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${c.prefix}"`;if(c.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${c.suffix}"`;if(c.format==="includes")return`Virheellinen syöte: täytyy sisältää "${c.includes}"`;if(c.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${c.pattern}`;return`Virheellinen ${u[c.format]??t.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${t.divisor} monikerta`;case"unrecognized_keys":return`${t.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${G(t.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function rl(){return{localeError:NJ()}}var zJ=()=>{let i={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"nombre";case"object":{if(Array.isArray(t))return"tableau";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(t)=>{switch(t.code){case"invalid_type":return`Entrée invalide : ${t.expected} attendu, ${r(t.input)} reçu`;case"invalid_value":if(t.values.length===1)return`Entrée invalide : ${A(t.values[0])} attendu`;return`Option invalide : une valeur parmi ${G(t.values,"|")} attendue`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Trop grand : ${t.origin??"valeur"} doit ${g.verb} ${c}${t.maximum.toString()} ${g.unit??"élément(s)"}`;return`Trop grand : ${t.origin??"valeur"} doit être ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Trop petit : ${t.origin} doit ${g.verb} ${c}${t.minimum.toString()} ${g.unit}`;return`Trop petit : ${t.origin} doit être ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Chaîne invalide : doit commencer par "${c.prefix}"`;if(c.format==="ends_with")return`Chaîne invalide : doit se terminer par "${c.suffix}"`;if(c.format==="includes")return`Chaîne invalide : doit inclure "${c.includes}"`;if(c.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${c.pattern}`;return`${u[c.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${G(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function ul(){return{localeError:zJ()}}var WJ=()=>{let i={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(t)=>{switch(t.code){case"invalid_type":return`Entrée invalide : attendu ${t.expected}, reçu ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Entrée invalide : attendu ${A(t.values[0])}`;return`Option invalide : attendu l\'une des valeurs suivantes ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"≤":"<",g=n(t.origin);if(g)return`Trop grand : attendu que ${t.origin??"la valeur"} ait ${c}${t.maximum.toString()} ${g.unit}`;return`Trop grand : attendu que ${t.origin??"la valeur"} soit ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?"≥":">",g=n(t.origin);if(g)return`Trop petit : attendu que ${t.origin} ait ${c}${t.minimum.toString()} ${g.unit}`;return`Trop petit : attendu que ${t.origin} soit ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Chaîne invalide : doit commencer par "${c.prefix}"`;if(c.format==="ends_with")return`Chaîne invalide : doit se terminer par "${c.suffix}"`;if(c.format==="includes")return`Chaîne invalide : doit inclure "${c.includes}"`;if(c.format==="regex")return`Chaîne invalide : doit correspondre au motif ${c.pattern}`;return`${u[c.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${G(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function cl(){return{localeError:WJ()}}var DJ=()=>{let i={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג\'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(t)=>{switch(t.code){case"invalid_type":return`קלט לא תקין: צריך ${t.expected}, התקבל ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`קלט לא תקין: צריך ${A(t.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`גדול מדי: ${t.origin??"value"} צריך להיות ${c}${t.maximum.toString()} ${g.unit??"elements"}`;return`גדול מדי: ${t.origin??"value"} צריך להיות ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`קטן מדי: ${t.origin} צריך להיות ${c}${t.minimum.toString()} ${g.unit}`;return`קטן מדי: ${t.origin} צריך להיות ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${c.prefix}"`;if(c.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${c.suffix}"`;if(c.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${c.includes}"`;if(c.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${c.pattern}`;return`${u[c.format]??t.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case"unrecognized_keys":return`מפתח${t.keys.length>1?"ות":""} לא מזוה${t.keys.length>1?"ים":"ה"}: ${G(t.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${t.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${t.origin}`;default:return"קלט לא תקין"}}};function ol(){return{localeError:DJ()}}var JJ=()=>{let i={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"szám";case"object":{if(Array.isArray(t))return"tömb";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(t)=>{switch(t.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${t.expected}, a kapott érték ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Érvénytelen bemenet: a várt érték ${A(t.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Túl nagy: ${t.origin??"érték"} mérete túl nagy ${c}${t.maximum.toString()} ${g.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${t.origin??"érték"} túl nagy: ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Túl kicsi: a bemeneti érték ${t.origin} mérete túl kicsi ${c}${t.minimum.toString()} ${g.unit}`;return`Túl kicsi: a bemeneti érték ${t.origin} túl kicsi ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Érvénytelen string: "${c.prefix}" értékkel kell kezdődnie`;if(c.format==="ends_with")return`Érvénytelen string: "${c.suffix}" értékkel kell végződnie`;if(c.format==="includes")return`Érvénytelen string: "${c.includes}" értéket kell tartalmaznia`;if(c.format==="regex")return`Érvénytelen string: ${c.pattern} mintának kell megfelelnie`;return`Érvénytelen ${u[c.format]??t.format}`}case"not_multiple_of":return`Érvénytelen szám: ${t.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${t.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${t.origin}`;default:return"Érvénytelen bemenet"}}};function gl(){return{localeError:JJ()}}var EJ=()=>{let i={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(t)=>{switch(t.code){case"invalid_type":return`Input tidak valid: diharapkan ${t.expected}, diterima ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Input tidak valid: diharapkan ${A(t.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Terlalu besar: diharapkan ${t.origin??"value"} memiliki ${c}${t.maximum.toString()} ${g.unit??"elemen"}`;return`Terlalu besar: diharapkan ${t.origin??"value"} menjadi ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Terlalu kecil: diharapkan ${t.origin} memiliki ${c}${t.minimum.toString()} ${g.unit}`;return`Terlalu kecil: diharapkan ${t.origin} menjadi ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`String tidak valid: harus dimulai dengan "${c.prefix}"`;if(c.format==="ends_with")return`String tidak valid: harus berakhir dengan "${c.suffix}"`;if(c.format==="includes")return`String tidak valid: harus menyertakan "${c.includes}"`;if(c.format==="regex")return`String tidak valid: harus sesuai pola ${c.pattern}`;return`${u[c.format]??t.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${t.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${t.origin}`;default:return"Input tidak valid"}}};function hl(){return{localeError:EJ()}}var HJ=()=>{let i={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"numero";case"object":{if(Array.isArray(t))return"vettore";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(t)=>{switch(t.code){case"invalid_type":return`Input non valido: atteso ${t.expected}, ricevuto ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Input non valido: atteso ${A(t.values[0])}`;return`Opzione non valida: atteso uno tra ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Troppo grande: ${t.origin??"valore"} deve avere ${c}${t.maximum.toString()} ${g.unit??"elementi"}`;return`Troppo grande: ${t.origin??"valore"} deve essere ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Troppo piccolo: ${t.origin} deve avere ${c}${t.minimum.toString()} ${g.unit}`;return`Troppo piccolo: ${t.origin} deve essere ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Stringa non valida: deve iniziare con "${c.prefix}"`;if(c.format==="ends_with")return`Stringa non valida: deve terminare con "${c.suffix}"`;if(c.format==="includes")return`Stringa non valida: deve includere "${c.includes}"`;if(c.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${c.pattern}`;return`Invalid ${u[c.format]??t.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${t.divisor}`;case"unrecognized_keys":return`Chiav${t.keys.length>1?"i":"e"} non riconosciut${t.keys.length>1?"e":"a"}: ${G(t.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${t.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${t.origin}`;default:return"Input non valido"}}};function _l(){return{localeError:HJ()}}var GJ=()=>{let i={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"数値";case"object":{if(Array.isArray(t))return"配列";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(t)=>{switch(t.code){case"invalid_type":return`無効な入力: ${t.expected}が期待されましたが、${r(t.input)}が入力されました`;case"invalid_value":if(t.values.length===1)return`無効な入力: ${A(t.values[0])}が期待されました`;return`無効な選択: ${G(t.values,"、")}のいずれかである必要があります`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${g.unit??"要素"}${c}である必要があります`;return`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${c}である必要があります`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`小さすぎる値: ${t.origin}は${t.minimum.toString()}${g.unit}${c}である必要があります`;return`小さすぎる値: ${t.origin}は${t.minimum.toString()}${c}である必要があります`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`無効な文字列: "${c.prefix}"で始まる必要があります`;if(c.format==="ends_with")return`無効な文字列: "${c.suffix}"で終わる必要があります`;if(c.format==="includes")return`無効な文字列: "${c.includes}"を含む必要があります`;if(c.format==="regex")return`無効な文字列: パターン${c.pattern}に一致する必要があります`;return`無効な${u[c.format]??t.format}`}case"not_multiple_of":return`無効な数値: ${t.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${t.keys.length>1?"群":""}: ${G(t.keys,"、")}`;case"invalid_key":return`${t.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${t.origin}内の無効な値`;default:return"無効な入力"}}};function ll(){return{localeError:GJ()}}var qJ=()=>{let i={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(t))return"អារេ (Array)";if(t===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(t)=>{switch(t.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${t.expected} ប៉ុន្តែទទួលបាន ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${A(t.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${c} ${t.maximum.toString()} ${g.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${c} ${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`តូចពេក៖ ត្រូវការ ${t.origin} ${c} ${t.minimum.toString()} ${g.unit}`;return`តូចពេក៖ ត្រូវការ ${t.origin} ${c} ${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${c.prefix}"`;if(c.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${c.suffix}"`;if(c.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${c.includes}"`;if(c.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${c.pattern}`;return`មិនត្រឹមត្រូវ៖ ${u[c.format]??t.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${t.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${G(t.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function $l(){return{localeError:qJ()}}var XJ=()=>{let i={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(t)=>{switch(t.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${t.expected}, 받은 타입은 ${r(t.input)}입니다`;case"invalid_value":if(t.values.length===1)return`잘못된 입력: 값은 ${A(t.values[0])} 이어야 합니다`;return`잘못된 옵션: ${G(t.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let c=t.inclusive?"이하":"미만",g=c==="미만"?"이어야 합니다":"여야 합니다",h=n(t.origin),_=h?.unit??"요소";if(h)return`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()}${_} ${c}${g}`;return`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()} ${c}${g}`}case"too_small":{let c=t.inclusive?"이상":"초과",g=c==="이상"?"이어야 합니다":"여야 합니다",h=n(t.origin),_=h?.unit??"요소";if(h)return`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()}${_} ${c}${g}`;return`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()} ${c}${g}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`잘못된 문자열: "${c.prefix}"(으)로 시작해야 합니다`;if(c.format==="ends_with")return`잘못된 문자열: "${c.suffix}"(으)로 끝나야 합니다`;if(c.format==="includes")return`잘못된 문자열: "${c.includes}"을(를) 포함해야 합니다`;if(c.format==="regex")return`잘못된 문자열: 정규식 ${c.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${u[c.format]??t.format}`}case"not_multiple_of":return`잘못된 숫자: ${t.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${G(t.keys,", ")}`;case"invalid_key":return`잘못된 키: ${t.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${t.origin}`;default:return"잘못된 입력"}}};function wl(){return{localeError:XJ()}}var LJ=()=>{let i={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"број";case"object":{if(Array.isArray(t))return"низа";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(t)=>{switch(t.code){case"invalid_type":return`Грешен внес: се очекува ${t.expected}, примено ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Invalid input: expected ${A(t.values[0])}`;return`Грешана опција: се очекува една ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Премногу голем: се очекува ${t.origin??"вредноста"} да има ${c}${t.maximum.toString()} ${g.unit??"елементи"}`;return`Премногу голем: се очекува ${t.origin??"вредноста"} да биде ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Премногу мал: се очекува ${t.origin} да има ${c}${t.minimum.toString()} ${g.unit}`;return`Премногу мал: се очекува ${t.origin} да биде ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Неважечка низа: мора да започнува со "${c.prefix}"`;if(c.format==="ends_with")return`Неважечка низа: мора да завршува со "${c.suffix}"`;if(c.format==="includes")return`Неважечка низа: мора да вклучува "${c.includes}"`;if(c.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${c.pattern}`;return`Invalid ${u[c.format]??t.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${G(t.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${t.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${t.origin}`;default:return"Грешен внес"}}};function bl(){return{localeError:LJ()}}var IJ=()=>{let i={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"nombor";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(t)=>{switch(t.code){case"invalid_type":return`Input tidak sah: dijangka ${t.expected}, diterima ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Input tidak sah: dijangka ${A(t.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Terlalu besar: dijangka ${t.origin??"nilai"} ${g.verb} ${c}${t.maximum.toString()} ${g.unit??"elemen"}`;return`Terlalu besar: dijangka ${t.origin??"nilai"} adalah ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Terlalu kecil: dijangka ${t.origin} ${g.verb} ${c}${t.minimum.toString()} ${g.unit}`;return`Terlalu kecil: dijangka ${t.origin} adalah ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`String tidak sah: mesti bermula dengan "${c.prefix}"`;if(c.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${c.suffix}"`;if(c.format==="includes")return`String tidak sah: mesti mengandungi "${c.includes}"`;if(c.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${c.pattern}`;return`${u[c.format]??t.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${G(t.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${t.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${t.origin}`;default:return"Input tidak sah"}}};function vl(){return{localeError:IJ()}}var YJ=()=>{let i={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"getal";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(t)=>{switch(t.code){case"invalid_type":return`Ongeldige invoer: verwacht ${t.expected}, ontving ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Ongeldige invoer: verwacht ${A(t.values[0])}`;return`Ongeldige optie: verwacht één van ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Te lang: verwacht dat ${t.origin??"waarde"} ${c}${t.maximum.toString()} ${g.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${t.origin??"waarde"} ${c}${t.maximum.toString()} is`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Te kort: verwacht dat ${t.origin} ${c}${t.minimum.toString()} ${g.unit} bevat`;return`Te kort: verwacht dat ${t.origin} ${c}${t.minimum.toString()} is`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Ongeldige tekst: moet met "${c.prefix}" beginnen`;if(c.format==="ends_with")return`Ongeldige tekst: moet op "${c.suffix}" eindigen`;if(c.format==="includes")return`Ongeldige tekst: moet "${c.includes}" bevatten`;if(c.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${c.pattern}`;return`Ongeldig: ${u[c.format]??t.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${t.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${t.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${t.origin}`;default:return"Ongeldige invoer"}}};function fl(){return{localeError:YJ()}}var QJ=()=>{let i={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"tall";case"object":{if(Array.isArray(t))return"liste";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(t)=>{switch(t.code){case"invalid_type":return`Ugyldig input: forventet ${t.expected}, fikk ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Ugyldig verdi: forventet ${A(t.values[0])}`;return`Ugyldig valg: forventet en av ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`For stor(t): forventet ${t.origin??"value"} til å ha ${c}${t.maximum.toString()} ${g.unit??"elementer"}`;return`For stor(t): forventet ${t.origin??"value"} til å ha ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`For lite(n): forventet ${t.origin} til å ha ${c}${t.minimum.toString()} ${g.unit}`;return`For lite(n): forventet ${t.origin} til å ha ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Ugyldig streng: må starte med "${c.prefix}"`;if(c.format==="ends_with")return`Ugyldig streng: må ende med "${c.suffix}"`;if(c.format==="includes")return`Ugyldig streng: må inneholde "${c.includes}"`;if(c.format==="regex")return`Ugyldig streng: må matche mønsteret ${c.pattern}`;return`Ugyldig ${u[c.format]??t.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${G(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function Ol(){return{localeError:QJ()}}var mJ=()=>{let i={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"numara";case"object":{if(Array.isArray(t))return"saf";if(t===null)return"gayb";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(t)=>{switch(t.code){case"invalid_type":return`Fâsit giren: umulan ${t.expected}, alınan ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Fâsit giren: umulan ${A(t.values[0])}`;return`Fâsit tercih: mûteberler ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Fazla büyük: ${t.origin??"value"}, ${c}${t.maximum.toString()} ${g.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${t.origin??"value"}, ${c}${t.maximum.toString()} olmalıydı.`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Fazla küçük: ${t.origin}, ${c}${t.minimum.toString()} ${g.unit} sahip olmalıydı.`;return`Fazla küçük: ${t.origin}, ${c}${t.minimum.toString()} olmalıydı.`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Fâsit metin: "${c.prefix}" ile başlamalı.`;if(c.format==="ends_with")return`Fâsit metin: "${c.suffix}" ile bitmeli.`;if(c.format==="includes")return`Fâsit metin: "${c.includes}" ihtivâ etmeli.`;if(c.format==="regex")return`Fâsit metin: ${c.pattern} nakşına uymalı.`;return`Fâsit ${u[c.format]??t.format}`}case"not_multiple_of":return`Fâsit sayı: ${t.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`${t.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${t.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function jl(){return{localeError:mJ()}}var SJ=()=>{let i={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"liczba";case"object":{if(Array.isArray(t))return"tablica";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(t)=>{switch(t.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${t.expected}, otrzymano ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${A(t.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Za duża wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${c}${t.maximum.toString()} ${g.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Za mała wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${c}${t.minimum.toString()} ${g.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${c.prefix}"`;if(c.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${c.suffix}"`;if(c.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${c.includes}"`;if(c.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${c.pattern}`;return`Nieprawidłow(y/a/e) ${u[c.format]??t.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${t.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${t.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${t.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Ul(){return{localeError:SJ()}}var AJ=()=>{let i={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"número";case"object":{if(Array.isArray(t))return"array";if(t===null)return"nulo";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(t)=>{switch(t.code){case"invalid_type":return`Tipo inválido: esperado ${t.expected}, recebido ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Entrada inválida: esperado ${A(t.values[0])}`;return`Opção inválida: esperada uma das ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Muito grande: esperado que ${t.origin??"valor"} tivesse ${c}${t.maximum.toString()} ${g.unit??"elementos"}`;return`Muito grande: esperado que ${t.origin??"valor"} fosse ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Muito pequeno: esperado que ${t.origin} tivesse ${c}${t.minimum.toString()} ${g.unit}`;return`Muito pequeno: esperado que ${t.origin} fosse ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Texto inválido: deve começar com "${c.prefix}"`;if(c.format==="ends_with")return`Texto inválido: deve terminar com "${c.suffix}"`;if(c.format==="includes")return`Texto inválido: deve incluir "${c.includes}"`;if(c.format==="regex")return`Texto inválido: deve corresponder ao padrão ${c.pattern}`;return`${u[c.format]??t.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Chave${t.keys.length>1?"s":""} desconhecida${t.keys.length>1?"s":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Chave inválida em ${t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${t.origin}`;default:return"Campo inválido"}}};function Nl(){return{localeError:AJ()}}function t4(i,n,r,u){let t=Math.abs(i),c=t%10,g=t%100;if(g>=11&&g<=19)return u;if(c===1)return n;if(c>=2&&c<=4)return r;return u}var BJ=()=>{let i={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"число";case"object":{if(Array.isArray(t))return"массив";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(t)=>{switch(t.code){case"invalid_type":return`Неверный ввод: ожидалось ${t.expected}, получено ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Неверный ввод: ожидалось ${A(t.values[0])}`;return`Неверный вариант: ожидалось одно из ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g){let h=Number(t.maximum),_=t4(h,g.unit.one,g.unit.few,g.unit.many);return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет иметь ${c}${t.maximum.toString()} ${_}`}return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g){let h=Number(t.minimum),_=t4(h,g.unit.one,g.unit.few,g.unit.many);return`Слишком маленькое значение: ожидалось, что ${t.origin} будет иметь ${c}${t.minimum.toString()} ${_}`}return`Слишком маленькое значение: ожидалось, что ${t.origin} будет ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Неверная строка: должна начинаться с "${c.prefix}"`;if(c.format==="ends_with")return`Неверная строка: должна заканчиваться на "${c.suffix}"`;if(c.format==="includes")return`Неверная строка: должна содержать "${c.includes}"`;if(c.format==="regex")return`Неверная строка: должна соответствовать шаблону ${c.pattern}`;return`Неверный ${u[c.format]??t.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспознанн${t.keys.length>1?"ые":"ый"} ключ${t.keys.length>1?"и":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${t.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${t.origin}`;default:return"Неверные входные данные"}}};function zl(){return{localeError:BJ()}}var KJ=()=>{let i={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"število";case"object":{if(Array.isArray(t))return"tabela";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(t)=>{switch(t.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${t.expected}, prejeto ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Neveljaven vnos: pričakovano ${A(t.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} imelo ${c}${t.maximum.toString()} ${g.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Premajhno: pričakovano, da bo ${t.origin} imelo ${c}${t.minimum.toString()} ${g.unit}`;return`Premajhno: pričakovano, da bo ${t.origin} ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Neveljaven niz: mora se začeti z "${c.prefix}"`;if(c.format==="ends_with")return`Neveljaven niz: mora se končati z "${c.suffix}"`;if(c.format==="includes")return`Neveljaven niz: mora vsebovati "${c.includes}"`;if(c.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${c.pattern}`;return`Neveljaven ${u[c.format]??t.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${t.divisor}`;case"unrecognized_keys":return`Neprepoznan${t.keys.length>1?"i ključi":" ključ"}: ${G(t.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${t.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${t.origin}`;default:return"Neveljaven vnos"}}};function Wl(){return{localeError:KJ()}}var VJ=()=>{let i={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"antal";case"object":{if(Array.isArray(t))return"lista";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(t)=>{switch(t.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${t.expected}, fick ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Ogiltig inmatning: förväntat ${A(t.values[0])}`;return`Ogiltigt val: förväntade en av ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`För stor(t): förväntade ${t.origin??"värdet"} att ha ${c}${t.maximum.toString()} ${g.unit??"element"}`;return`För stor(t): förväntat ${t.origin??"värdet"} att ha ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`För lite(t): förväntade ${t.origin??"värdet"} att ha ${c}${t.minimum.toString()} ${g.unit}`;return`För lite(t): förväntade ${t.origin??"värdet"} att ha ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Ogiltig sträng: måste börja med "${c.prefix}"`;if(c.format==="ends_with")return`Ogiltig sträng: måste sluta med "${c.suffix}"`;if(c.format==="includes")return`Ogiltig sträng: måste innehålla "${c.includes}"`;if(c.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${c.pattern}"`;return`Ogiltig(t) ${u[c.format]??t.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${G(t.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${t.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${t.origin??"värdet"}`;default:return"Ogiltig input"}}};function Dl(){return{localeError:VJ()}}var MJ=()=>{let i={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(t))return"அணி";if(t===null)return"வெறுமை";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(t)=>{switch(t.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${t.expected}, பெறப்பட்டது ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${A(t.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${G(t.values,"|")} இல் ஒன்று`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${c}${t.maximum.toString()} ${g.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${c}${t.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${c}${t.minimum.toString()} ${g.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${c}${t.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`தவறான சரம்: "${c.prefix}" இல் தொடங்க வேண்டும்`;if(c.format==="ends_with")return`தவறான சரம்: "${c.suffix}" இல் முடிவடைய வேண்டும்`;if(c.format==="includes")return`தவறான சரம்: "${c.includes}" ஐ உள்ளடக்க வேண்டும்`;if(c.format==="regex")return`தவறான சரம்: ${c.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${u[c.format]??t.format}`}case"not_multiple_of":return`தவறான எண்: ${t.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${t.keys.length>1?"கள்":""}: ${G(t.keys,", ")}`;case"invalid_key":return`${t.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${t.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Jl(){return{localeError:MJ()}}var xJ=()=>{let i={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(t))return"อาร์เรย์ (Array)";if(t===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(t)=>{switch(t.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${t.expected} แต่ได้รับ ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${A(t.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"ไม่เกิน":"น้อยกว่า",g=n(t.origin);if(g)return`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${c} ${t.maximum.toString()} ${g.unit??"รายการ"}`;return`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${c} ${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?"อย่างน้อย":"มากกว่า",g=n(t.origin);if(g)return`น้อยกว่ากำหนด: ${t.origin} ควรมี${c} ${t.minimum.toString()} ${g.unit}`;return`น้อยกว่ากำหนด: ${t.origin} ควรมี${c} ${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${c.prefix}"`;if(c.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${c.suffix}"`;if(c.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${c.includes}" อยู่ในข้อความ`;if(c.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${c.pattern}`;return`รูปแบบไม่ถูกต้อง: ${u[c.format]??t.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${t.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${G(t.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${t.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${t.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function El(){return{localeError:xJ()}}var FJ=(i)=>{let n=typeof i;switch(n){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return n},PJ=()=>{let i={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function n(u){return i[u]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(u)=>{switch(u.code){case"invalid_type":return`Geçersiz değer: beklenen ${u.expected}, alınan ${FJ(u.input)}`;case"invalid_value":if(u.values.length===1)return`Geçersiz değer: beklenen ${A(u.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${G(u.values,"|")}`;case"too_big":{let t=u.inclusive?"<=":"<",c=n(u.origin);if(c)return`Çok büyük: beklenen ${u.origin??"değer"} ${t}${u.maximum.toString()} ${c.unit??"öğe"}`;return`Çok büyük: beklenen ${u.origin??"değer"} ${t}${u.maximum.toString()}`}case"too_small":{let t=u.inclusive?">=":">",c=n(u.origin);if(c)return`Çok küçük: beklenen ${u.origin} ${t}${u.minimum.toString()} ${c.unit}`;return`Çok küçük: beklenen ${u.origin} ${t}${u.minimum.toString()}`}case"invalid_format":{let t=u;if(t.format==="starts_with")return`Geçersiz metin: "${t.prefix}" ile başlamalı`;if(t.format==="ends_with")return`Geçersiz metin: "${t.suffix}" ile bitmeli`;if(t.format==="includes")return`Geçersiz metin: "${t.includes}" içermeli`;if(t.format==="regex")return`Geçersiz metin: ${t.pattern} desenine uymalı`;return`Geçersiz ${r[t.format]??u.format}`}case"not_multiple_of":return`Geçersiz sayı: ${u.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${u.keys.length>1?"lar":""}: ${G(u.keys,", ")}`;case"invalid_key":return`${u.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${u.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Hl(){return{localeError:PJ()}}var yJ=()=>{let i={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"число";case"object":{if(Array.isArray(t))return"масив";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(t)=>{switch(t.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${t.expected}, отримано ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Неправильні вхідні дані: очікується ${A(t.values[0])}`;return`Неправильна опція: очікується одне з ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Занадто велике: очікується, що ${t.origin??"значення"} ${g.verb} ${c}${t.maximum.toString()} ${g.unit??"елементів"}`;return`Занадто велике: очікується, що ${t.origin??"значення"} буде ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Занадто мале: очікується, що ${t.origin} ${g.verb} ${c}${t.minimum.toString()} ${g.unit}`;return`Занадто мале: очікується, що ${t.origin} буде ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Неправильний рядок: повинен починатися з "${c.prefix}"`;if(c.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${c.suffix}"`;if(c.format==="includes")return`Неправильний рядок: повинен містити "${c.includes}"`;if(c.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${c.pattern}`;return`Неправильний ${u[c.format]??t.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${t.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${t.keys.length>1?"і":""}: ${G(t.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${t.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${t.origin}`;default:return"Неправильні вхідні дані"}}};function Gl(){return{localeError:yJ()}}var TJ=()=>{let i={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"نمبر";case"object":{if(Array.isArray(t))return"آرے";if(t===null)return"نل";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(t)=>{switch(t.code){case"invalid_type":return`غلط ان پٹ: ${t.expected} متوقع تھا، ${r(t.input)} موصول ہوا`;case"invalid_value":if(t.values.length===1)return`غلط ان پٹ: ${A(t.values[0])} متوقع تھا`;return`غلط آپشن: ${G(t.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`بہت بڑا: ${t.origin??"ویلیو"} کے ${c}${t.maximum.toString()} ${g.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${t.origin??"ویلیو"} کا ${c}${t.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`بہت چھوٹا: ${t.origin} کے ${c}${t.minimum.toString()} ${g.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${t.origin} کا ${c}${t.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`غلط سٹرنگ: "${c.prefix}" سے شروع ہونا چاہیے`;if(c.format==="ends_with")return`غلط سٹرنگ: "${c.suffix}" پر ختم ہونا چاہیے`;if(c.format==="includes")return`غلط سٹرنگ: "${c.includes}" شامل ہونا چاہیے`;if(c.format==="regex")return`غلط سٹرنگ: پیٹرن ${c.pattern} سے میچ ہونا چاہیے`;return`غلط ${u[c.format]??t.format}`}case"not_multiple_of":return`غلط نمبر: ${t.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${t.keys.length>1?"ز":""}: ${G(t.keys,"، ")}`;case"invalid_key":return`${t.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${t.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function ql(){return{localeError:TJ()}}var kJ=()=>{let i={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"số";case"object":{if(Array.isArray(t))return"mảng";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(t)=>{switch(t.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${t.expected}, nhận được ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${A(t.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`Quá lớn: mong đợi ${t.origin??"giá trị"} ${g.verb} ${c}${t.maximum.toString()} ${g.unit??"phần tử"}`;return`Quá lớn: mong đợi ${t.origin??"giá trị"} ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`Quá nhỏ: mong đợi ${t.origin} ${g.verb} ${c}${t.minimum.toString()} ${g.unit}`;return`Quá nhỏ: mong đợi ${t.origin} ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${c.prefix}"`;if(c.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${c.suffix}"`;if(c.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${c.includes}"`;if(c.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${c.pattern}`;return`${u[c.format]??t.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${t.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${G(t.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${t.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${t.origin}`;default:return"Đầu vào không hợp lệ"}}};function Xl(){return{localeError:kJ()}}var CJ=()=>{let i={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(t))return"数组";if(t===null)return"空值(null)";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(t)=>{switch(t.code){case"invalid_type":return`无效输入:期望 ${t.expected},实际接收 ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`无效输入:期望 ${A(t.values[0])}`;return`无效选项:期望以下之一 ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`数值过大:期望 ${t.origin??"值"} ${c}${t.maximum.toString()} ${g.unit??"个元素"}`;return`数值过大:期望 ${t.origin??"值"} ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`数值过小:期望 ${t.origin} ${c}${t.minimum.toString()} ${g.unit}`;return`数值过小:期望 ${t.origin} ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`无效字符串:必须以 "${c.prefix}" 开头`;if(c.format==="ends_with")return`无效字符串:必须以 "${c.suffix}" 结尾`;if(c.format==="includes")return`无效字符串:必须包含 "${c.includes}"`;if(c.format==="regex")return`无效字符串:必须满足正则表达式 ${c.pattern}`;return`无效${u[c.format]??t.format}`}case"not_multiple_of":return`无效数字:必须是 ${t.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${G(t.keys,", ")}`;case"invalid_key":return`${t.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${t.origin} 中包含无效值(value)`;default:return"无效输入"}}};function Ll(){return{localeError:CJ()}}var RJ=()=>{let i={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function n(t){return i[t]??null}let r=(t)=>{let c=typeof t;switch(c){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return c},u={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(t)=>{switch(t.code){case"invalid_type":return`無效的輸入值:預期為 ${t.expected},但收到 ${r(t.input)}`;case"invalid_value":if(t.values.length===1)return`無效的輸入值:預期為 ${A(t.values[0])}`;return`無效的選項:預期為以下其中之一 ${G(t.values,"|")}`;case"too_big":{let c=t.inclusive?"<=":"<",g=n(t.origin);if(g)return`數值過大:預期 ${t.origin??"值"} 應為 ${c}${t.maximum.toString()} ${g.unit??"個元素"}`;return`數值過大:預期 ${t.origin??"值"} 應為 ${c}${t.maximum.toString()}`}case"too_small":{let c=t.inclusive?">=":">",g=n(t.origin);if(g)return`數值過小:預期 ${t.origin} 應為 ${c}${t.minimum.toString()} ${g.unit}`;return`數值過小:預期 ${t.origin} 應為 ${c}${t.minimum.toString()}`}case"invalid_format":{let c=t;if(c.format==="starts_with")return`無效的字串:必須以 "${c.prefix}" 開頭`;if(c.format==="ends_with")return`無效的字串:必須以 "${c.suffix}" 結尾`;if(c.format==="includes")return`無效的字串:必須包含 "${c.includes}"`;if(c.format==="regex")return`無效的字串:必須符合格式 ${c.pattern}`;return`無效的 ${u[c.format]??t.format}`}case"not_multiple_of":return`無效的數字:必須為 ${t.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${t.keys.length>1?"們":""}:${G(t.keys,"、")}`;case"invalid_key":return`${t.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${t.origin} 中有無效的值`;default:return"無效的輸入值"}}};function Il(){return{localeError:RJ()}}var Yl=Symbol("ZodOutput"),Ql=Symbol("ZodInput");class Jr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...n){let r=n[0];if(this._map.set(i,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,i)}return this}remove(i){return this._map.delete(i),this}get(i){let n=i._zod.parent;if(n){let r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(i)}}return this._map.get(i)}has(i){return this._map.has(i)}}function Oc(){return new Jr}var rn=Oc();function ml(i,n){return new i({type:"string",...I(n)})}function Sl(i,n){return new i({type:"string",coerce:!0,...I(n)})}function jc(i,n){return new i({type:"string",format:"email",check:"string_format",abort:!1,...I(n)})}function Er(i,n){return new i({type:"string",format:"guid",check:"string_format",abort:!1,...I(n)})}function Uc(i,n){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,...I(n)})}function Nc(i,n){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(n)})}function zc(i,n){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(n)})}function Wc(i,n){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(n)})}function Dc(i,n){return new i({type:"string",format:"url",check:"string_format",abort:!1,...I(n)})}function Jc(i,n){return new i({type:"string",format:"emoji",check:"string_format",abort:!1,...I(n)})}function Ec(i,n){return new i({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(n)})}function Hc(i,n){return new i({type:"string",format:"cuid",check:"string_format",abort:!1,...I(n)})}function Gc(i,n){return new i({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(n)})}function qc(i,n){return new i({type:"string",format:"ulid",check:"string_format",abort:!1,...I(n)})}function Xc(i,n){return new i({type:"string",format:"xid",check:"string_format",abort:!1,...I(n)})}function Lc(i,n){return new i({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(n)})}function Ic(i,n){return new i({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(n)})}function Yc(i,n){return new i({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(n)})}function Qc(i,n){return new i({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(n)})}function mc(i,n){return new i({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(n)})}function Sc(i,n){return new i({type:"string",format:"base64",check:"string_format",abort:!1,...I(n)})}function Ac(i,n){return new i({type:"string",format:"base64url",check:"string_format",abort:!1,...I(n)})}function Bc(i,n){return new i({type:"string",format:"e164",check:"string_format",abort:!1,...I(n)})}function Kc(i,n){return new i({type:"string",format:"jwt",check:"string_format",abort:!1,...I(n)})}function Al(i,n){return new i({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(n)})}function Bl(i,n){return new i({type:"string",format:"date",check:"string_format",...I(n)})}function Kl(i,n){return new i({type:"string",format:"time",check:"string_format",precision:null,...I(n)})}function Vl(i,n){return new i({type:"string",format:"duration",check:"string_format",...I(n)})}function Ml(i,n){return new i({type:"number",checks:[],...I(n)})}function xl(i,n){return new i({type:"number",coerce:!0,checks:[],...I(n)})}function Fl(i,n){return new i({type:"number",check:"number_format",abort:!1,format:"safeint",...I(n)})}function Pl(i,n){return new i({type:"number",check:"number_format",abort:!1,format:"float32",...I(n)})}function yl(i,n){return new i({type:"number",check:"number_format",abort:!1,format:"float64",...I(n)})}function Tl(i,n){return new i({type:"number",check:"number_format",abort:!1,format:"int32",...I(n)})}function kl(i,n){return new i({type:"number",check:"number_format",abort:!1,format:"uint32",...I(n)})}function Cl(i,n){return new i({type:"boolean",...I(n)})}function Rl(i,n){return new i({type:"boolean",coerce:!0,...I(n)})}function Zl(i,n){return new i({type:"bigint",...I(n)})}function el(i,n){return new i({type:"bigint",coerce:!0,...I(n)})}function pl(i,n){return new i({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(n)})}function dl(i,n){return new i({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(n)})}function al(i,n){return new i({type:"symbol",...I(n)})}function sl(i,n){return new i({type:"undefined",...I(n)})}function i$(i,n){return new i({type:"null",...I(n)})}function n$(i){return new i({type:"any"})}function Gt(i){return new i({type:"unknown"})}function t$(i,n){return new i({type:"never",...I(n)})}function r$(i,n){return new i({type:"void",...I(n)})}function u$(i,n){return new i({type:"date",...I(n)})}function c$(i,n){return new i({type:"date",coerce:!0,...I(n)})}function o$(i,n){return new i({type:"nan",...I(n)})}function On(i,n){return new hc({check:"less_than",...I(n),value:i,inclusive:!1})}function Fi(i,n){return new hc({check:"less_than",...I(n),value:i,inclusive:!0})}function jn(i,n){return new _c({check:"greater_than",...I(n),value:i,inclusive:!1})}function Yi(i,n){return new _c({check:"greater_than",...I(n),value:i,inclusive:!0})}function g$(i){return jn(0,i)}function h$(i){return On(0,i)}function _$(i){return Fi(0,i)}function l$(i){return Yi(0,i)}function ct(i,n){return new qh({check:"multiple_of",...I(n),value:i})}function qt(i,n){return new Ih({check:"max_size",...I(n),maximum:i})}function ot(i,n){return new Yh({check:"min_size",...I(n),minimum:i})}function Hr(i,n){return new Qh({check:"size_equals",...I(n),size:i})}function Xt(i,n){return new mh({check:"max_length",...I(n),maximum:i})}function Vn(i,n){return new Sh({check:"min_length",...I(n),minimum:i})}function Lt(i,n){return new Ah({check:"length_equals",...I(n),length:i})}function Gr(i,n){return new Bh({check:"string_format",format:"regex",...I(n),pattern:i})}function qr(i){return new Kh({check:"string_format",format:"lowercase",...I(i)})}function Xr(i){return new Vh({check:"string_format",format:"uppercase",...I(i)})}function Lr(i,n){return new Mh({check:"string_format",format:"includes",...I(n),includes:i})}function Ir(i,n){return new xh({check:"string_format",format:"starts_with",...I(n),prefix:i})}function Yr(i,n){return new Fh({check:"string_format",format:"ends_with",...I(n),suffix:i})}function $$(i,n,r){return new Ph({check:"property",property:i,schema:n,...I(r)})}function Qr(i,n){return new yh({check:"mime_type",mime:i,...I(n)})}function Un(i){return new Th({check:"overwrite",tx:i})}function mr(i){return Un((n)=>n.normalize(i))}function Sr(){return Un((i)=>i.trim())}function Ar(){return Un((i)=>i.toLowerCase())}function Br(){return Un((i)=>i.toUpperCase())}function Kr(i,n,r){return new i({type:"array",element:n,...I(r)})}function ZJ(i,n,r){return new i({type:"union",options:n,...I(r)})}function eJ(i,n,r,u){return new i({type:"union",options:r,discriminator:n,...I(u)})}function pJ(i,n,r){return new i({type:"intersection",left:n,right:r})}function w$(i,n,r,u){let t=r instanceof y;return new i({type:"tuple",items:n,rest:t?r:null,...I(t?u:r)})}function dJ(i,n,r,u){return new i({type:"record",keyType:n,valueType:r,...I(u)})}function aJ(i,n,r,u){return new i({type:"map",keyType:n,valueType:r,...I(u)})}function sJ(i,n,r){return new i({type:"set",valueType:n,...I(r)})}function iE(i,n,r){let u=Array.isArray(n)?Object.fromEntries(n.map((t)=>[t,t])):n;return new i({type:"enum",entries:u,...I(r)})}function nE(i,n,r){return new i({type:"enum",entries:n,...I(r)})}function tE(i,n,r){return new i({type:"literal",values:Array.isArray(n)?n:[n],...I(r)})}function b$(i,n){return new i({type:"file",...I(n)})}function rE(i,n){return new i({type:"transform",transform:n})}function uE(i,n){return new i({type:"optional",innerType:n})}function cE(i,n){return new i({type:"nullable",innerType:n})}function oE(i,n,r){return new i({type:"default",innerType:n,get defaultValue(){return typeof r==="function"?r():r}})}function gE(i,n,r){return new i({type:"nonoptional",innerType:n,...I(r)})}function hE(i,n){return new i({type:"success",innerType:n})}function _E(i,n,r){return new i({type:"catch",innerType:n,catchValue:typeof r==="function"?r:()=>r})}function lE(i,n,r){return new i({type:"pipe",in:n,out:r})}function $E(i,n){return new i({type:"readonly",innerType:n})}function wE(i,n,r){return new i({type:"template_literal",parts:n,...I(r)})}function bE(i,n){return new i({type:"lazy",getter:n})}function vE(i,n){return new i({type:"promise",innerType:n})}function v$(i,n,r){let u=I(r);return u.abort??(u.abort=!0),new i({type:"custom",check:"custom",fn:n,...u})}function f$(i,n,r){return new i({type:"custom",check:"custom",fn:n,...I(r)})}function O$(i,n){let{case:r,error:u,truthy:t,falsy:c}=I(n),g=new Set(t??["true","1","yes","on","y","enabled"]),h=new Set(c??["false","0","no","off","n","disabled"]),_=i.Pipe??zr,l=i.Boolean??Ur,w=new(i.Unknown??Kn)({type:"unknown",checks:[{_zod:{check:(b)=>{if(typeof b.value==="string"){let v=b.value;if(r!=="sensitive")v=v.toLowerCase();if(g.has(v))b.value=!0;else if(h.has(v))b.value=!1;else b.issues.push({code:"invalid_value",expected:"stringbool",values:[...g,...h],input:b.value,inst:w})}else b.issues.push({code:"invalid_type",expected:"string",input:b.value})},def:{check:"custom"},onattach:[]}}],error:u});return new _({type:"pipe",in:w,out:new l({type:"boolean",error:u}),error:u})}class j${constructor(i){this._def=i,this.def=i}implement(i){if(typeof i!=="function")throw new Error("implement() must be called with a function");let n=(...r)=>{let u=this._def.input?tc(this._def.input,r,void 0,{callee:n}):r;if(!Array.isArray(u))throw new Error("Invalid arguments schema: not an array or tuple schema.");let t=i(...u);return this._def.output?tc(this._def.output,t,void 0,{callee:n}):t};return n}implementAsync(i){if(typeof i!=="function")throw new Error("implement() must be called with a function");let n=async(...r)=>{let u=this._def.input?await uc(this._def.input,r,void 0,{callee:n}):r;if(!Array.isArray(u))throw new Error("Invalid arguments schema: not an array or tuple schema.");let t=await i(...u);return this._def.output?uc(this._def.output,t,void 0,{callee:n}):t};return n}input(...i){let n=this.constructor;if(Array.isArray(i[0]))return new n({type:"function",input:new ut({type:"tuple",items:i[0],rest:i[1]}),output:this._def.output});return new n({type:"function",input:i[0],output:this._def.output})}output(i){return new this.constructor({type:"function",input:this._def.input,output:i})}}function U$(i){return new j$({type:"function",input:Array.isArray(i?.input)?w$(ut,i?.input):i?.input??Kr(Nr,Gt(Kn)),output:i?.output??Gt(Kn)})}class Vc{constructor(i){this.counter=0,this.metadataRegistry=i?.metadata??rn,this.target=i?.target??"draft-2020-12",this.unrepresentable=i?.unrepresentable??"throw",this.override=i?.override??(()=>{}),this.io=i?.io??"output",this.seen=new Map}process(i,n={path:[],schemaPath:[]}){var r;let u=i._zod.def,t={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(i);if(c){if(c.count++,n.schemaPath.includes(i))c.cycle=n.path;return c.schema}let g={schema:{},count:1,cycle:void 0};if(this.seen.set(i,g),i._zod.toJSONSchema)g.schema=i._zod.toJSONSchema();let h={...n,schemaPath:[...n.schemaPath,i],path:n.path},_=i._zod.parent;if(_)g.ref=_,this.process(_,h),this.seen.get(_).isParent=!0;else{let w=g.schema;switch(u.type){case"string":{let b=w;b.type="string";let{minimum:v,maximum:f,format:U,patterns:z,contentEncoding:J}=i._zod.bag;if(typeof v==="number")b.minLength=v;if(typeof f==="number")b.maxLength=f;if(U){if(b.format=t[U]??U,b.format==="")delete b.format}if(J)b.contentEncoding=J;if(z&&z.size>0){let N=[...z];if(N.length===1)b.pattern=N[0].source;else if(N.length>1)g.schema.allOf=[...N.map((j)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:j.source}))]}break}case"number":{let b=w,{minimum:v,maximum:f,format:U,multipleOf:z,exclusiveMaximum:J,exclusiveMinimum:N}=i._zod.bag;if(typeof U==="string"&&U.includes("int"))b.type="integer";else b.type="number";if(typeof N==="number")b.exclusiveMinimum=N;if(typeof v==="number"){if(b.minimum=v,typeof N==="number")if(N>=v)delete b.minimum;else delete b.exclusiveMinimum}if(typeof J==="number")b.exclusiveMaximum=J;if(typeof f==="number"){if(b.maximum=f,typeof J==="number")if(J<=f)delete b.maximum;else delete b.exclusiveMaximum}if(typeof z==="number")b.multipleOf=z;break}case"boolean":{let b=w;b.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{let b=w;b.type="null";break}case"null":{w.type="null";break}case"any":break;case"unknown":break;case"never":{w.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let b=w,{minimum:v,maximum:f}=i._zod.bag;if(typeof v==="number")b.minItems=v;if(typeof f==="number")b.maxItems=f;b.type="array",b.items=this.process(u.element,{...h,path:[...h.path,"items"]});break}case"object":{let b=w;b.type="object",b.properties={};let v=u.shape;for(let z in v)b.properties[z]=this.process(v[z],{...h,path:[...h.path,"properties",z]});let f=new Set(Object.keys(v)),U=new Set([...f].filter((z)=>{let J=u.shape[z]._zod;if(this.io==="input")return J.optin===void 0;else return J.optout===void 0}));if(U.size>0)b.required=Array.from(U);if(u.catchall?._zod.def.type==="never")b.additionalProperties=!1;else if(!u.catchall){if(this.io==="output")b.additionalProperties=!1}else if(u.catchall)b.additionalProperties=this.process(u.catchall,{...h,path:[...h.path,"additionalProperties"]});break}case"union":{let b=w;b.anyOf=u.options.map((v,f)=>this.process(v,{...h,path:[...h.path,"anyOf",f]}));break}case"intersection":{let b=w,v=this.process(u.left,{...h,path:[...h.path,"allOf",0]}),f=this.process(u.right,{...h,path:[...h.path,"allOf",1]}),U=(J)=>("allOf"in J)&&Object.keys(J).length===1,z=[...U(v)?v.allOf:[v],...U(f)?f.allOf:[f]];b.allOf=z;break}case"tuple":{let b=w;b.type="array";let v=u.items.map((z,J)=>this.process(z,{...h,path:[...h.path,"prefixItems",J]}));if(this.target==="draft-2020-12")b.prefixItems=v;else b.items=v;if(u.rest){let z=this.process(u.rest,{...h,path:[...h.path,"items"]});if(this.target==="draft-2020-12")b.items=z;else b.additionalItems=z}if(u.rest)b.items=this.process(u.rest,{...h,path:[...h.path,"items"]});let{minimum:f,maximum:U}=i._zod.bag;if(typeof f==="number")b.minItems=f;if(typeof U==="number")b.maxItems=U;break}case"record":{let b=w;b.type="object",b.propertyNames=this.process(u.keyType,{...h,path:[...h.path,"propertyNames"]}),b.additionalProperties=this.process(u.valueType,{...h,path:[...h.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let b=w,v=gr(u.entries);if(v.every((f)=>typeof f==="number"))b.type="number";if(v.every((f)=>typeof f==="string"))b.type="string";b.enum=v;break}case"literal":{let b=w,v=[];for(let f of u.values)if(f===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof f==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else v.push(Number(f));else v.push(f);if(v.length===0);else if(v.length===1){let f=v[0];b.type=f===null?"null":typeof f,b.const=f}else{if(v.every((f)=>typeof f==="number"))b.type="number";if(v.every((f)=>typeof f==="string"))b.type="string";if(v.every((f)=>typeof f==="boolean"))b.type="string";if(v.every((f)=>f===null))b.type="null";b.enum=v}break}case"file":{let b=w,v={type:"string",format:"binary",contentEncoding:"binary"},{minimum:f,maximum:U,mime:z}=i._zod.bag;if(f!==void 0)v.minLength=f;if(U!==void 0)v.maxLength=U;if(z)if(z.length===1)v.contentMediaType=z[0],Object.assign(b,v);else b.anyOf=z.map((J)=>{return{...v,contentMediaType:J}});else Object.assign(b,v);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let b=this.process(u.innerType,h);w.anyOf=[b,{type:"null"}];break}case"nonoptional":{this.process(u.innerType,h),g.ref=u.innerType;break}case"success":{let b=w;b.type="boolean";break}case"default":{this.process(u.innerType,h),g.ref=u.innerType,w.default=u.defaultValue;break}case"prefault":{if(this.process(u.innerType,h),g.ref=u.innerType,this.io==="input")w._prefault=u.defaultValue;break}case"catch":{this.process(u.innerType,h),g.ref=u.innerType;let b;try{b=u.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}w.default=b;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let b=w,v=i._zod.pattern;if(!v)throw new Error("Pattern not found in template literal");b.type="string",b.pattern=v.source;break}case"pipe":{let b=this.io==="input"?u.in._zod.def.type==="transform"?u.out:u.in:u.out;this.process(b,h),g.ref=b;break}case"readonly":{this.process(u.innerType,h),g.ref=u.innerType,w.readOnly=!0;break}case"promise":{this.process(u.innerType,h),g.ref=u.innerType;break}case"optional":{this.process(u.innerType,h),g.ref=u.innerType;break}case"lazy":{let b=i._zod.innerType;this.process(b,h),g.ref=b;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}let l=this.metadataRegistry.get(i);if(l)Object.assign(g.schema,l);if(this.io==="input"&&vi(i))delete g.schema.examples,delete g.schema.default;if(this.io==="input"&&g.schema._prefault)(r=g.schema).default??(r.default=g.schema._prefault);return delete g.schema._prefault,this.seen.get(i).schema}emit(i,n){let r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},u=this.seen.get(i);if(!u)throw new Error("Unprocessed schema. This is a bug in Zod.");let t=(l)=>{let $=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let f=r.external.registry.get(l[0])?.id;if(f)return{ref:r.external.uri(f)};let U=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=U,{defId:U,ref:`${r.external.uri("__shared")}#/${$}/${U}`}}if(l[1]===u)return{ref:"#"};let b=`${"#"}/${$}/`,v=l[1].schema.id??`__schema${this.counter++}`;return{defId:v,ref:b+v}},c=(l)=>{if(l[1].schema.$ref)return;let $=l[1],{ref:w,defId:b}=t(l);if($.def={...$.schema},b)$.defId=b;let v=$.schema;for(let f in v)delete v[f];v.$ref=w};for(let l of this.seen.entries()){let $=l[1];if(i===l[0]){c(l);continue}if(r.external){let b=r.external.registry.get(l[0])?.id;if(i!==l[0]&&b){c(l);continue}}if(this.metadataRegistry.get(l[0])?.id){c(l);continue}if($.cycle){if(r.cycles==="throw")throw new Error(`Cycle detected: #/${$.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`);else if(r.cycles==="ref")c(l);continue}if($.count>1){if(r.reused==="ref"){c(l);continue}}}let g=(l,$)=>{let w=this.seen.get(l),b=w.def??w.schema,v={...b};if(w.ref===null)return;let f=w.ref;if(w.ref=null,f){g(f,$);let U=this.seen.get(f).schema;if(U.$ref&&$.target==="draft-7")b.allOf=b.allOf??[],b.allOf.push(U);else Object.assign(b,U),Object.assign(b,v)}if(!w.isParent)this.override({zodSchema:l,jsonSchema:b})};for(let l of[...this.seen.entries()].reverse())g(l[0],{target:this.target});let h={};if(this.target==="draft-2020-12")h.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")h.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(h,u.def);let _=r.external?.defs??{};for(let l of this.seen.entries()){let $=l[1];if($.def&&$.defId)_[$.defId]=$.def}if(!r.external&&Object.keys(_).length>0)if(this.target==="draft-2020-12")h.$defs=_;else h.definitions=_;try{return JSON.parse(JSON.stringify(h))}catch(l){throw new Error("Error converting schema to JSON.")}}}function Vr(i,n){if(i instanceof Jr){let u=new Vc(n),t={};for(let h of i._idmap.entries()){let[_,l]=h;u.process(l)}let c={},g={registry:i,uri:n?.uri||((h)=>h),defs:t};for(let h of i._idmap.entries()){let[_,l]=h;c[_]=u.emit(l,{...n,external:g})}if(Object.keys(t).length>0){let h=u.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[h]:t}}return{schemas:c}}let r=new Vc(n);return r.process(i),r.emit(i,n)}function vi(i,n){let r=n??{seen:new Set};if(r.seen.has(i))return!1;r.seen.add(i);let t=i._zod.def;switch(t.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return vi(t.element,r);case"object":{for(let c in t.shape)if(vi(t.shape[c],r))return!0;return!1}case"union":{for(let c of t.options)if(vi(c,r))return!0;return!1}case"intersection":return vi(t.left,r)||vi(t.right,r);case"tuple":{for(let c of t.items)if(vi(c,r))return!0;if(t.rest&&vi(t.rest,r))return!0;return!1}case"record":return vi(t.keyType,r)||vi(t.valueType,r);case"map":return vi(t.keyType,r)||vi(t.valueType,r);case"set":return vi(t.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return vi(t.innerType,r);case"lazy":return vi(t.getter(),r);case"default":return vi(t.innerType,r);case"prefault":return vi(t.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return vi(t.in,r)||vi(t.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${t.type}`)}var r4={};var yc={};Xn(yc,{time:()=>W$,duration:()=>D$,datetime:()=>N$,date:()=>z$,ZodISOTime:()=>Fc,ZodISODuration:()=>Pc,ZodISODateTime:()=>Mc,ZodISODate:()=>xc});var Mc=D("ZodISODateTime",(i,n)=>{u_.init(i,n),ni.init(i,n)});function N$(i){return Al(Mc,i)}var xc=D("ZodISODate",(i,n)=>{c_.init(i,n),ni.init(i,n)});function z$(i){return Bl(xc,i)}var Fc=D("ZodISOTime",(i,n)=>{o_.init(i,n),ni.init(i,n)});function W$(i){return Kl(Fc,i)}var Pc=D("ZodISODuration",(i,n)=>{g_.init(i,n),ni.init(i,n)});function D$(i){return Vl(Pc,i)}var c4=(i,n)=>{vr.init(i,n),i.name="ZodError",Object.defineProperties(i,{format:{value:(r)=>Or(i,r)},flatten:{value:(r)=>fr(i,r)},addIssue:{value:(r)=>i.issues.push(r)},addIssues:{value:(r)=>i.issues.push(...r)},isEmpty:{get(){return i.issues.length===0}}})},OE=D("ZodError",c4),It=D("ZodError",c4,{Parent:Error});var J$=nc(It),E$=rc(It),H$=cc(It),Mr=oc(It);var C=D("ZodType",(i,n)=>{return y.init(i,n),i.def=n,Object.defineProperty(i,"_def",{value:n}),i.check=(...r)=>{return i.clone({...n,checks:[...n.checks??[],...r.map((u)=>typeof u==="function"?{_zod:{check:u,def:{check:"custom"},onattach:[]}}:u)]})},i.clone=(r,u)=>Si(i,r,u),i.brand=()=>i,i.register=(r,u)=>{return r.add(i,u),i},i.parse=(r,u)=>J$(i,r,u,{callee:i.parse}),i.safeParse=(r,u)=>H$(i,r,u),i.parseAsync=async(r,u)=>E$(i,r,u,{callee:i.parseAsync}),i.safeParseAsync=async(r,u)=>Mr(i,r,u),i.spa=i.safeParseAsync,i.refine=(r,u)=>i.check(k4(r,u)),i.superRefine=(r)=>i.check(C4(r)),i.overwrite=(r)=>i.check(Un(r)),i.optional=()=>Cc(i),i.nullable=()=>Rc(i),i.nullish=()=>Cc(Rc(i)),i.nonoptional=(r)=>m4(i,r),i.array=()=>Z$(i),i.or=(r)=>sc([i,r]),i.and=(r)=>U4(i,r),i.transform=(r)=>Zc(i,d$(r)),i.default=(r)=>I4(i,r),i.prefault=(r)=>Q4(i,r),i.catch=(r)=>B4(i,r),i.pipe=(r)=>Zc(i,r),i.readonly=()=>M4(i),i.describe=(r)=>{let u=i.clone();return rn.add(u,{description:r}),u},Object.defineProperty(i,"description",{get(){return rn.get(i)?.description},configurable:!0}),i.meta=(...r)=>{if(r.length===0)return rn.get(i);let u=i.clone();return rn.add(u,r[0]),u},i.isOptional=()=>i.safeParse(void 0).success,i.isNullable=()=>i.safeParse(null).success,i}),X$=D("_ZodString",(i,n)=>{jr.init(i,n),C.init(i,n);let r=i._zod.bag;i.format=r.format??null,i.minLength=r.minimum??null,i.maxLength=r.maximum??null,i.regex=(...u)=>i.check(Gr(...u)),i.includes=(...u)=>i.check(Lr(...u)),i.startsWith=(...u)=>i.check(Ir(...u)),i.endsWith=(...u)=>i.check(Yr(...u)),i.min=(...u)=>i.check(Vn(...u)),i.max=(...u)=>i.check(Xt(...u)),i.length=(...u)=>i.check(Lt(...u)),i.nonempty=(...u)=>i.check(Vn(1,...u)),i.lowercase=(u)=>i.check(qr(u)),i.uppercase=(u)=>i.check(Xr(u)),i.trim=()=>i.check(Sr()),i.normalize=(...u)=>i.check(mr(...u)),i.toLowerCase=()=>i.check(Ar()),i.toUpperCase=()=>i.check(Br())}),ec=D("ZodString",(i,n)=>{jr.init(i,n),X$.init(i,n),i.email=(r)=>i.check(jc(L$,r)),i.url=(r)=>i.check(Dc(I$,r)),i.jwt=(r)=>i.check(Kc(k$,r)),i.emoji=(r)=>i.check(Jc(Y$,r)),i.guid=(r)=>i.check(Er(Tc,r)),i.uuid=(r)=>i.check(Uc(zn,r)),i.uuidv4=(r)=>i.check(Nc(zn,r)),i.uuidv6=(r)=>i.check(zc(zn,r)),i.uuidv7=(r)=>i.check(Wc(zn,r)),i.nanoid=(r)=>i.check(Ec(Q$,r)),i.guid=(r)=>i.check(Er(Tc,r)),i.cuid=(r)=>i.check(Hc(m$,r)),i.cuid2=(r)=>i.check(Gc(S$,r)),i.ulid=(r)=>i.check(qc(A$,r)),i.base64=(r)=>i.check(Sc(P$,r)),i.base64url=(r)=>i.check(Ac(y$,r)),i.xid=(r)=>i.check(Xc(B$,r)),i.ksuid=(r)=>i.check(Lc(K$,r)),i.ipv4=(r)=>i.check(Ic(V$,r)),i.ipv6=(r)=>i.check(Yc(M$,r)),i.cidrv4=(r)=>i.check(Qc(x$,r)),i.cidrv6=(r)=>i.check(mc(F$,r)),i.e164=(r)=>i.check(Bc(T$,r)),i.datetime=(r)=>i.check(N$(r)),i.date=(r)=>i.check(z$(r)),i.time=(r)=>i.check(W$(r)),i.duration=(r)=>i.check(D$(r))});function G$(i){return ml(ec,i)}var ni=D("ZodStringFormat",(i,n)=>{ii.init(i,n),X$.init(i,n)}),L$=D("ZodEmail",(i,n)=>{eh.init(i,n),ni.init(i,n)});function UE(i){return jc(L$,i)}var Tc=D("ZodGUID",(i,n)=>{Rh.init(i,n),ni.init(i,n)});function NE(i){return Er(Tc,i)}var zn=D("ZodUUID",(i,n)=>{Zh.init(i,n),ni.init(i,n)});function zE(i){return Uc(zn,i)}function WE(i){return Nc(zn,i)}function DE(i){return zc(zn,i)}function JE(i){return Wc(zn,i)}var I$=D("ZodURL",(i,n)=>{ph.init(i,n),ni.init(i,n)});function EE(i){return Dc(I$,i)}var Y$=D("ZodEmoji",(i,n)=>{dh.init(i,n),ni.init(i,n)});function HE(i){return Jc(Y$,i)}var Q$=D("ZodNanoID",(i,n)=>{ah.init(i,n),ni.init(i,n)});function GE(i){return Ec(Q$,i)}var m$=D("ZodCUID",(i,n)=>{sh.init(i,n),ni.init(i,n)});function qE(i){return Hc(m$,i)}var S$=D("ZodCUID2",(i,n)=>{i_.init(i,n),ni.init(i,n)});function XE(i){return Gc(S$,i)}var A$=D("ZodULID",(i,n)=>{n_.init(i,n),ni.init(i,n)});function LE(i){return qc(A$,i)}var B$=D("ZodXID",(i,n)=>{t_.init(i,n),ni.init(i,n)});function IE(i){return Xc(B$,i)}var K$=D("ZodKSUID",(i,n)=>{r_.init(i,n),ni.init(i,n)});function YE(i){return Lc(K$,i)}var V$=D("ZodIPv4",(i,n)=>{h_.init(i,n),ni.init(i,n)});function QE(i){return Ic(V$,i)}var M$=D("ZodIPv6",(i,n)=>{__.init(i,n),ni.init(i,n)});function mE(i){return Yc(M$,i)}var x$=D("ZodCIDRv4",(i,n)=>{l_.init(i,n),ni.init(i,n)});function SE(i){return Qc(x$,i)}var F$=D("ZodCIDRv6",(i,n)=>{$_.init(i,n),ni.init(i,n)});function AE(i){return mc(F$,i)}var P$=D("ZodBase64",(i,n)=>{b_.init(i,n),ni.init(i,n)});function BE(i){return Sc(P$,i)}var y$=D("ZodBase64URL",(i,n)=>{v_.init(i,n),ni.init(i,n)});function KE(i){return Ac(y$,i)}var T$=D("ZodE164",(i,n)=>{f_.init(i,n),ni.init(i,n)});function VE(i){return Bc(T$,i)}var k$=D("ZodJWT",(i,n)=>{O_.init(i,n),ni.init(i,n)});function ME(i){return Kc(k$,i)}var Fr=D("ZodNumber",(i,n)=>{bc.init(i,n),C.init(i,n),i.gt=(u,t)=>i.check(jn(u,t)),i.gte=(u,t)=>i.check(Yi(u,t)),i.min=(u,t)=>i.check(Yi(u,t)),i.lt=(u,t)=>i.check(On(u,t)),i.lte=(u,t)=>i.check(Fi(u,t)),i.max=(u,t)=>i.check(Fi(u,t)),i.int=(u)=>i.check(q$(u)),i.safe=(u)=>i.check(q$(u)),i.positive=(u)=>i.check(jn(0,u)),i.nonnegative=(u)=>i.check(Yi(0,u)),i.negative=(u)=>i.check(On(0,u)),i.nonpositive=(u)=>i.check(Fi(0,u)),i.multipleOf=(u,t)=>i.check(ct(u,t)),i.step=(u,t)=>i.check(ct(u,t)),i.finite=()=>i;let r=i._zod.bag;i.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,i.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,i.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),i.isFinite=!0,i.format=r.format??null});function o4(i){return Ml(Fr,i)}var Yt=D("ZodNumberFormat",(i,n)=>{j_.init(i,n),Fr.init(i,n)});function q$(i){return Fl(Yt,i)}function xE(i){return Pl(Yt,i)}function FE(i){return yl(Yt,i)}function PE(i){return Tl(Yt,i)}function yE(i){return kl(Yt,i)}var Pr=D("ZodBoolean",(i,n)=>{Ur.init(i,n),C.init(i,n)});function g4(i){return Cl(Pr,i)}var yr=D("ZodBigInt",(i,n)=>{vc.init(i,n),C.init(i,n),i.gte=(u,t)=>i.check(Yi(u,t)),i.min=(u,t)=>i.check(Yi(u,t)),i.gt=(u,t)=>i.check(jn(u,t)),i.gte=(u,t)=>i.check(Yi(u,t)),i.min=(u,t)=>i.check(Yi(u,t)),i.lt=(u,t)=>i.check(On(u,t)),i.lte=(u,t)=>i.check(Fi(u,t)),i.max=(u,t)=>i.check(Fi(u,t)),i.positive=(u)=>i.check(jn(BigInt(0),u)),i.negative=(u)=>i.check(On(BigInt(0),u)),i.nonpositive=(u)=>i.check(Fi(BigInt(0),u)),i.nonnegative=(u)=>i.check(Yi(BigInt(0),u)),i.multipleOf=(u,t)=>i.check(ct(u,t));let r=i._zod.bag;i.minValue=r.minimum??null,i.maxValue=r.maximum??null,i.format=r.format??null});function TE(i){return Zl(yr,i)}var C$=D("ZodBigIntFormat",(i,n)=>{U_.init(i,n),yr.init(i,n)});function kE(i){return pl(C$,i)}function CE(i){return dl(C$,i)}var h4=D("ZodSymbol",(i,n)=>{N_.init(i,n),C.init(i,n)});function RE(i){return al(h4,i)}var _4=D("ZodUndefined",(i,n)=>{z_.init(i,n),C.init(i,n)});function ZE(i){return sl(_4,i)}var l4=D("ZodNull",(i,n)=>{W_.init(i,n),C.init(i,n)});function $4(i){return i$(l4,i)}var w4=D("ZodAny",(i,n)=>{D_.init(i,n),C.init(i,n)});function eE(){return n$(w4)}var R$=D("ZodUnknown",(i,n)=>{Kn.init(i,n),C.init(i,n)});function kc(){return Gt(R$)}var b4=D("ZodNever",(i,n)=>{J_.init(i,n),C.init(i,n)});function pc(i){return t$(b4,i)}var v4=D("ZodVoid",(i,n)=>{E_.init(i,n),C.init(i,n)});function pE(i){return r$(v4,i)}var dc=D("ZodDate",(i,n)=>{H_.init(i,n),C.init(i,n),i.min=(u,t)=>i.check(Yi(u,t)),i.max=(u,t)=>i.check(Fi(u,t));let r=i._zod.bag;i.minDate=r.minimum?new Date(r.minimum):null,i.maxDate=r.maximum?new Date(r.maximum):null});function dE(i){return u$(dc,i)}var f4=D("ZodArray",(i,n)=>{Nr.init(i,n),C.init(i,n),i.element=n.element,i.min=(r,u)=>i.check(Vn(r,u)),i.nonempty=(r)=>i.check(Vn(1,r)),i.max=(r,u)=>i.check(Xt(r,u)),i.length=(r,u)=>i.check(Lt(r,u)),i.unwrap=()=>i.element});function Z$(i,n){return Kr(f4,i,n)}function aE(i){let n=i._zod.def.shape;return H4(Object.keys(n))}var ac=D("ZodObject",(i,n)=>{G_.init(i,n),C.init(i,n),S.defineLazy(i,"shape",()=>{return Object.fromEntries(Object.entries(i._zod.def.shape))}),i.keyof=()=>J4(Object.keys(i._zod.def.shape)),i.catchall=(r)=>i.clone({...i._zod.def,catchall:r}),i.passthrough=()=>i.clone({...i._zod.def,catchall:kc()}),i.loose=()=>i.clone({...i._zod.def,catchall:kc()}),i.strict=()=>i.clone({...i._zod.def,catchall:pc()}),i.strip=()=>i.clone({...i._zod.def,catchall:void 0}),i.extend=(r)=>{return S.extend(i,r)},i.merge=(r)=>S.merge(i,r),i.pick=(r)=>S.pick(i,r),i.omit=(r)=>S.omit(i,r),i.partial=(...r)=>S.partial(a$,i,r[0]),i.required=(...r)=>S.required(s$,i,r[0])});function sE(i,n){let r={type:"object",get shape(){return S.assignProp(this,"shape",{...i}),this.shape},...S.normalizeParams(n)};return new ac(r)}function iH(i,n){return new ac({type:"object",get shape(){return S.assignProp(this,"shape",{...i}),this.shape},catchall:pc(),...S.normalizeParams(n)})}function nH(i,n){return new ac({type:"object",get shape(){return S.assignProp(this,"shape",{...i}),this.shape},catchall:kc(),...S.normalizeParams(n)})}var e$=D("ZodUnion",(i,n)=>{fc.init(i,n),C.init(i,n),i.options=n.options});function sc(i,n){return new e$({type:"union",options:i,...S.normalizeParams(n)})}var O4=D("ZodDiscriminatedUnion",(i,n)=>{e$.init(i,n),q_.init(i,n)});function tH(i,n,r){return new O4({type:"union",options:n,discriminator:i,...S.normalizeParams(r)})}var j4=D("ZodIntersection",(i,n)=>{X_.init(i,n),C.init(i,n)});function U4(i,n){return new j4({type:"intersection",left:i,right:n})}var N4=D("ZodTuple",(i,n)=>{ut.init(i,n),C.init(i,n),i.rest=(r)=>i.clone({...i._zod.def,rest:r})});function rH(i,n,r){let u=n instanceof y,t=u?r:n;return new N4({type:"tuple",items:i,rest:u?n:null,...S.normalizeParams(t)})}var p$=D("ZodRecord",(i,n)=>{L_.init(i,n),C.init(i,n),i.keyType=n.keyType,i.valueType=n.valueType});function z4(i,n,r){return new p$({type:"record",keyType:i,valueType:n,...S.normalizeParams(r)})}function uH(i,n,r){return new p$({type:"record",keyType:sc([i,pc()]),valueType:n,...S.normalizeParams(r)})}var W4=D("ZodMap",(i,n)=>{I_.init(i,n),C.init(i,n),i.keyType=n.keyType,i.valueType=n.valueType});function cH(i,n,r){return new W4({type:"map",keyType:i,valueType:n,...S.normalizeParams(r)})}var D4=D("ZodSet",(i,n)=>{Y_.init(i,n),C.init(i,n),i.min=(...r)=>i.check(ot(...r)),i.nonempty=(r)=>i.check(ot(1,r)),i.max=(...r)=>i.check(qt(...r)),i.size=(...r)=>i.check(Hr(...r))});function oH(i,n){return new D4({type:"set",valueType:i,...S.normalizeParams(n)})}var xr=D("ZodEnum",(i,n)=>{Q_.init(i,n),C.init(i,n),i.enum=n.entries,i.options=Object.values(n.entries);let r=new Set(Object.keys(n.entries));i.extract=(u,t)=>{let c={};for(let g of u)if(r.has(g))c[g]=n.entries[g];else throw new Error(`Key ${g} not found in enum`);return new xr({...n,checks:[],...S.normalizeParams(t),entries:c})},i.exclude=(u,t)=>{let c={...n.entries};for(let g of u)if(r.has(g))delete c[g];else throw new Error(`Key ${g} not found in enum`);return new xr({...n,checks:[],...S.normalizeParams(t),entries:c})}});function J4(i,n){let r=Array.isArray(i)?Object.fromEntries(i.map((u)=>[u,u])):i;return new xr({type:"enum",entries:r,...S.normalizeParams(n)})}function gH(i,n){return new xr({type:"enum",entries:i,...S.normalizeParams(n)})}var E4=D("ZodLiteral",(i,n)=>{m_.init(i,n),C.init(i,n),i.values=new Set(n.values),Object.defineProperty(i,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function H4(i,n){return new E4({type:"literal",values:Array.isArray(i)?i:[i],...S.normalizeParams(n)})}var G4=D("ZodFile",(i,n)=>{S_.init(i,n),C.init(i,n),i.min=(r,u)=>i.check(ot(r,u)),i.max=(r,u)=>i.check(qt(r,u)),i.mime=(r,u)=>i.check(Qr(Array.isArray(r)?r:[r],u))});function hH(i){return b$(G4,i)}var q4=D("ZodTransform",(i,n)=>{A_.init(i,n),C.init(i,n),i._zod.parse=(r,u)=>{r.addIssue=(c)=>{if(typeof c==="string")r.issues.push(S.issue(c,r.value,n));else{let g=c;if(g.fatal)g.continue=!1;g.code??(g.code="custom"),g.input??(g.input=r.value),g.inst??(g.inst=i),g.continue??(g.continue=!0),r.issues.push(S.issue(g))}};let t=n.transform(r.value,r);if(t instanceof Promise)return t.then((c)=>{return r.value=c,r});return r.value=t,r}});function d$(i){return new q4({type:"transform",transform:i})}var a$=D("ZodOptional",(i,n)=>{B_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType});function Cc(i){return new a$({type:"optional",innerType:i})}var X4=D("ZodNullable",(i,n)=>{K_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType});function Rc(i){return new X4({type:"nullable",innerType:i})}function _H(i){return Cc(Rc(i))}var L4=D("ZodDefault",(i,n)=>{V_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType,i.removeDefault=i.unwrap});function I4(i,n){return new L4({type:"default",innerType:i,get defaultValue(){return typeof n==="function"?n():n}})}var Y4=D("ZodPrefault",(i,n)=>{M_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType});function Q4(i,n){return new Y4({type:"prefault",innerType:i,get defaultValue(){return typeof n==="function"?n():n}})}var s$=D("ZodNonOptional",(i,n)=>{x_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType});function m4(i,n){return new s$({type:"nonoptional",innerType:i,...S.normalizeParams(n)})}var S4=D("ZodSuccess",(i,n)=>{F_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType});function lH(i){return new S4({type:"success",innerType:i})}var A4=D("ZodCatch",(i,n)=>{P_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType,i.removeCatch=i.unwrap});function B4(i,n){return new A4({type:"catch",innerType:i,catchValue:typeof n==="function"?n:()=>n})}var K4=D("ZodNaN",(i,n)=>{y_.init(i,n),C.init(i,n)});function $H(i){return o$(K4,i)}var i0=D("ZodPipe",(i,n)=>{zr.init(i,n),C.init(i,n),i.in=n.in,i.out=n.out});function Zc(i,n){return new i0({type:"pipe",in:i,out:n})}var V4=D("ZodReadonly",(i,n)=>{T_.init(i,n),C.init(i,n)});function M4(i){return new V4({type:"readonly",innerType:i})}var x4=D("ZodTemplateLiteral",(i,n)=>{k_.init(i,n),C.init(i,n)});function wH(i,n){return new x4({type:"template_literal",parts:i,...S.normalizeParams(n)})}var F4=D("ZodLazy",(i,n)=>{R_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.getter()});function P4(i){return new F4({type:"lazy",getter:i})}var y4=D("ZodPromise",(i,n)=>{C_.init(i,n),C.init(i,n),i.unwrap=()=>i._zod.def.innerType});function bH(i){return new y4({type:"promise",innerType:i})}var io=D("ZodCustom",(i,n)=>{Z_.init(i,n),C.init(i,n)});function T4(i,n){let r=new ui({check:"custom",...S.normalizeParams(n)});return r._zod.check=i,r}function vH(i,n){return v$(io,i??(()=>!0),n)}function k4(i,n={}){return f$(io,i,n)}function C4(i,n){let r=T4((u)=>{return u.addIssue=(t)=>{if(typeof t==="string")u.issues.push(S.issue(t,u.value,r._zod.def));else{let c=t;if(c.fatal)c.continue=!1;c.code??(c.code="custom"),c.input??(c.input=u.value),c.inst??(c.inst=r),c.continue??(c.continue=!r._zod.def.abort),u.issues.push(S.issue(c))}},i(u.value,u)},n);return r}function fH(i,n={error:`Input not instance of ${i.name}`}){let r=new io({type:"custom",check:"custom",fn:(u)=>u instanceof i,abort:!0,...S.normalizeParams(n)});return r._zod.bag.Class=i,r}var OH=(...i)=>O$({Pipe:i0,Boolean:Pr,Unknown:R$},...i);function jH(i){let n=P4(()=>{return sc([G$(i),o4(),g4(),$4(),Z$(n),z4(G$(),n)])});return n}function UH(i,n){return Zc(d$(i),n)}var NH={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},zH=Object.freeze({status:"aborted"}),WH=zH;function DH(i){$i({customError:i})}function JH(){return $i().customError}var n0={};Xn(n0,{string:()=>EH,number:()=>HH,date:()=>XH,boolean:()=>GH,bigint:()=>qH});function EH(i){return Sl(ec,i)}function HH(i){return xl(Fr,i)}function GH(i){return Rl(Pr,i)}function qH(i){return el(yr,i)}function XH(i){return c$(dc,i)}$i(Wr());var R4=o;var gt=R4;var Z;(function(i){i.assertEqual=(t)=>{};function n(t){}i.assertIs=n;function r(t){throw new Error}i.assertNever=r,i.arrayToEnum=(t)=>{let c={};for(let g of t)c[g]=g;return c},i.getValidEnumValues=(t)=>{let c=i.objectKeys(t).filter((h)=>typeof t[t[h]]!=="number"),g={};for(let h of c)g[h]=t[h];return i.objectValues(g)},i.objectValues=(t)=>{return i.objectKeys(t).map(function(c){return t[c]})},i.objectKeys=typeof Object.keys==="function"?(t)=>Object.keys(t):(t)=>{let c=[];for(let g in t)if(Object.prototype.hasOwnProperty.call(t,g))c.push(g);return c},i.find=(t,c)=>{for(let g of t)if(c(g))return g;return},i.isInteger=typeof Number.isInteger==="function"?(t)=>Number.isInteger(t):(t)=>typeof t==="number"&&Number.isFinite(t)&&Math.floor(t)===t;function u(t,c=" | "){return t.map((g)=>typeof g==="string"?`\'${g}\'`:g).join(c)}i.joinValues=u,i.jsonStringifyReplacer=(t,c)=>{if(typeof c==="bigint")return c.toString();return c}})(Z||(Z={}));var Z4;(function(i){i.mergeShapes=(n,r)=>{return{...n,...r}}})(Z4||(Z4={}));var m=Z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wn=(i)=>{switch(typeof i){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(i)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":if(Array.isArray(i))return m.array;if(i===null)return m.null;if(i.then&&typeof i.then==="function"&&i.catch&&typeof i.catch==="function")return m.promise;if(typeof Map!=="undefined"&&i instanceof Map)return m.map;if(typeof Set!=="undefined"&&i instanceof Set)return m.set;if(typeof Date!=="undefined"&&i instanceof Date)return m.date;return m.object;default:return m.unknown}};var q=Z.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Bi extends Error{get errors(){return this.issues}constructor(i){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,n);else this.__proto__=n;this.name="ZodError",this.issues=i}format(i){let n=i||function(t){return t.message},r={_errors:[]},u=(t)=>{for(let c of t.issues)if(c.code==="invalid_union")c.unionErrors.map(u);else if(c.code==="invalid_return_type")u(c.returnTypeError);else if(c.code==="invalid_arguments")u(c.argumentsError);else if(c.path.length===0)r._errors.push(n(c));else{let g=r,h=0;while(hn.message){let n={},r=[];for(let u of this.issues)if(u.path.length>0)n[u.path[0]]=n[u.path[0]]||[],n[u.path[0]].push(i(u));else r.push(i(u));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Bi.create=(i)=>{return new Bi(i)};var IH=(i,n)=>{let r;switch(i.code){case q.invalid_type:if(i.received===m.undefined)r="Required";else r=`Expected ${i.expected}, received ${i.received}`;break;case q.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(i.expected,Z.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:r=`Unrecognized key(s) in object: ${Z.joinValues(i.keys,", ")}`;break;case q.invalid_union:r="Invalid input";break;case q.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Z.joinValues(i.options)}`;break;case q.invalid_enum_value:r=`Invalid enum value. Expected ${Z.joinValues(i.options)}, received \'${i.received}\'`;break;case q.invalid_arguments:r="Invalid function arguments";break;case q.invalid_return_type:r="Invalid function return type";break;case q.invalid_date:r="Invalid date";break;case q.invalid_string:if(typeof i.validation==="object")if("includes"in i.validation){if(r=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${i.validation.position}`}else if("startsWith"in i.validation)r=`Invalid input: must start with "${i.validation.startsWith}"`;else if("endsWith"in i.validation)r=`Invalid input: must end with "${i.validation.endsWith}"`;else Z.assertNever(i.validation);else if(i.validation!=="regex")r=`Invalid ${i.validation}`;else r="Invalid";break;case q.too_small:if(i.type==="array")r=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`;else if(i.type==="string")r=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`;else if(i.type==="number")r=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`;else if(i.type==="date")r=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`;else r="Invalid input";break;case q.too_big:if(i.type==="array")r=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`;else if(i.type==="string")r=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`;else if(i.type==="number")r=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`;else if(i.type==="bigint")r=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`;else if(i.type==="date")r=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`;else r="Invalid input";break;case q.custom:r="Invalid input";break;case q.invalid_intersection_types:r="Intersection results could not be merged";break;case q.not_multiple_of:r=`Number must be a multiple of ${i.multipleOf}`;break;case q.not_finite:r="Number must be finite";break;default:r=n.defaultError,Z.assertNever(i)}return{message:r}},Mn=IH;var YH=Mn;function Tr(){return YH}var no=(i)=>{let{data:n,path:r,errorMaps:u,issueData:t}=i,c=[...r,...t.path||[]],g={...t,path:c};if(t.message!==void 0)return{...t,path:c,message:t.message};let h="",_=u.filter((l)=>!!l).slice().reverse();for(let l of _)h=l(g,{data:n,defaultError:h}).message;return{...t,path:c,message:h}};function B(i,n){let r=Tr(),u=no({issueData:n,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,r,r===Mn?void 0:Mn].filter((t)=>!!t)});i.common.issues.push(u)}class Ei{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(i,n){let r=[];for(let u of n){if(u.status==="aborted")return F;if(u.status==="dirty")i.dirty();r.push(u.value)}return{status:i.value,value:r}}static async mergeObjectAsync(i,n){let r=[];for(let u of n){let t=await u.key,c=await u.value;r.push({key:t,value:c})}return Ei.mergeObjectSync(i,r)}static mergeObjectSync(i,n){let r={};for(let u of n){let{key:t,value:c}=u;if(t.status==="aborted")return F;if(c.status==="aborted")return F;if(t.status==="dirty")i.dirty();if(c.status==="dirty")i.dirty();if(t.value!=="__proto__"&&(typeof c.value!=="undefined"||u.alwaysSet))r[t.value]=c.value}return{status:i.value,value:r}}}var F=Object.freeze({status:"aborted"}),Qt=(i)=>({status:"dirty",value:i}),Xi=(i)=>({status:"valid",value:i}),t0=(i)=>i.status==="aborted",r0=(i)=>i.status==="dirty",ht=(i)=>i.status==="valid",kr=(i)=>typeof Promise!=="undefined"&&i instanceof Promise;var K;(function(i){i.errToObj=(n)=>typeof n==="string"?{message:n}:n||{},i.toString=(n)=>typeof n==="string"?n:n?.message})(K||(K={}));class Ri{constructor(i,n,r,u){this._cachedPath=[],this.parent=i,this.data=n,this._path=r,this._key=u}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var e4=(i,n)=>{if(ht(n))return{success:!0,data:n.value};else{if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Bi(i.common.issues);return this._error=r,this._error}}}};function k(i){if(!i)return{};let{errorMap:n,invalid_type_error:r,required_error:u,description:t}=i;if(n&&(r||u))throw new Error(`Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(n)return{errorMap:n,description:t};return{errorMap:(g,h)=>{let{message:_}=i;if(g.code==="invalid_enum_value")return{message:_??h.defaultError};if(typeof h.data==="undefined")return{message:_??u??h.defaultError};if(g.code!=="invalid_type")return{message:h.defaultError};return{message:_??r??h.defaultError}},description:t}}class R{get description(){return this._def.description}_getType(i){return Wn(i.data)}_getOrReturnCtx(i,n){return n||{common:i.parent.common,data:i.data,parsedType:Wn(i.data),schemaErrorMap:this._def.errorMap,path:i.path,parent:i.parent}}_processInputParams(i){return{status:new Ei,ctx:{common:i.parent.common,data:i.data,parsedType:Wn(i.data),schemaErrorMap:this._def.errorMap,path:i.path,parent:i.parent}}}_parseSync(i){let n=this._parse(i);if(kr(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(i){let n=this._parse(i);return Promise.resolve(n)}parse(i,n){let r=this.safeParse(i,n);if(r.success)return r.data;throw r.error}safeParse(i,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:i,parsedType:Wn(i)},u=this._parseSync({data:i,path:r.path,parent:r});return e4(r,u)}"~validate"(i){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:i,parsedType:Wn(i)};if(!this["~standard"].async)try{let r=this._parseSync({data:i,path:[],parent:n});return ht(r)?{value:r.value}:{issues:n.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;n.common={issues:[],async:!0}}return this._parseAsync({data:i,path:[],parent:n}).then((r)=>ht(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(i,n){let r=await this.safeParseAsync(i,n);if(r.success)return r.data;throw r.error}async safeParseAsync(i,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:i,parsedType:Wn(i)},u=this._parse({data:i,path:r.path,parent:r}),t=await(kr(u)?u:Promise.resolve(u));return e4(r,t)}refine(i,n){let r=(u)=>{if(typeof n==="string"||typeof n==="undefined")return{message:n};else if(typeof n==="function")return n(u);else return n};return this._refinement((u,t)=>{let c=i(u),g=()=>t.addIssue({code:q.custom,...r(u)});if(typeof Promise!=="undefined"&&c instanceof Promise)return c.then((h)=>{if(!h)return g(),!1;else return!0});if(!c)return g(),!1;else return!0})}refinement(i,n){return this._refinement((r,u)=>{if(!i(r))return u.addIssue(typeof n==="function"?n(r,u):n),!1;else return!0})}_refinement(i){return new on({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:i}})}superRefine(i){return this._refinement(i)}constructor(i){this.spa=this.safeParseAsync,this._def=i,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(n)=>this["~validate"](n)}}optional(){return cn.create(this,this._def)}nullable(){return xn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return un.create(this)}promise(){return Kt.create(this,this._def)}or(i){return pr.create([this,i],this._def)}and(i){return dr.create(this,i,this._def)}transform(i){return new on({...k(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:i}})}default(i){let n=typeof i==="function"?i:()=>i;return new nu({...k(this._def),innerType:this,defaultValue:n,typeName:L.ZodDefault})}brand(){return new g0({typeName:L.ZodBranded,type:this,...k(this._def)})}catch(i){let n=typeof i==="function"?i:()=>i;return new tu({...k(this._def),innerType:this,catchValue:n,typeName:L.ZodCatch})}describe(i){return new this.constructor({...this._def,description:i})}pipe(i){return _o.create(this,i)}readonly(){return ru.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var QH=/^c[^\\s-]{8,}$/i,mH=/^[0-9a-z]+$/,SH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,AH=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,BH=/^[a-z0-9_-]{21}$/i,KH=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,VH=/^[-+]?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)?)??$/,MH=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,xH="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",u0,FH=/^(?:(?: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])$/,PH=/^(?:(?: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])\\/(3[0-2]|[12]?[0-9])$/,yH=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,TH=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CH=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,p4="((\\\\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])))",RH=new RegExp(`^${p4}$`);function d4(i){let n="[0-5]\\\\d";if(i.precision)n=`${n}\\\\.\\\\d{${i.precision}}`;else if(i.precision==null)n=`${n}(\\\\.\\\\d+)?`;let r=i.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${n})${r}`}function ZH(i){return new RegExp(`^${d4(i)}$`)}function eH(i){let n=`${p4}T${d4(i)}`,r=[];if(r.push(i.local?"Z?":"Z"),i.offset)r.push("([+-]\\\\d{2}:?\\\\d{2})");return n=`${n}(${r.join("|")})`,new RegExp(`^${n}$`)}function pH(i,n){if((n==="v4"||!n)&&FH.test(i))return!0;if((n==="v6"||!n)&&yH.test(i))return!0;return!1}function dH(i,n){if(!KH.test(i))return!1;try{let[r]=i.split("."),u=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),t=JSON.parse(atob(u));if(typeof t!=="object"||t===null)return!1;if("typ"in t&&t?.typ!=="JWT")return!1;if(!t.alg)return!1;if(n&&t.alg!==n)return!1;return!0}catch{return!1}}function aH(i,n){if((n==="v4"||!n)&&PH.test(i))return!0;if((n==="v6"||!n)&&TH.test(i))return!0;return!1}class Jn extends R{_parse(i){if(this._def.coerce)i.data=String(i.data);if(this._getType(i)!==m.string){let t=this._getOrReturnCtx(i);return B(t,{code:q.invalid_type,expected:m.string,received:t.parsedType}),F}let r=new Ei,u=void 0;for(let t of this._def.checks)if(t.kind==="min"){if(i.data.lengtht.value)u=this._getOrReturnCtx(i,u),B(u,{code:q.too_big,maximum:t.value,type:"string",inclusive:!0,exact:!1,message:t.message}),r.dirty()}else if(t.kind==="length"){let c=i.data.length>t.value,g=i.data.lengthi.test(u),{validation:n,code:q.invalid_string,...K.errToObj(r)})}_addCheck(i){return new Jn({...this._def,checks:[...this._def.checks,i]})}email(i){return this._addCheck({kind:"email",...K.errToObj(i)})}url(i){return this._addCheck({kind:"url",...K.errToObj(i)})}emoji(i){return this._addCheck({kind:"emoji",...K.errToObj(i)})}uuid(i){return this._addCheck({kind:"uuid",...K.errToObj(i)})}nanoid(i){return this._addCheck({kind:"nanoid",...K.errToObj(i)})}cuid(i){return this._addCheck({kind:"cuid",...K.errToObj(i)})}cuid2(i){return this._addCheck({kind:"cuid2",...K.errToObj(i)})}ulid(i){return this._addCheck({kind:"ulid",...K.errToObj(i)})}base64(i){return this._addCheck({kind:"base64",...K.errToObj(i)})}base64url(i){return this._addCheck({kind:"base64url",...K.errToObj(i)})}jwt(i){return this._addCheck({kind:"jwt",...K.errToObj(i)})}ip(i){return this._addCheck({kind:"ip",...K.errToObj(i)})}cidr(i){return this._addCheck({kind:"cidr",...K.errToObj(i)})}datetime(i){if(typeof i==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:i});return this._addCheck({kind:"datetime",precision:typeof i?.precision==="undefined"?null:i?.precision,offset:i?.offset??!1,local:i?.local??!1,...K.errToObj(i?.message)})}date(i){return this._addCheck({kind:"date",message:i})}time(i){if(typeof i==="string")return this._addCheck({kind:"time",precision:null,message:i});return this._addCheck({kind:"time",precision:typeof i?.precision==="undefined"?null:i?.precision,...K.errToObj(i?.message)})}duration(i){return this._addCheck({kind:"duration",...K.errToObj(i)})}regex(i,n){return this._addCheck({kind:"regex",regex:i,...K.errToObj(n)})}includes(i,n){return this._addCheck({kind:"includes",value:i,position:n?.position,...K.errToObj(n?.message)})}startsWith(i,n){return this._addCheck({kind:"startsWith",value:i,...K.errToObj(n)})}endsWith(i,n){return this._addCheck({kind:"endsWith",value:i,...K.errToObj(n)})}min(i,n){return this._addCheck({kind:"min",value:i,...K.errToObj(n)})}max(i,n){return this._addCheck({kind:"max",value:i,...K.errToObj(n)})}length(i,n){return this._addCheck({kind:"length",value:i,...K.errToObj(n)})}nonempty(i){return this.min(1,K.errToObj(i))}trim(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((i)=>i.kind==="datetime")}get isDate(){return!!this._def.checks.find((i)=>i.kind==="date")}get isTime(){return!!this._def.checks.find((i)=>i.kind==="time")}get isDuration(){return!!this._def.checks.find((i)=>i.kind==="duration")}get isEmail(){return!!this._def.checks.find((i)=>i.kind==="email")}get isURL(){return!!this._def.checks.find((i)=>i.kind==="url")}get isEmoji(){return!!this._def.checks.find((i)=>i.kind==="emoji")}get isUUID(){return!!this._def.checks.find((i)=>i.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((i)=>i.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((i)=>i.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((i)=>i.kind==="cuid2")}get isULID(){return!!this._def.checks.find((i)=>i.kind==="ulid")}get isIP(){return!!this._def.checks.find((i)=>i.kind==="ip")}get isCIDR(){return!!this._def.checks.find((i)=>i.kind==="cidr")}get isBase64(){return!!this._def.checks.find((i)=>i.kind==="base64")}get isBase64url(){return!!this._def.checks.find((i)=>i.kind==="base64url")}get minLength(){let i=null;for(let n of this._def.checks)if(n.kind==="min"){if(i===null||n.value>i)i=n.value}return i}get maxLength(){let i=null;for(let n of this._def.checks)if(n.kind==="max"){if(i===null||n.value{return new Jn({checks:[],typeName:L.ZodString,coerce:i?.coerce??!1,...k(i)})};function sH(i,n){let r=(i.toString().split(".")[1]||"").length,u=(n.toString().split(".")[1]||"").length,t=r>u?r:u,c=Number.parseInt(i.toFixed(t).replace(".","")),g=Number.parseInt(n.toFixed(t).replace(".",""));return c%g/10**t}class St extends R{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(i){if(this._def.coerce)i.data=Number(i.data);if(this._getType(i)!==m.number){let t=this._getOrReturnCtx(i);return B(t,{code:q.invalid_type,expected:m.number,received:t.parsedType}),F}let r=void 0,u=new Ei;for(let t of this._def.checks)if(t.kind==="int"){if(!Z.isInteger(i.data))r=this._getOrReturnCtx(i,r),B(r,{code:q.invalid_type,expected:"integer",received:"float",message:t.message}),u.dirty()}else if(t.kind==="min"){if(t.inclusive?i.datat.value:i.data>=t.value)r=this._getOrReturnCtx(i,r),B(r,{code:q.too_big,maximum:t.value,type:"number",inclusive:t.inclusive,exact:!1,message:t.message}),u.dirty()}else if(t.kind==="multipleOf"){if(sH(i.data,t.value)!==0)r=this._getOrReturnCtx(i,r),B(r,{code:q.not_multiple_of,multipleOf:t.value,message:t.message}),u.dirty()}else if(t.kind==="finite"){if(!Number.isFinite(i.data))r=this._getOrReturnCtx(i,r),B(r,{code:q.not_finite,message:t.message}),u.dirty()}else Z.assertNever(t);return{status:u.value,value:i.data}}gte(i,n){return this.setLimit("min",i,!0,K.toString(n))}gt(i,n){return this.setLimit("min",i,!1,K.toString(n))}lte(i,n){return this.setLimit("max",i,!0,K.toString(n))}lt(i,n){return this.setLimit("max",i,!1,K.toString(n))}setLimit(i,n,r,u){return new St({...this._def,checks:[...this._def.checks,{kind:i,value:n,inclusive:r,message:K.toString(u)}]})}_addCheck(i){return new St({...this._def,checks:[...this._def.checks,i]})}int(i){return this._addCheck({kind:"int",message:K.toString(i)})}positive(i){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(i)})}negative(i){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(i)})}nonpositive(i){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(i)})}nonnegative(i){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(i)})}multipleOf(i,n){return this._addCheck({kind:"multipleOf",value:i,message:K.toString(n)})}finite(i){return this._addCheck({kind:"finite",message:K.toString(i)})}safe(i){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(i)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.toString(i)})}get minValue(){let i=null;for(let n of this._def.checks)if(n.kind==="min"){if(i===null||n.value>i)i=n.value}return i}get maxValue(){let i=null;for(let n of this._def.checks)if(n.kind==="max"){if(i===null||n.valuei.kind==="int"||i.kind==="multipleOf"&&Z.isInteger(i.value))}get isFinite(){let i=null,n=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(n===null||r.value>n)n=r.value}else if(r.kind==="max"){if(i===null||r.value{return new St({checks:[],typeName:L.ZodNumber,coerce:i?.coerce||!1,...k(i)})};class At extends R{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(i){if(this._def.coerce)try{i.data=BigInt(i.data)}catch{return this._getInvalidInput(i)}if(this._getType(i)!==m.bigint)return this._getInvalidInput(i);let r=void 0,u=new Ei;for(let t of this._def.checks)if(t.kind==="min"){if(t.inclusive?i.datat.value:i.data>=t.value)r=this._getOrReturnCtx(i,r),B(r,{code:q.too_big,type:"bigint",maximum:t.value,inclusive:t.inclusive,message:t.message}),u.dirty()}else if(t.kind==="multipleOf"){if(i.data%t.value!==BigInt(0))r=this._getOrReturnCtx(i,r),B(r,{code:q.not_multiple_of,multipleOf:t.value,message:t.message}),u.dirty()}else Z.assertNever(t);return{status:u.value,value:i.data}}_getInvalidInput(i){let n=this._getOrReturnCtx(i);return B(n,{code:q.invalid_type,expected:m.bigint,received:n.parsedType}),F}gte(i,n){return this.setLimit("min",i,!0,K.toString(n))}gt(i,n){return this.setLimit("min",i,!1,K.toString(n))}lte(i,n){return this.setLimit("max",i,!0,K.toString(n))}lt(i,n){return this.setLimit("max",i,!1,K.toString(n))}setLimit(i,n,r,u){return new At({...this._def,checks:[...this._def.checks,{kind:i,value:n,inclusive:r,message:K.toString(u)}]})}_addCheck(i){return new At({...this._def,checks:[...this._def.checks,i]})}positive(i){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:K.toString(i)})}negative(i){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(i)})}nonpositive(i){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(i)})}nonnegative(i){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(i)})}multipleOf(i,n){return this._addCheck({kind:"multipleOf",value:i,message:K.toString(n)})}get minValue(){let i=null;for(let n of this._def.checks)if(n.kind==="min"){if(i===null||n.value>i)i=n.value}return i}get maxValue(){let i=null;for(let n of this._def.checks)if(n.kind==="max"){if(i===null||n.value{return new At({checks:[],typeName:L.ZodBigInt,coerce:i?.coerce??!1,...k(i)})};class to extends R{_parse(i){if(this._def.coerce)i.data=Boolean(i.data);if(this._getType(i)!==m.boolean){let r=this._getOrReturnCtx(i);return B(r,{code:q.invalid_type,expected:m.boolean,received:r.parsedType}),F}return Xi(i.data)}}to.create=(i)=>{return new to({typeName:L.ZodBoolean,coerce:i?.coerce||!1,...k(i)})};class Rr extends R{_parse(i){if(this._def.coerce)i.data=new Date(i.data);if(this._getType(i)!==m.date){let t=this._getOrReturnCtx(i);return B(t,{code:q.invalid_type,expected:m.date,received:t.parsedType}),F}if(Number.isNaN(i.data.getTime())){let t=this._getOrReturnCtx(i);return B(t,{code:q.invalid_date}),F}let r=new Ei,u=void 0;for(let t of this._def.checks)if(t.kind==="min"){if(i.data.getTime()t.value)u=this._getOrReturnCtx(i,u),B(u,{code:q.too_big,message:t.message,inclusive:!0,exact:!1,maximum:t.value,type:"date"}),r.dirty()}else Z.assertNever(t);return{status:r.value,value:new Date(i.data.getTime())}}_addCheck(i){return new Rr({...this._def,checks:[...this._def.checks,i]})}min(i,n){return this._addCheck({kind:"min",value:i.getTime(),message:K.toString(n)})}max(i,n){return this._addCheck({kind:"max",value:i.getTime(),message:K.toString(n)})}get minDate(){let i=null;for(let n of this._def.checks)if(n.kind==="min"){if(i===null||n.value>i)i=n.value}return i!=null?new Date(i):null}get maxDate(){let i=null;for(let n of this._def.checks)if(n.kind==="max"){if(i===null||n.value{return new Rr({checks:[],coerce:i?.coerce||!1,typeName:L.ZodDate,...k(i)})};class ro extends R{_parse(i){if(this._getType(i)!==m.symbol){let r=this._getOrReturnCtx(i);return B(r,{code:q.invalid_type,expected:m.symbol,received:r.parsedType}),F}return Xi(i.data)}}ro.create=(i)=>{return new ro({typeName:L.ZodSymbol,...k(i)})};class Zr extends R{_parse(i){if(this._getType(i)!==m.undefined){let r=this._getOrReturnCtx(i);return B(r,{code:q.invalid_type,expected:m.undefined,received:r.parsedType}),F}return Xi(i.data)}}Zr.create=(i)=>{return new Zr({typeName:L.ZodUndefined,...k(i)})};class er extends R{_parse(i){if(this._getType(i)!==m.null){let r=this._getOrReturnCtx(i);return B(r,{code:q.invalid_type,expected:m.null,received:r.parsedType}),F}return Xi(i.data)}}er.create=(i)=>{return new er({typeName:L.ZodNull,...k(i)})};class uo extends R{constructor(){super(...arguments);this._any=!0}_parse(i){return Xi(i.data)}}uo.create=(i)=>{return new uo({typeName:L.ZodAny,...k(i)})};class _t extends R{constructor(){super(...arguments);this._unknown=!0}_parse(i){return Xi(i.data)}}_t.create=(i)=>{return new _t({typeName:L.ZodUnknown,...k(i)})};class En extends R{_parse(i){let n=this._getOrReturnCtx(i);return B(n,{code:q.invalid_type,expected:m.never,received:n.parsedType}),F}}En.create=(i)=>{return new En({typeName:L.ZodNever,...k(i)})};class co extends R{_parse(i){if(this._getType(i)!==m.undefined){let r=this._getOrReturnCtx(i);return B(r,{code:q.invalid_type,expected:m.void,received:r.parsedType}),F}return Xi(i.data)}}co.create=(i)=>{return new co({typeName:L.ZodVoid,...k(i)})};class un extends R{_parse(i){let{ctx:n,status:r}=this._processInputParams(i),u=this._def;if(n.parsedType!==m.array)return B(n,{code:q.invalid_type,expected:m.array,received:n.parsedType}),F;if(u.exactLength!==null){let c=n.data.length>u.exactLength.value,g=n.data.lengthu.maxLength.value)B(n,{code:q.too_big,maximum:u.maxLength.value,type:"array",inclusive:!0,exact:!1,message:u.maxLength.message}),r.dirty()}if(n.common.async)return Promise.all([...n.data].map((c,g)=>{return u.type._parseAsync(new Ri(n,c,n.path,g))})).then((c)=>{return Ei.mergeArray(r,c)});let t=[...n.data].map((c,g)=>{return u.type._parseSync(new Ri(n,c,n.path,g))});return Ei.mergeArray(r,t)}get element(){return this._def.type}min(i,n){return new un({...this._def,minLength:{value:i,message:K.toString(n)}})}max(i,n){return new un({...this._def,maxLength:{value:i,message:K.toString(n)}})}length(i,n){return new un({...this._def,exactLength:{value:i,message:K.toString(n)}})}nonempty(i){return this.min(1,i)}}un.create=(i,n)=>{return new un({type:i,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...k(n)})};function mt(i){if(i instanceof ci){let n={};for(let r in i.shape){let u=i.shape[r];n[r]=cn.create(mt(u))}return new ci({...i._def,shape:()=>n})}else if(i instanceof un)return new un({...i._def,type:mt(i.element)});else if(i instanceof cn)return cn.create(mt(i.unwrap()));else if(i instanceof xn)return xn.create(mt(i.unwrap()));else if(i instanceof Hn)return Hn.create(i.items.map((n)=>mt(n)));else return i}class ci extends R{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let i=this._def.shape(),n=Z.objectKeys(i);return this._cached={shape:i,keys:n},this._cached}_parse(i){if(this._getType(i)!==m.object){let _=this._getOrReturnCtx(i);return B(_,{code:q.invalid_type,expected:m.object,received:_.parsedType}),F}let{status:r,ctx:u}=this._processInputParams(i),{shape:t,keys:c}=this._getCached(),g=[];if(!(this._def.catchall instanceof En&&this._def.unknownKeys==="strip")){for(let _ in u.data)if(!c.includes(_))g.push(_)}let h=[];for(let _ of c){let l=t[_],$=u.data[_];h.push({key:{status:"valid",value:_},value:l._parse(new Ri(u,$,u.path,_)),alwaysSet:_ in u.data})}if(this._def.catchall instanceof En){let _=this._def.unknownKeys;if(_==="passthrough")for(let l of g)h.push({key:{status:"valid",value:l},value:{status:"valid",value:u.data[l]}});else if(_==="strict"){if(g.length>0)B(u,{code:q.unrecognized_keys,keys:g}),r.dirty()}else if(_==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let _=this._def.catchall;for(let l of g){let $=u.data[l];h.push({key:{status:"valid",value:l},value:_._parse(new Ri(u,$,u.path,l)),alwaysSet:l in u.data})}}if(u.common.async)return Promise.resolve().then(async()=>{let _=[];for(let l of h){let $=await l.key,w=await l.value;_.push({key:$,value:w,alwaysSet:l.alwaysSet})}return _}).then((_)=>{return Ei.mergeObjectSync(r,_)});else return Ei.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(i){return K.errToObj,new ci({...this._def,unknownKeys:"strict",...i!==void 0?{errorMap:(n,r)=>{let u=this._def.errorMap?.(n,r).message??r.defaultError;if(n.code==="unrecognized_keys")return{message:K.errToObj(i).message??u};return{message:u}}}:{}})}strip(){return new ci({...this._def,unknownKeys:"strip"})}passthrough(){return new ci({...this._def,unknownKeys:"passthrough"})}extend(i){return new ci({...this._def,shape:()=>({...this._def.shape(),...i})})}merge(i){return new ci({unknownKeys:i._def.unknownKeys,catchall:i._def.catchall,shape:()=>({...this._def.shape(),...i._def.shape()}),typeName:L.ZodObject})}setKey(i,n){return this.augment({[i]:n})}catchall(i){return new ci({...this._def,catchall:i})}pick(i){let n={};for(let r of Z.objectKeys(i))if(i[r]&&this.shape[r])n[r]=this.shape[r];return new ci({...this._def,shape:()=>n})}omit(i){let n={};for(let r of Z.objectKeys(this.shape))if(!i[r])n[r]=this.shape[r];return new ci({...this._def,shape:()=>n})}deepPartial(){return mt(this)}partial(i){let n={};for(let r of Z.objectKeys(this.shape)){let u=this.shape[r];if(i&&!i[r])n[r]=u;else n[r]=u.optional()}return new ci({...this._def,shape:()=>n})}required(i){let n={};for(let r of Z.objectKeys(this.shape))if(i&&!i[r])n[r]=this.shape[r];else{let t=this.shape[r];while(t instanceof cn)t=t._def.innerType;n[r]=t}return new ci({...this._def,shape:()=>n})}keyof(){return a4(Z.objectKeys(this.shape))}}ci.create=(i,n)=>{return new ci({shape:()=>i,unknownKeys:"strip",catchall:En.create(),typeName:L.ZodObject,...k(n)})};ci.strictCreate=(i,n)=>{return new ci({shape:()=>i,unknownKeys:"strict",catchall:En.create(),typeName:L.ZodObject,...k(n)})};ci.lazycreate=(i,n)=>{return new ci({shape:i,unknownKeys:"strip",catchall:En.create(),typeName:L.ZodObject,...k(n)})};class pr extends R{_parse(i){let{ctx:n}=this._processInputParams(i),r=this._def.options;function u(t){for(let g of t)if(g.result.status==="valid")return g.result;for(let g of t)if(g.result.status==="dirty")return n.common.issues.push(...g.ctx.common.issues),g.result;let c=t.map((g)=>new Bi(g.ctx.common.issues));return B(n,{code:q.invalid_union,unionErrors:c}),F}if(n.common.async)return Promise.all(r.map(async(t)=>{let c={...n,common:{...n.common,issues:[]},parent:null};return{result:await t._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(u);else{let t=void 0,c=[];for(let h of r){let _={...n,common:{...n.common,issues:[]},parent:null},l=h._parseSync({data:n.data,path:n.path,parent:_});if(l.status==="valid")return l;else if(l.status==="dirty"&&!t)t={result:l,ctx:_};if(_.common.issues.length)c.push(_.common.issues)}if(t)return n.common.issues.push(...t.ctx.common.issues),t.result;let g=c.map((h)=>new Bi(h));return B(n,{code:q.invalid_union,unionErrors:g}),F}}get options(){return this._def.options}}pr.create=(i,n)=>{return new pr({options:i,typeName:L.ZodUnion,...k(n)})};var Dn=(i)=>{if(i instanceof ar)return Dn(i.schema);else if(i instanceof on)return Dn(i.innerType());else if(i instanceof sr)return[i.value];else if(i instanceof lt)return i.options;else if(i instanceof iu)return Z.objectValues(i.enum);else if(i instanceof nu)return Dn(i._def.innerType);else if(i instanceof Zr)return[void 0];else if(i instanceof er)return[null];else if(i instanceof cn)return[void 0,...Dn(i.unwrap())];else if(i instanceof xn)return[null,...Dn(i.unwrap())];else if(i instanceof g0)return Dn(i.unwrap());else if(i instanceof ru)return Dn(i.unwrap());else if(i instanceof tu)return Dn(i._def.innerType);else return[]};class o0 extends R{_parse(i){let{ctx:n}=this._processInputParams(i);if(n.parsedType!==m.object)return B(n,{code:q.invalid_type,expected:m.object,received:n.parsedType}),F;let r=this.discriminator,u=n.data[r],t=this.optionsMap.get(u);if(!t)return B(n,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F;if(n.common.async)return t._parseAsync({data:n.data,path:n.path,parent:n});else return t._parseSync({data:n.data,path:n.path,parent:n})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(i,n,r){let u=new Map;for(let t of n){let c=Dn(t.shape[i]);if(!c.length)throw new Error(`A discriminator value for key \\`${i}\\` could not be extracted from all schema options`);for(let g of c){if(u.has(g))throw new Error(`Discriminator property ${String(i)} has duplicate value ${String(g)}`);u.set(g,t)}}return new o0({typeName:L.ZodDiscriminatedUnion,discriminator:i,options:n,optionsMap:u,...k(r)})}}function c0(i,n){let r=Wn(i),u=Wn(n);if(i===n)return{valid:!0,data:i};else if(r===m.object&&u===m.object){let t=Z.objectKeys(n),c=Z.objectKeys(i).filter((h)=>t.indexOf(h)!==-1),g={...i,...n};for(let h of c){let _=c0(i[h],n[h]);if(!_.valid)return{valid:!1};g[h]=_.data}return{valid:!0,data:g}}else if(r===m.array&&u===m.array){if(i.length!==n.length)return{valid:!1};let t=[];for(let c=0;c{if(t0(t)||t0(c))return F;let g=c0(t.value,c.value);if(!g.valid)return B(r,{code:q.invalid_intersection_types}),F;if(r0(t)||r0(c))n.dirty();return{status:n.value,value:g.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([t,c])=>u(t,c));else return u(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dr.create=(i,n,r)=>{return new dr({left:i,right:n,typeName:L.ZodIntersection,...k(r)})};class Hn extends R{_parse(i){let{status:n,ctx:r}=this._processInputParams(i);if(r.parsedType!==m.array)return B(r,{code:q.invalid_type,expected:m.array,received:r.parsedType}),F;if(r.data.lengththis._def.items.length)B(r,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty();let t=[...r.data].map((c,g)=>{let h=this._def.items[g]||this._def.rest;if(!h)return null;return h._parse(new Ri(r,c,r.path,g))}).filter((c)=>!!c);if(r.common.async)return Promise.all(t).then((c)=>{return Ei.mergeArray(n,c)});else return Ei.mergeArray(n,t)}get items(){return this._def.items}rest(i){return new Hn({...this._def,rest:i})}}Hn.create=(i,n)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Hn({items:i,typeName:L.ZodTuple,rest:null,...k(n)})};class oo extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(i){let{status:n,ctx:r}=this._processInputParams(i);if(r.parsedType!==m.object)return B(r,{code:q.invalid_type,expected:m.object,received:r.parsedType}),F;let u=[],t=this._def.keyType,c=this._def.valueType;for(let g in r.data)u.push({key:t._parse(new Ri(r,g,r.path,g)),value:c._parse(new Ri(r,r.data[g],r.path,g)),alwaysSet:g in r.data});if(r.common.async)return Ei.mergeObjectAsync(n,u);else return Ei.mergeObjectSync(n,u)}get element(){return this._def.valueType}static create(i,n,r){if(n instanceof R)return new oo({keyType:i,valueType:n,typeName:L.ZodRecord,...k(r)});return new oo({keyType:Jn.create(),valueType:i,typeName:L.ZodRecord,...k(n)})}}class go extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(i){let{status:n,ctx:r}=this._processInputParams(i);if(r.parsedType!==m.map)return B(r,{code:q.invalid_type,expected:m.map,received:r.parsedType}),F;let u=this._def.keyType,t=this._def.valueType,c=[...r.data.entries()].map(([g,h],_)=>{return{key:u._parse(new Ri(r,g,r.path,[_,"key"])),value:t._parse(new Ri(r,h,r.path,[_,"value"]))}});if(r.common.async){let g=new Map;return Promise.resolve().then(async()=>{for(let h of c){let _=await h.key,l=await h.value;if(_.status==="aborted"||l.status==="aborted")return F;if(_.status==="dirty"||l.status==="dirty")n.dirty();g.set(_.value,l.value)}return{status:n.value,value:g}})}else{let g=new Map;for(let h of c){let{key:_,value:l}=h;if(_.status==="aborted"||l.status==="aborted")return F;if(_.status==="dirty"||l.status==="dirty")n.dirty();g.set(_.value,l.value)}return{status:n.value,value:g}}}}go.create=(i,n,r)=>{return new go({valueType:n,keyType:i,typeName:L.ZodMap,...k(r)})};class Bt extends R{_parse(i){let{status:n,ctx:r}=this._processInputParams(i);if(r.parsedType!==m.set)return B(r,{code:q.invalid_type,expected:m.set,received:r.parsedType}),F;let u=this._def;if(u.minSize!==null){if(r.data.sizeu.maxSize.value)B(r,{code:q.too_big,maximum:u.maxSize.value,type:"set",inclusive:!0,exact:!1,message:u.maxSize.message}),n.dirty()}let t=this._def.valueType;function c(h){let _=new Set;for(let l of h){if(l.status==="aborted")return F;if(l.status==="dirty")n.dirty();_.add(l.value)}return{status:n.value,value:_}}let g=[...r.data.values()].map((h,_)=>t._parse(new Ri(r,h,r.path,_)));if(r.common.async)return Promise.all(g).then((h)=>c(h));else return c(g)}min(i,n){return new Bt({...this._def,minSize:{value:i,message:K.toString(n)}})}max(i,n){return new Bt({...this._def,maxSize:{value:i,message:K.toString(n)}})}size(i,n){return this.min(i,n).max(i,n)}nonempty(i){return this.min(1,i)}}Bt.create=(i,n)=>{return new Bt({valueType:i,minSize:null,maxSize:null,typeName:L.ZodSet,...k(n)})};class Cr extends R{constructor(){super(...arguments);this.validate=this.implement}_parse(i){let{ctx:n}=this._processInputParams(i);if(n.parsedType!==m.function)return B(n,{code:q.invalid_type,expected:m.function,received:n.parsedType}),F;function r(g,h){return no({data:g,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Tr(),Mn].filter((_)=>!!_),issueData:{code:q.invalid_arguments,argumentsError:h}})}function u(g,h){return no({data:g,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Tr(),Mn].filter((_)=>!!_),issueData:{code:q.invalid_return_type,returnTypeError:h}})}let t={errorMap:n.common.contextualErrorMap},c=n.data;if(this._def.returns instanceof Kt){let g=this;return Xi(async function(...h){let _=new Bi([]),l=await g._def.args.parseAsync(h,t).catch((b)=>{throw _.addIssue(r(h,b)),_}),$=await Reflect.apply(c,this,l);return await g._def.returns._def.type.parseAsync($,t).catch((b)=>{throw _.addIssue(u($,b)),_})})}else{let g=this;return Xi(function(...h){let _=g._def.args.safeParse(h,t);if(!_.success)throw new Bi([r(h,_.error)]);let l=Reflect.apply(c,this,_.data),$=g._def.returns.safeParse(l,t);if(!$.success)throw new Bi([u(l,$.error)]);return $.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...i){return new Cr({...this._def,args:Hn.create(i).rest(_t.create())})}returns(i){return new Cr({...this._def,returns:i})}implement(i){return this.parse(i)}strictImplement(i){return this.parse(i)}static create(i,n,r){return new Cr({args:i?i:Hn.create([]).rest(_t.create()),returns:n||_t.create(),typeName:L.ZodFunction,...k(r)})}}class ar extends R{get schema(){return this._def.getter()}_parse(i){let{ctx:n}=this._processInputParams(i);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ar.create=(i,n)=>{return new ar({getter:i,typeName:L.ZodLazy,...k(n)})};class sr extends R{_parse(i){if(i.data!==this._def.value){let n=this._getOrReturnCtx(i);return B(n,{received:n.data,code:q.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:i.data}}get value(){return this._def.value}}sr.create=(i,n)=>{return new sr({value:i,typeName:L.ZodLiteral,...k(n)})};function a4(i,n){return new lt({values:i,typeName:L.ZodEnum,...k(n)})}class lt extends R{_parse(i){if(typeof i.data!=="string"){let n=this._getOrReturnCtx(i),r=this._def.values;return B(n,{expected:Z.joinValues(r),received:n.parsedType,code:q.invalid_type}),F}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(i.data)){let n=this._getOrReturnCtx(i),r=this._def.values;return B(n,{received:n.data,code:q.invalid_enum_value,options:r}),F}return Xi(i.data)}get options(){return this._def.values}get enum(){let i={};for(let n of this._def.values)i[n]=n;return i}get Values(){let i={};for(let n of this._def.values)i[n]=n;return i}get Enum(){let i={};for(let n of this._def.values)i[n]=n;return i}extract(i,n=this._def){return lt.create(i,{...this._def,...n})}exclude(i,n=this._def){return lt.create(this.options.filter((r)=>!i.includes(r)),{...this._def,...n})}}lt.create=a4;class iu extends R{_parse(i){let n=Z.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(i);if(r.parsedType!==m.string&&r.parsedType!==m.number){let u=Z.objectValues(n);return B(r,{expected:Z.joinValues(u),received:r.parsedType,code:q.invalid_type}),F}if(!this._cache)this._cache=new Set(Z.getValidEnumValues(this._def.values));if(!this._cache.has(i.data)){let u=Z.objectValues(n);return B(r,{received:r.data,code:q.invalid_enum_value,options:u}),F}return Xi(i.data)}get enum(){return this._def.values}}iu.create=(i,n)=>{return new iu({values:i,typeName:L.ZodNativeEnum,...k(n)})};class Kt extends R{unwrap(){return this._def.type}_parse(i){let{ctx:n}=this._processInputParams(i);if(n.parsedType!==m.promise&&n.common.async===!1)return B(n,{code:q.invalid_type,expected:m.promise,received:n.parsedType}),F;let r=n.parsedType===m.promise?n.data:Promise.resolve(n.data);return Xi(r.then((u)=>{return this._def.type.parseAsync(u,{path:n.path,errorMap:n.common.contextualErrorMap})}))}}Kt.create=(i,n)=>{return new Kt({type:i,typeName:L.ZodPromise,...k(n)})};class on extends R{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(i){let{status:n,ctx:r}=this._processInputParams(i),u=this._def.effect||null,t={addIssue:(c)=>{if(B(r,c),c.fatal)n.abort();else n.dirty()},get path(){return r.path}};if(t.addIssue=t.addIssue.bind(t),u.type==="preprocess"){let c=u.transform(r.data,t);if(r.common.async)return Promise.resolve(c).then(async(g)=>{if(n.value==="aborted")return F;let h=await this._def.schema._parseAsync({data:g,path:r.path,parent:r});if(h.status==="aborted")return F;if(h.status==="dirty")return Qt(h.value);if(n.value==="dirty")return Qt(h.value);return h});else{if(n.value==="aborted")return F;let g=this._def.schema._parseSync({data:c,path:r.path,parent:r});if(g.status==="aborted")return F;if(g.status==="dirty")return Qt(g.value);if(n.value==="dirty")return Qt(g.value);return g}}if(u.type==="refinement"){let c=(g)=>{let h=u.refinement(g,t);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return g};if(r.common.async===!1){let g=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(g.status==="aborted")return F;if(g.status==="dirty")n.dirty();return c(g.value),{status:n.value,value:g.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((g)=>{if(g.status==="aborted")return F;if(g.status==="dirty")n.dirty();return c(g.value).then(()=>{return{status:n.value,value:g.value}})})}if(u.type==="transform")if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ht(c))return F;let g=u.transform(c.value,t);if(g instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:g}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((c)=>{if(!ht(c))return F;return Promise.resolve(u.transform(c.value,t)).then((g)=>({status:n.value,value:g}))});Z.assertNever(u)}}on.create=(i,n,r)=>{return new on({schema:i,typeName:L.ZodEffects,effect:n,...k(r)})};on.createWithPreprocess=(i,n,r)=>{return new on({schema:n,effect:{type:"preprocess",transform:i},typeName:L.ZodEffects,...k(r)})};class cn extends R{_parse(i){if(this._getType(i)===m.undefined)return Xi(void 0);return this._def.innerType._parse(i)}unwrap(){return this._def.innerType}}cn.create=(i,n)=>{return new cn({innerType:i,typeName:L.ZodOptional,...k(n)})};class xn extends R{_parse(i){if(this._getType(i)===m.null)return Xi(null);return this._def.innerType._parse(i)}unwrap(){return this._def.innerType}}xn.create=(i,n)=>{return new xn({innerType:i,typeName:L.ZodNullable,...k(n)})};class nu extends R{_parse(i){let{ctx:n}=this._processInputParams(i),r=n.data;if(n.parsedType===m.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}nu.create=(i,n)=>{return new nu({innerType:i,typeName:L.ZodDefault,defaultValue:typeof n.default==="function"?n.default:()=>n.default,...k(n)})};class tu extends R{_parse(i){let{ctx:n}=this._processInputParams(i),r={...n,common:{...n.common,issues:[]}},u=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(kr(u))return u.then((t)=>{return{status:"valid",value:t.status==="valid"?t.value:this._def.catchValue({get error(){return new Bi(r.common.issues)},input:r.data})}});else return{status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Bi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}tu.create=(i,n)=>{return new tu({innerType:i,typeName:L.ZodCatch,catchValue:typeof n.catch==="function"?n.catch:()=>n.catch,...k(n)})};class ho extends R{_parse(i){if(this._getType(i)!==m.nan){let r=this._getOrReturnCtx(i);return B(r,{code:q.invalid_type,expected:m.nan,received:r.parsedType}),F}return{status:"valid",value:i.data}}}ho.create=(i)=>{return new ho({typeName:L.ZodNaN,...k(i)})};var QS=Symbol("zod_brand");class g0 extends R{_parse(i){let{ctx:n}=this._processInputParams(i),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class _o extends R{_parse(i){let{status:n,ctx:r}=this._processInputParams(i);if(r.common.async)return(async()=>{let t=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(t.status==="aborted")return F;if(t.status==="dirty")return n.dirty(),Qt(t.value);else return this._def.out._parseAsync({data:t.value,path:r.path,parent:r})})();else{let u=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(u.status==="aborted")return F;if(u.status==="dirty")return n.dirty(),{status:"dirty",value:u.value};else return this._def.out._parseSync({data:u.value,path:r.path,parent:r})}}static create(i,n){return new _o({in:i,out:n,typeName:L.ZodPipeline})}}class ru extends R{_parse(i){let n=this._def.innerType._parse(i),r=(u)=>{if(ht(u))u.value=Object.freeze(u.value);return u};return kr(n)?n.then((u)=>r(u)):r(n)}unwrap(){return this._def.innerType}}ru.create=(i,n)=>{return new ru({innerType:i,typeName:L.ZodReadonly,...k(n)})};var mS={object:ci.lazycreate},L;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(L||(L={}));var SS=Jn.create,AS=St.create,BS=ho.create,KS=At.create,VS=to.create,MS=Rr.create,xS=ro.create,FS=Zr.create,PS=er.create,yS=uo.create,TS=_t.create,kS=En.create,CS=co.create,RS=un.create,ZS=ci.create,eS=ci.strictCreate,pS=pr.create,dS=o0.create,aS=dr.create,sS=Hn.create,iA=oo.create,nA=go.create,tA=Bt.create,rA=Cr.create,uA=ar.create,cA=sr.create,oA=lt.create,gA=iu.create,hA=Kt.create,_A=on.create,lA=cn.create,$A=xn.create,wA=on.createWithPreprocess,bA=_o.create;var Gn=({prefix:i,size:n=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:u="-"}={})=>{let t=()=>{let c=r.length,g=new Array(n);for(let h=0;h`${i}${u}${t()}`},n6=Gn();function w0(i){if(i==null)return"unknown error";if(typeof i==="string")return i;if(i instanceof Error)return i.message;return JSON.stringify(i)}var i5=/"__proto__"\\s*:/,n5=/"constructor"\\s*:/;function t5(i){let n=JSON.parse(i);if(n===null||typeof n!=="object")return n;if(i5.test(i)===!1&&n5.test(i)===!1)return n;return r5(n)}function r5(i){let n=[i];while(n.length){let r=n;n=[];for(let u of r){if(Object.prototype.hasOwnProperty.call(u,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(u,"constructor")&&Object.prototype.hasOwnProperty.call(u.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(let t in u){let c=u[t];if(c&&typeof c==="object")n.push(c)}}}return i}function u5(i){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return t5(i)}finally{Error.stackTraceLimit=n}}var lo=Symbol.for("vercel.ai.validator");function c5(i){return{[lo]:!0,validate:i}}function o5(i){return typeof i==="object"&&i!==null&&lo in i&&i[lo]===!0&&"validate"in i}function g5(i){return o5(i)?i:h5(i)}function h5(i){return c5(async(n)=>{let r=await i["~standard"].validate(n);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new sn({value:n,cause:r.issues})}})}async function b0({value:i,schema:n}){let r=await $o({value:i,schema:n});if(!r.success)throw sn.wrap({value:i,cause:r.error});return r.value}async function $o({value:i,schema:n}){let r=g5(n);try{if(r.validate==null)return{success:!0,value:i,rawValue:i};let u=await r.validate(i);if(u.success)return{success:!0,value:u.value,rawValue:i};return{success:!1,error:sn.wrap({value:i,cause:u.error}),rawValue:i}}catch(u){return{success:!1,error:sn.wrap({value:i,cause:u}),rawValue:i}}}async function uu({text:i,schema:n}){try{let r=u5(i);if(n==null)return{success:!0,value:r,rawValue:r};return await $o({value:r,schema:n})}catch(r){return{success:!1,error:Bg.isInstance(r)?r:new Bg({text:i,cause:r}),rawValue:void 0}}}var _5=(i,n)=>{let r=0;for(;rtypeof i==="string"?{...s4,name:i}:{...s4,...i};function Ki(){return{}}function w5(i,n){var r,u,t;let c={type:"array"};if(((r=i.type)==null?void 0:r._def)&&((t=(u=i.type)==null?void 0:u._def)==null?void 0:t.typeName)!==L.ZodAny)c.items=a(i.type._def,{...n,currentPath:[...n.currentPath,"items"]});if(i.minLength)c.minItems=i.minLength.value;if(i.maxLength)c.maxItems=i.maxLength.value;if(i.exactLength)c.minItems=i.exactLength.value,c.maxItems=i.exactLength.value;return c}function b5(i){let n={type:"integer",format:"int64"};if(!i.checks)return n;for(let r of i.checks)switch(r.kind){case"min":if(r.inclusive)n.minimum=r.value;else n.exclusiveMinimum=r.value;break;case"max":if(r.inclusive)n.maximum=r.value;else n.exclusiveMaximum=r.value;break;case"multipleOf":n.multipleOf=r.value;break}return n}function v5(){return{type:"boolean"}}function t6(i,n){return a(i.type._def,n)}var f5=(i,n)=>{return a(i.innerType._def,n)};function r6(i,n,r){let u=r!=null?r:n.dateStrategy;if(Array.isArray(u))return{anyOf:u.map((t,c)=>r6(i,n,t))};switch(u){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return O5(i)}}var O5=(i)=>{let n={type:"integer",format:"unix-time"};for(let r of i.checks)switch(r.kind){case"min":n.minimum=r.value;break;case"max":n.maximum=r.value;break}return n};function j5(i,n){return{...a(i.innerType._def,n),default:i.defaultValue()}}function U5(i,n){return n.effectStrategy==="input"?a(i.schema._def,n):Ki()}function N5(i){return{type:"string",enum:Array.from(i.values)}}var z5=(i)=>{if("type"in i&&i.type==="string")return!1;return"allOf"in i};function W5(i,n){let r=[a(i.left._def,{...n,currentPath:[...n.currentPath,"allOf","0"]}),a(i.right._def,{...n,currentPath:[...n.currentPath,"allOf","1"]})].filter((t)=>!!t),u=[];return r.forEach((t)=>{if(z5(t))u.push(...t.allOf);else{let c=t;if("additionalProperties"in t&&t.additionalProperties===!1){let{additionalProperties:g,...h}=t;c=h}u.push(c)}}),u.length?{allOf:u}:void 0}function D5(i){let n=typeof i.value;if(n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string")return{type:Array.isArray(i.value)?"array":"object"};return{type:n==="bigint"?"integer":n,const:i.value}}var h0=void 0,Zi={cuid:/^[cC][^\\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_\'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(h0===void 0)h0=RegExp("^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$","u");return h0},uuid:/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?: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])\\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/};function u6(i,n){let r={type:"string"};if(i.checks)for(let u of i.checks)switch(u.kind){case"min":r.minLength=typeof r.minLength==="number"?Math.max(r.minLength,u.value):u.value;break;case"max":r.maxLength=typeof r.maxLength==="number"?Math.min(r.maxLength,u.value):u.value;break;case"email":switch(n.emailStrategy){case"format:email":ei(r,"email",u.message,n);break;case"format:idn-email":ei(r,"idn-email",u.message,n);break;case"pattern:zod":Li(r,Zi.email,u.message,n);break}break;case"url":ei(r,"uri",u.message,n);break;case"uuid":ei(r,"uuid",u.message,n);break;case"regex":Li(r,u.regex,u.message,n);break;case"cuid":Li(r,Zi.cuid,u.message,n);break;case"cuid2":Li(r,Zi.cuid2,u.message,n);break;case"startsWith":Li(r,RegExp(`^${_0(u.value,n)}`),u.message,n);break;case"endsWith":Li(r,RegExp(`${_0(u.value,n)}$`),u.message,n);break;case"datetime":ei(r,"date-time",u.message,n);break;case"date":ei(r,"date",u.message,n);break;case"time":ei(r,"time",u.message,n);break;case"duration":ei(r,"duration",u.message,n);break;case"length":r.minLength=typeof r.minLength==="number"?Math.max(r.minLength,u.value):u.value,r.maxLength=typeof r.maxLength==="number"?Math.min(r.maxLength,u.value):u.value;break;case"includes":{Li(r,RegExp(_0(u.value,n)),u.message,n);break}case"ip":{if(u.version!=="v6")ei(r,"ipv4",u.message,n);if(u.version!=="v4")ei(r,"ipv6",u.message,n);break}case"base64url":Li(r,Zi.base64url,u.message,n);break;case"jwt":Li(r,Zi.jwt,u.message,n);break;case"cidr":{if(u.version!=="v6")Li(r,Zi.ipv4Cidr,u.message,n);if(u.version!=="v4")Li(r,Zi.ipv6Cidr,u.message,n);break}case"emoji":Li(r,Zi.emoji(),u.message,n);break;case"ulid":{Li(r,Zi.ulid,u.message,n);break}case"base64":{switch(n.base64Strategy){case"format:binary":{ei(r,"binary",u.message,n);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{Li(r,Zi.base64,u.message,n);break}}break}case"nanoid":Li(r,Zi.nanoid,u.message,n);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function _0(i,n){return n.patternStrategy==="escape"?E5(i):i}var J5=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function E5(i){let n="";for(let r=0;rc.format))){if(!i.anyOf)i.anyOf=[];if(i.format)i.anyOf.push({format:i.format}),delete i.format;i.anyOf.push({format:n,...r&&u.errorMessages&&{errorMessage:{format:r}}})}else i.format=n}function Li(i,n,r,u){var t;if(i.pattern||((t=i.allOf)==null?void 0:t.some((c)=>c.pattern))){if(!i.allOf)i.allOf=[];if(i.pattern)i.allOf.push({pattern:i.pattern}),delete i.pattern;i.allOf.push({pattern:i6(n,u),...r&&u.errorMessages&&{errorMessage:{pattern:r}}})}else i.pattern=i6(n,u)}function i6(i,n){var r;if(!n.applyRegexFlags||!i.flags)return i.source;let u={i:i.flags.includes("i"),m:i.flags.includes("m"),s:i.flags.includes("s")},t=u.i?i.source.toLowerCase():i.source,c="",g=!1,h=!1,_=!1;for(let l=0;l{return typeof n[n[c]]!=="number"}).map((c)=>n[c]),t=Array.from(new Set(u.map((c)=>typeof c)));return{type:t.length===1?t[0]==="string"?"string":"number":["string","number"],enum:u}}function q5(){return{not:Ki()}}function X5(){return{type:"null"}}var l0={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function L5(i,n){let r=i.options instanceof Map?Array.from(i.options.values()):i.options;if(r.every((u)=>(u._def.typeName in l0)&&(!u._def.checks||!u._def.checks.length))){let u=r.reduce((t,c)=>{let g=l0[c._def.typeName];return g&&!t.includes(g)?[...t,g]:t},[]);return{type:u.length>1?u:u[0]}}else if(r.every((u)=>u._def.typeName==="ZodLiteral"&&!u.description)){let u=r.reduce((t,c)=>{let g=typeof c._def.value;switch(g){case"string":case"number":case"boolean":return[...t,g];case"bigint":return[...t,"integer"];case"object":if(c._def.value===null)return[...t,"null"];case"symbol":case"undefined":case"function":default:return t}},[]);if(u.length===r.length){let t=u.filter((c,g,h)=>h.indexOf(c)===g);return{type:t.length>1?t:t[0],enum:r.reduce((c,g)=>{return c.includes(g._def.value)?c:[...c,g._def.value]},[])}}}else if(r.every((u)=>u._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((u,t)=>[...u,...t._def.values.filter((c)=>!u.includes(c))],[])};return I5(i,n)}var I5=(i,n)=>{let r=(i.options instanceof Map?Array.from(i.options.values()):i.options).map((u,t)=>a(u._def,{...n,currentPath:[...n.currentPath,"anyOf",`${t}`]})).filter((u)=>!!u&&(!n.strictUnions||typeof u==="object"&&Object.keys(u).length>0));return r.length?{anyOf:r}:void 0};function Y5(i,n){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(i.innerType._def.typeName)&&(!i.innerType._def.checks||!i.innerType._def.checks.length))return{type:[l0[i.innerType._def.typeName],"null"]};let r=a(i.innerType._def,{...n,currentPath:[...n.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Q5(i){let n={type:"number"};if(!i.checks)return n;for(let r of i.checks)switch(r.kind){case"int":n.type="integer";break;case"min":if(r.inclusive)n.minimum=r.value;else n.exclusiveMinimum=r.value;break;case"max":if(r.inclusive)n.maximum=r.value;else n.exclusiveMaximum=r.value;break;case"multipleOf":n.multipleOf=r.value;break}return n}function m5(i,n){let r={type:"object",properties:{}},u=[],t=i.shape();for(let g in t){let h=t[g];if(h===void 0||h._def===void 0)continue;let _=A5(h),l=a(h._def,{...n,currentPath:[...n.currentPath,"properties",g],propertyPath:[...n.currentPath,"properties",g]});if(l===void 0)continue;if(r.properties[g]=l,!_)u.push(g)}if(u.length)r.required=u;let c=S5(i,n);if(c!==void 0)r.additionalProperties=c;return r}function S5(i,n){if(i.catchall._def.typeName!=="ZodNever")return a(i.catchall._def,{...n,currentPath:[...n.currentPath,"additionalProperties"]});switch(i.unknownKeys){case"passthrough":return n.allowedAdditionalProperties;case"strict":return n.rejectedAdditionalProperties;case"strip":return n.removeAdditionalStrategy==="strict"?n.allowedAdditionalProperties:n.rejectedAdditionalProperties}}function A5(i){try{return i.isOptional()}catch(n){return!0}}var B5=(i,n)=>{var r;if(n.currentPath.toString()===((r=n.propertyPath)==null?void 0:r.toString()))return a(i.innerType._def,n);let u=a(i.innerType._def,{...n,currentPath:[...n.currentPath,"anyOf","1"]});return u?{anyOf:[{not:Ki()},u]}:Ki()},K5=(i,n)=>{if(n.pipeStrategy==="input")return a(i.in._def,n);else if(n.pipeStrategy==="output")return a(i.out._def,n);let r=a(i.in._def,{...n,currentPath:[...n.currentPath,"allOf","0"]}),u=a(i.out._def,{...n,currentPath:[...n.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,u].filter((t)=>t!==void 0)}};function V5(i,n){return a(i.type._def,n)}function M5(i,n){let u={type:"array",uniqueItems:!0,items:a(i.valueType._def,{...n,currentPath:[...n.currentPath,"items"]})};if(i.minSize)u.minItems=i.minSize.value;if(i.maxSize)u.maxItems=i.maxSize.value;return u}function x5(i,n){if(i.rest)return{type:"array",minItems:i.items.length,items:i.items.map((r,u)=>a(r._def,{...n,currentPath:[...n.currentPath,"items",`${u}`]})).reduce((r,u)=>u===void 0?r:[...r,u],[]),additionalItems:a(i.rest._def,{...n,currentPath:[...n.currentPath,"additionalItems"]})};else return{type:"array",minItems:i.items.length,maxItems:i.items.length,items:i.items.map((r,u)=>a(r._def,{...n,currentPath:[...n.currentPath,"items",`${u}`]})).reduce((r,u)=>u===void 0?r:[...r,u],[])}}function F5(){return{not:Ki()}}function P5(){return Ki()}var y5=(i,n)=>{return a(i.innerType._def,n)},T5=(i,n,r)=>{switch(n){case L.ZodString:return u6(i,r);case L.ZodNumber:return Q5(i);case L.ZodObject:return m5(i,r);case L.ZodBigInt:return b5(i);case L.ZodBoolean:return v5();case L.ZodDate:return r6(i,r);case L.ZodUndefined:return F5();case L.ZodNull:return X5();case L.ZodArray:return w5(i,r);case L.ZodUnion:case L.ZodDiscriminatedUnion:return L5(i,r);case L.ZodIntersection:return W5(i,r);case L.ZodTuple:return x5(i,r);case L.ZodRecord:return c6(i,r);case L.ZodLiteral:return D5(i);case L.ZodEnum:return N5(i);case L.ZodNativeEnum:return G5(i);case L.ZodNullable:return Y5(i,r);case L.ZodOptional:return B5(i,r);case L.ZodMap:return H5(i,r);case L.ZodSet:return M5(i,r);case L.ZodLazy:return()=>i.getter()._def;case L.ZodPromise:return V5(i,r);case L.ZodNaN:case L.ZodNever:return q5();case L.ZodEffects:return U5(i,r);case L.ZodAny:return Ki();case L.ZodUnknown:return P5();case L.ZodDefault:return j5(i,r);case L.ZodBranded:return t6(i,r);case L.ZodReadonly:return y5(i,r);case L.ZodCatch:return f5(i,r);case L.ZodPipeline:return K5(i,r);case L.ZodFunction:case L.ZodVoid:case L.ZodSymbol:return;default:return((u)=>{return})(n)}};function a(i,n,r=!1){var u;let t=n.seen.get(i);if(n.override){let _=(u=n.override)==null?void 0:u.call(n,i,n,t,r);if(_!==l5)return _}if(t&&!r){let _=k5(t,n);if(_!==void 0)return _}let c={def:i,path:n.currentPath,jsonSchema:void 0};n.seen.set(i,c);let g=T5(i,i.typeName,n),h=typeof g==="function"?a(g(),n):g;if(h)C5(i,n,h);if(n.postProcess){let _=n.postProcess(h,i,n);return c.jsonSchema=h,_}return c.jsonSchema=h,h}var k5=(i,n)=>{switch(n.$refStrategy){case"root":return{$ref:i.path.join("/")};case"relative":return{$ref:_5(n.currentPath,i.path)};case"none":case"seen":{if(i.path.lengthn.currentPath[u]===r))return console.warn(`Recursive reference detected at ${n.currentPath.join("/")}! Defaulting to any`),Ki();return n.$refStrategy==="seen"?Ki():void 0}}},C5=(i,n,r)=>{if(i.description)r.description=i.description;return r},R5=(i)=>{let n=$5(i),r=n.name!==void 0?[...n.basePath,n.definitionPath,n.name]:n.basePath;return{...n,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(n.definitions).map(([u,t])=>[t._def,{def:t._def,path:[...n.basePath,n.definitionPath,u],jsonSchema:void 0}]))}},Z5=(i,n)=>{var r;let u=R5(n),t=typeof n==="object"&&n.definitions?Object.entries(n.definitions).reduce((l,[$,w])=>{var b;return{...l,[$]:(b=a(w._def,{...u,currentPath:[...u.basePath,u.definitionPath,$]},!0))!=null?b:Ki()}},{}):void 0,c=typeof n==="string"?n:(n==null?void 0:n.nameStrategy)==="title"?void 0:n==null?void 0:n.name,g=(r=a(i._def,c===void 0?u:{...u,currentPath:[...u.basePath,u.definitionPath,c]},!1))!=null?r:Ki(),h=typeof n==="object"&&n.name!==void 0&&n.nameStrategy==="title"?n.name:void 0;if(h!==void 0)g.title=h;let _=c===void 0?t?{...g,[u.definitionPath]:t}:g:{$ref:[...u.$refStrategy==="relative"?[]:u.basePath,u.definitionPath,c].join("/"),[u.definitionPath]:{...t,[c]:g}};return _.$schema="http://json-schema.org/draft-07/schema#",_},e5=Z5;function p5(i,n){var r;let u=(r=n==null?void 0:n.useReferences)!=null?r:!1;return v0(e5(i,{$refStrategy:u?"root":"none"}),{validate:async(t)=>{let c=await i.safeParseAsync(t);return c.success?{success:!0,value:c.data}:{success:!1,error:c.error}}})}function d5(i,n){var r;let u=(r=n==null?void 0:n.useReferences)!=null?r:!1,t=Vr(i,{target:"draft-7",io:"output",reused:u?"ref":"inline"});return v0(t,{validate:async(c)=>{let g=await Mr(i,c);return g.success?{success:!0,value:g.data}:{success:!1,error:g.error}}})}function a5(i){return"_zod"in i}function s5(i,n){if(a5(i))return d5(i,n);else return p5(i,n)}var $0=Symbol.for("vercel.ai.schema");function v0(i,{validate:n}={}){return{[$0]:!0,_type:void 0,[lo]:!0,jsonSchema:i,validate:n}}function iG(i){return typeof i==="object"&&i!==null&&$0 in i&&i[$0]===!0&&"jsonSchema"in i&&"validate"in i}function o6(i){return i==null?v0({properties:{},additionalProperties:!1}):iG(i)?i:s5(i)}var nG=Object.defineProperty,tG=(i,n)=>{for(var r in n)nG(i,r,{get:n[r],enumerable:!0})},rG="AI_NoOutputSpecifiedError",uG=`vercel.ai.error.${rG}`,cG=Symbol.for(uG),oG;oG=cG;var gG="AI_InvalidArgumentError",hG=`vercel.ai.error.${gG}`,_G=Symbol.for(hG),lG;lG=_G;var $G="AI_InvalidStreamPartError",wG=`vercel.ai.error.${$G}`,bG=Symbol.for(wG),vG;vG=bG;var fG="AI_InvalidToolInputError",OG=`vercel.ai.error.${fG}`,jG=Symbol.for(OG),UG;UG=jG;var NG="AI_MCPClientError",zG=`vercel.ai.error.${NG}`,WG=Symbol.for(zG),DG;DG=WG;var JG="AI_NoImageGeneratedError",EG=`vercel.ai.error.${JG}`,HG=Symbol.for(EG),GG;GG=HG;var l6="AI_NoObjectGeneratedError",$6=`vercel.ai.error.${l6}`,qG=Symbol.for($6),w6,g6=class extends xi{constructor({message:i="No object generated.",cause:n,text:r,response:u,usage:t,finishReason:c}){super({name:l6,message:i,cause:n});this[w6]=!0,this.text=r,this.response=u,this.usage=t,this.finishReason=c}static isInstance(i){return xi.hasMarker(i,$6)}};w6=qG;var XG="AI_NoOutputGeneratedError",LG=`vercel.ai.error.${XG}`,IG=Symbol.for(LG),YG;YG=IG;var QG="AI_NoSuchToolError",mG=`vercel.ai.error.${QG}`,SG=Symbol.for(mG),AG;AG=SG;var BG="AI_ToolCallRepairError",KG=`vercel.ai.error.${BG}`,VG=Symbol.for(KG),MG;MG=VG;var xG="AI_InvalidDataContentError",FG=`vercel.ai.error.${xG}`,PG=Symbol.for(FG),yG;yG=PG;var TG="AI_InvalidMessageRoleError",kG=`vercel.ai.error.${TG}`,CG=Symbol.for(kG),RG;RG=CG;var b6="AI_MessageConversionError",v6=`vercel.ai.error.${b6}`,ZG=Symbol.for(v6),f6,eG=class extends xi{constructor({originalMessage:i,message:n}){super({name:b6,message:n});this[f6]=!0,this.originalMessage=i}static isInstance(i){return xi.hasMarker(i,v6)}};f6=ZG;var pG="AI_DownloadError",dG=`vercel.ai.error.${pG}`,aG=Symbol.for(dG),sG;sG=aG;var iq="AI_RetryError",nq=`vercel.ai.error.${iq}`,tq=Symbol.for(nq),rq;rq=tq;var O6=o.union([o.string(),o.instanceof(Uint8Array),o.instanceof(ArrayBuffer),o.custom((i)=>{var n,r;return(r=(n=globalThis.Buffer)==null?void 0:n.isBuffer(i))!=null?r:!1},{message:"Must be a Buffer"})]);var cu=o.lazy(()=>o.union([o.null(),o.string(),o.number(),o.boolean(),o.record(o.string(),cu),o.array(cu)])),e=o.record(o.string(),o.record(o.string(),cu)),j6=o.object({type:o.literal("text"),text:o.string(),providerOptions:e.optional()}),uq=o.object({type:o.literal("image"),image:o.union([O6,o.instanceof(URL)]),mediaType:o.string().optional(),providerOptions:e.optional()}),U6=o.object({type:o.literal("file"),data:o.union([O6,o.instanceof(URL)]),filename:o.string().optional(),mediaType:o.string(),providerOptions:e.optional()}),cq=o.object({type:o.literal("reasoning"),text:o.string(),providerOptions:e.optional()}),oq=o.object({type:o.literal("tool-call"),toolCallId:o.string(),toolName:o.string(),input:o.unknown(),providerOptions:e.optional(),providerExecuted:o.boolean().optional()}),gq=o.discriminatedUnion("type",[o.object({type:o.literal("text"),value:o.string()}),o.object({type:o.literal("json"),value:cu}),o.object({type:o.literal("error-text"),value:o.string()}),o.object({type:o.literal("error-json"),value:cu}),o.object({type:o.literal("content"),value:o.array(o.union([o.object({type:o.literal("text"),text:o.string()}),o.object({type:o.literal("media"),data:o.string(),mediaType:o.string()})]))})]),N6=o.object({type:o.literal("tool-result"),toolCallId:o.string(),toolName:o.string(),output:gq,providerOptions:e.optional()}),hq=o.object({role:o.literal("system"),content:o.string(),providerOptions:e.optional()});var _q=o.object({role:o.literal("user"),content:o.union([o.string(),o.array(o.union([j6,uq,U6]))]),providerOptions:e.optional()});var lq=o.object({role:o.literal("assistant"),content:o.union([o.string(),o.array(o.union([j6,U6,cq,oq,N6]))]),providerOptions:e.optional()});var $q=o.object({role:o.literal("tool"),content:o.array(N6),providerOptions:e.optional()});var SA=o.union([hq,_q,lq,$q]);function h6({output:i,tool:n,errorMode:r}){if(r==="text")return{type:"error-text",value:au(i)};else if(r==="json")return{type:"error-json",value:_6(i)};if(n==null?void 0:n.toModelOutput)return n.toModelOutput(i);return typeof i==="string"?{type:"text",value:i}:{type:"json",value:_6(i)}}function _6(i){return i===void 0?null:i}var BA=Gn({prefix:"aitxt",size:24});var VA=class extends TransformStream{constructor(){super({transform(i,n){n.enqueue(`data: ${JSON.stringify(i)}\n\n`)},flush(i){i.enqueue(`data: [DONE]\n\n`)}})}};var FA=o.union([o.strictObject({type:o.literal("text-start"),id:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("text-delta"),id:o.string(),delta:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("text-end"),id:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("error"),errorText:o.string()}),o.strictObject({type:o.literal("tool-input-start"),toolCallId:o.string(),toolName:o.string(),providerExecuted:o.boolean().optional(),dynamic:o.boolean().optional()}),o.strictObject({type:o.literal("tool-input-delta"),toolCallId:o.string(),inputTextDelta:o.string()}),o.strictObject({type:o.literal("tool-input-available"),toolCallId:o.string(),toolName:o.string(),input:o.unknown(),providerExecuted:o.boolean().optional(),providerMetadata:e.optional(),dynamic:o.boolean().optional()}),o.strictObject({type:o.literal("tool-input-error"),toolCallId:o.string(),toolName:o.string(),input:o.unknown(),providerExecuted:o.boolean().optional(),providerMetadata:e.optional(),dynamic:o.boolean().optional(),errorText:o.string()}),o.strictObject({type:o.literal("tool-output-available"),toolCallId:o.string(),output:o.unknown(),providerExecuted:o.boolean().optional(),dynamic:o.boolean().optional(),preliminary:o.boolean().optional()}),o.strictObject({type:o.literal("tool-output-error"),toolCallId:o.string(),errorText:o.string(),providerExecuted:o.boolean().optional(),dynamic:o.boolean().optional()}),o.strictObject({type:o.literal("reasoning"),text:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("reasoning-start"),id:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("reasoning-delta"),id:o.string(),delta:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("reasoning-end"),id:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("reasoning-part-finish")}),o.strictObject({type:o.literal("source-url"),sourceId:o.string(),url:o.string(),title:o.string().optional(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("source-document"),sourceId:o.string(),mediaType:o.string(),title:o.string(),filename:o.string().optional(),providerMetadata:e.optional()}),o.strictObject({type:o.literal("file"),url:o.string(),mediaType:o.string(),providerMetadata:e.optional()}),o.strictObject({type:o.string().startsWith("data-"),id:o.string().optional(),data:o.unknown(),transient:o.boolean().optional()}),o.strictObject({type:o.literal("start-step")}),o.strictObject({type:o.literal("finish-step")}),o.strictObject({type:o.literal("start"),messageId:o.string().optional(),messageMetadata:o.unknown().optional()}),o.strictObject({type:o.literal("finish"),messageMetadata:o.unknown().optional()}),o.strictObject({type:o.literal("abort")}),o.strictObject({type:o.literal("message-metadata"),messageMetadata:o.unknown()})]);function wq(i){return i.type.startsWith("data-")}function z6(i,n){if(i===void 0&&n===void 0)return;if(i===void 0)return n;if(n===void 0)return i;let r={...i};for(let u in n)if(Object.prototype.hasOwnProperty.call(n,u)){let t=n[u];if(t===void 0)continue;let c=u in i?i[u]:void 0,g=t!==null&&typeof t==="object"&&!Array.isArray(t)&&!(t instanceof Date)&&!(t instanceof RegExp),h=c!==null&&c!==void 0&&typeof c==="object"&&!Array.isArray(c)&&!(c instanceof Date)&&!(c instanceof RegExp);if(g&&h)r[u]=z6(c,t);else r[u]=t}return r}function bq(i){let n=["ROOT"],r=-1,u=null;function t(_,l,$){switch(_){case\'"\':{r=l,n.pop(),n.push($),n.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=l,u=l,n.pop(),n.push($),n.push("INSIDE_LITERAL");break}case"-":{n.pop(),n.push($),n.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=l,n.pop(),n.push($),n.push("INSIDE_NUMBER");break}case"{":{r=l,n.pop(),n.push($),n.push("INSIDE_OBJECT_START");break}case"[":{r=l,n.pop(),n.push($),n.push("INSIDE_ARRAY_START");break}}}function c(_,l){switch(_){case",":{n.pop(),n.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=l,n.pop();break}}}function g(_,l){switch(_){case",":{n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=l,n.pop();break}}}for(let _=0;_=0;_--)switch(n[_]){case"INSIDE_STRING":{h+=\'"\';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{h+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{h+="]";break}case"INSIDE_LITERAL":{let $=i.substring(u,i.length);if("true".startsWith($))h+="true".slice($.length);else if("false".startsWith($))h+="false".slice($.length);else if("null".startsWith($))h+="null".slice($.length)}}return h}async function W6(i){if(i===void 0)return{value:void 0,state:"undefined-input"};let n=await uu({text:i});if(n.success)return{value:n.value,state:"successful-parse"};if(n=await uu({text:bq(i)}),n.success)return{value:n.value,state:"repaired-parse"};return{value:void 0,state:"failed-parse"}}function qn(i){return i.type.startsWith("tool-")}function vq(i){return i.type==="dynamic-tool"}function fq(i){return qn(i)||vq(i)}function $t(i){return i.type.split("-").slice(1).join("-")}function Oq({lastMessage:i,messageId:n}){return{message:(i==null?void 0:i.role)==="assistant"?i:{id:n,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function jq({stream:i,messageMetadataSchema:n,dataPartSchemas:r,runUpdateMessageJob:u,onError:t,onToolCall:c,onData:g}){return i.pipeThrough(new TransformStream({async transform(h,_){await u(async({state:l,write:$})=>{var w,b,v,f;function U(O){let E=l.message.parts.filter(qn).find((X)=>X.toolCallId===O);if(E==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return E}function z(O){let E=l.message.parts.filter((X)=>X.type==="dynamic-tool").find((X)=>X.toolCallId===O);if(E==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return E}function J(O){var W;let E=l.message.parts.find((Y)=>qn(Y)&&Y.toolCallId===O.toolCallId),X=O,H=E;if(E!=null){if(E.state=O.state,H.input=X.input,H.output=X.output,H.errorText=X.errorText,H.rawInput=X.rawInput,H.preliminary=X.preliminary,H.providerExecuted=(W=X.providerExecuted)!=null?W:E.providerExecuted,X.providerMetadata!=null&&E.state==="input-available")E.callProviderMetadata=X.providerMetadata}else l.message.parts.push({type:`tool-${O.toolName}`,toolCallId:O.toolCallId,state:O.state,input:X.input,output:X.output,rawInput:X.rawInput,errorText:X.errorText,providerExecuted:X.providerExecuted,preliminary:X.preliminary,...X.providerMetadata!=null?{callProviderMetadata:X.providerMetadata}:{}})}function N(O){var W;let E=l.message.parts.find((Y)=>Y.type==="dynamic-tool"&&Y.toolCallId===O.toolCallId),X=O,H=E;if(E!=null){if(E.state=O.state,H.toolName=O.toolName,H.input=X.input,H.output=X.output,H.errorText=X.errorText,H.rawInput=(W=X.rawInput)!=null?W:H.rawInput,H.preliminary=X.preliminary,X.providerMetadata!=null&&E.state==="input-available")E.callProviderMetadata=X.providerMetadata}else l.message.parts.push({type:"dynamic-tool",toolName:O.toolName,toolCallId:O.toolCallId,state:O.state,input:X.input,output:X.output,errorText:X.errorText,preliminary:X.preliminary,...X.providerMetadata!=null?{callProviderMetadata:X.providerMetadata}:{}})}async function j(O){if(O!=null){let W=l.message.metadata!=null?z6(l.message.metadata,O):O;if(n!=null)await b0({value:W,schema:n});l.message.metadata=W}}switch(h.type){case"text-start":{let O={type:"text",text:"",providerMetadata:h.providerMetadata,state:"streaming"};l.activeTextParts[h.id]=O,l.message.parts.push(O),$();break}case"text-delta":{let O=l.activeTextParts[h.id];O.text+=h.delta,O.providerMetadata=(w=h.providerMetadata)!=null?w:O.providerMetadata,$();break}case"text-end":{let O=l.activeTextParts[h.id];O.state="done",O.providerMetadata=(b=h.providerMetadata)!=null?b:O.providerMetadata,delete l.activeTextParts[h.id],$();break}case"reasoning-start":{let O={type:"reasoning",text:"",providerMetadata:h.providerMetadata,state:"streaming"};l.activeReasoningParts[h.id]=O,l.message.parts.push(O),$();break}case"reasoning-delta":{let O=l.activeReasoningParts[h.id];O.text+=h.delta,O.providerMetadata=(v=h.providerMetadata)!=null?v:O.providerMetadata,$();break}case"reasoning-end":{let O=l.activeReasoningParts[h.id];O.providerMetadata=(f=h.providerMetadata)!=null?f:O.providerMetadata,O.state="done",delete l.activeReasoningParts[h.id],$();break}case"file":{l.message.parts.push({type:"file",mediaType:h.mediaType,url:h.url}),$();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:h.sourceId,url:h.url,title:h.title,providerMetadata:h.providerMetadata}),$();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:h.sourceId,mediaType:h.mediaType,title:h.title,filename:h.filename,providerMetadata:h.providerMetadata}),$();break}case"tool-input-start":{let O=l.message.parts.filter(qn);if(l.partialToolCalls[h.toolCallId]={text:"",toolName:h.toolName,index:O.length,dynamic:h.dynamic},h.dynamic)N({toolCallId:h.toolCallId,toolName:h.toolName,state:"input-streaming",input:void 0});else J({toolCallId:h.toolCallId,toolName:h.toolName,state:"input-streaming",input:void 0,providerExecuted:h.providerExecuted});$();break}case"tool-input-delta":{let O=l.partialToolCalls[h.toolCallId];O.text+=h.inputTextDelta;let{value:W}=await W6(O.text);if(O.dynamic)N({toolCallId:h.toolCallId,toolName:O.toolName,state:"input-streaming",input:W});else J({toolCallId:h.toolCallId,toolName:O.toolName,state:"input-streaming",input:W});$();break}case"tool-input-available":{if(h.dynamic)N({toolCallId:h.toolCallId,toolName:h.toolName,state:"input-available",input:h.input,providerMetadata:h.providerMetadata});else J({toolCallId:h.toolCallId,toolName:h.toolName,state:"input-available",input:h.input,providerExecuted:h.providerExecuted,providerMetadata:h.providerMetadata});if($(),c&&!h.providerExecuted)await c({toolCall:h});break}case"tool-input-error":{if(h.dynamic)N({toolCallId:h.toolCallId,toolName:h.toolName,state:"output-error",input:h.input,errorText:h.errorText,providerMetadata:h.providerMetadata});else J({toolCallId:h.toolCallId,toolName:h.toolName,state:"output-error",input:void 0,rawInput:h.input,errorText:h.errorText,providerExecuted:h.providerExecuted,providerMetadata:h.providerMetadata});$();break}case"tool-output-available":{if(h.dynamic){let O=z(h.toolCallId);N({toolCallId:h.toolCallId,toolName:O.toolName,state:"output-available",input:O.input,output:h.output,preliminary:h.preliminary})}else{let O=U(h.toolCallId);J({toolCallId:h.toolCallId,toolName:$t(O),state:"output-available",input:O.input,output:h.output,providerExecuted:h.providerExecuted,preliminary:h.preliminary})}$();break}case"tool-output-error":{if(h.dynamic){let O=z(h.toolCallId);N({toolCallId:h.toolCallId,toolName:O.toolName,state:"output-error",input:O.input,errorText:h.errorText})}else{let O=U(h.toolCallId);J({toolCallId:h.toolCallId,toolName:$t(O),state:"output-error",input:O.input,rawInput:O.rawInput,errorText:h.errorText})}$();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{if(h.messageId!=null)l.message.id=h.messageId;if(await j(h.messageMetadata),h.messageId!=null||h.messageMetadata!=null)$();break}case"finish":{if(await j(h.messageMetadata),h.messageMetadata!=null)$();break}case"message-metadata":{if(await j(h.messageMetadata),h.messageMetadata!=null)$();break}case"error":{t==null||t(new Error(h.errorText));break}default:if(wq(h)){if((r==null?void 0:r[h.type])!=null)await b0({value:h.data,schema:r[h.type]});let O=h;if(O.transient){g==null||g(O);break}let W=O.id!=null?l.message.parts.find((E)=>O.type===E.type&&O.id===E.id):void 0;if(W!=null)W.data=O.data;else l.message.parts.push(O);g==null||g(O),$()}}_.enqueue(h)})}}))}function Uq({messageId:i,originalMessages:n=[],onFinish:r,onError:u,stream:t}){let c=n==null?void 0:n[n.length-1];if((c==null?void 0:c.role)!=="assistant")c=void 0;else i=c.id;let g=!1,h=t.pipeThrough(new TransformStream({transform(b,v){if(b.type==="start"){let f=b;if(f.messageId==null&&i!=null)f.messageId=i}if(b.type==="abort")g=!0;v.enqueue(b)}}));if(r==null)return h;let _=Oq({lastMessage:c?structuredClone(c):void 0,messageId:i!=null?i:""}),l=async(b)=>{await b({state:_,write:()=>{}})},$=!1,w=async()=>{if($||!r)return;$=!0;let b=_.message.id===(c==null?void 0:c.id);await r({isAborted:g,isContinuation:b,responseMessage:_.message,messages:[...b?n.slice(0,-1):n,_.message]})};return jq({stream:h,runUpdateMessageJob:l,onError:u}).pipeThrough(new TransformStream({transform(b,v){v.enqueue(b)},async cancel(){await w()},async flush(){await w()}}))}var yA=Gn({prefix:"aitxt",size:24});function D6(i,n){let r=[];if(n==null?void 0:n.ignoreIncompleteToolCalls)i=i.map((t)=>({...t,parts:t.parts.filter((c)=>!fq(c)||c.state!=="input-streaming"&&c.state!=="input-available")}));for(let t of i)switch(t.role){case"system":{let c=t.parts.filter((h)=>h.type==="text"),g=c.reduce((h,_)=>{if(_.providerMetadata!=null)return{...h,..._.providerMetadata};return h},{});r.push({role:"system",content:c.map((h)=>h.text).join(""),...Object.keys(g).length>0?{providerOptions:g}:{}});break}case"user":{r.push({role:"user",content:t.parts.filter((c)=>c.type==="text"||c.type==="file").map((c)=>{switch(c.type){case"text":return{type:"text",text:c.text,...c.providerMetadata!=null?{providerOptions:c.providerMetadata}:{}};case"file":return{type:"file",mediaType:c.mediaType,filename:c.filename,data:c.url,...c.providerMetadata!=null?{providerOptions:c.providerMetadata}:{}};default:return c}})});break}case"assistant":{if(t.parts!=null){let c=function(){var h,_;if(g.length===0)return;let l=[];for(let w of g)if(w.type==="text")l.push({type:"text",text:w.text,...w.providerMetadata!=null?{providerOptions:w.providerMetadata}:{}});else if(w.type==="file")l.push({type:"file",mediaType:w.mediaType,filename:w.filename,data:w.url});else if(w.type==="reasoning")l.push({type:"reasoning",text:w.text,providerOptions:w.providerMetadata});else if(w.type==="dynamic-tool"){let b=w.toolName;if(w.state!=="input-streaming")l.push({type:"tool-call",toolCallId:w.toolCallId,toolName:b,input:w.input,...w.callProviderMetadata!=null?{providerOptions:w.callProviderMetadata}:{}})}else if(qn(w)){let b=$t(w);if(w.state!=="input-streaming"){if(l.push({type:"tool-call",toolCallId:w.toolCallId,toolName:b,input:w.state==="output-error"?(h=w.input)!=null?h:w.rawInput:w.input,providerExecuted:w.providerExecuted,...w.callProviderMetadata!=null?{providerOptions:w.callProviderMetadata}:{}}),w.providerExecuted===!0&&(w.state==="output-available"||w.state==="output-error"))l.push({type:"tool-result",toolCallId:w.toolCallId,toolName:b,output:h6({output:w.state==="output-error"?w.errorText:w.output,tool:(_=n==null?void 0:n.tools)==null?void 0:_[b],errorMode:w.state==="output-error"?"json":"none"})})}}else throw new Error(`Unsupported part: ${w}`);r.push({role:"assistant",content:l});let $=g.filter((w)=>qn(w)&&w.providerExecuted!==!0||w.type==="dynamic-tool");if($.length>0)r.push({role:"tool",content:$.map((w)=>{var b;switch(w.state){case"output-error":case"output-available":{let v=w.type==="dynamic-tool"?w.toolName:$t(w);return{type:"tool-result",toolCallId:w.toolCallId,toolName:v,output:h6({output:w.state==="output-error"?w.errorText:w.output,tool:(b=n==null?void 0:n.tools)==null?void 0:b[v],errorMode:w.state==="output-error"?"text":"none"})}}default:return null}}).filter((w)=>w!=null)});g=[]};var u=c;let g=[];for(let h of t.parts)if(h.type==="text"||h.type==="reasoning"||h.type==="file"||h.type==="dynamic-tool"||qn(h))g.push(h);else if(h.type==="step-start")c();c();break}break}default:{let c=t.role;throw new eG({originalMessage:t,message:`Unsupported role: ${c}`})}}return r}var kA=Gn({prefix:"aiobj",size:24});var RA=Gn({prefix:"aiobj",size:24});var Nq={};tG(Nq,{object:()=>Wq,text:()=>zq});var zq=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:i}){return{partial:i}},async parseOutput({text:i}){return i}}),Wq=({schema:i})=>{let n=o6(i);return{type:"object",responseFormat:{type:"json",schema:n.jsonSchema},async parsePartial({text:r}){let u=await W6(r);switch(u.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:u.value};default:{let t=u.state;throw new Error(`Unsupported parse state: ${t}`)}}},async parseOutput({text:r},u){let t=await uu({text:r});if(!t.success)throw new g6({message:"No object generated: could not parse the response.",cause:t.error,text:r,response:u.response,usage:u.usage,finishReason:u.finishReason});let c=await $o({value:t.value,schema:n});if(!c.success)throw new g6({message:"No object generated: response did not match schema.",cause:c.error,text:r,response:u.response,usage:u.usage,finishReason:u.finishReason});return c.value}}};var Dq="AI_NoSuchProviderError",Jq=`vercel.ai.error.${Dq}`,Eq=Symbol.for(Jq),Hq;Hq=Eq;var Gq=o.looseObject({name:o.string(),version:o.string()}),f0=o.looseObject({_meta:o.optional(o.object({}).loose())}),ou=f0,qq=o.object({method:o.string(),params:o.optional(f0)}),Xq=o.looseObject({experimental:o.optional(o.object({}).loose()),logging:o.optional(o.object({}).loose()),prompts:o.optional(o.looseObject({listChanged:o.optional(o.boolean())})),resources:o.optional(o.looseObject({subscribe:o.optional(o.boolean()),listChanged:o.optional(o.boolean())})),tools:o.optional(o.looseObject({listChanged:o.optional(o.boolean())}))}),dA=ou.extend({protocolVersion:o.string(),capabilities:Xq,serverInfo:Gq,instructions:o.optional(o.string())}),Lq=ou.extend({nextCursor:o.optional(o.string())}),Iq=o.object({name:o.string(),description:o.optional(o.string()),inputSchema:o.object({type:o.literal("object"),properties:o.optional(o.object({}).loose())}).loose()}).loose(),aA=Lq.extend({tools:o.array(Iq)}),Yq=o.object({type:o.literal("text"),text:o.string()}).loose(),Qq=o.object({type:o.literal("image"),data:o.base64(),mimeType:o.string()}).loose(),J6=o.object({uri:o.string(),mimeType:o.optional(o.string())}).loose(),mq=J6.extend({text:o.string()}),Sq=J6.extend({blob:o.base64()}),Aq=o.object({type:o.literal("resource"),resource:o.union([mq,Sq])}).loose(),sA=ou.extend({content:o.array(o.union([Yq,Qq,Aq])),isError:o.boolean().default(!1).optional()}).or(ou.extend({toolResult:o.unknown()})),wo="2.0",Bq=o.object({jsonrpc:o.literal(wo),id:o.union([o.string(),o.number().int()])}).merge(qq).strict(),Kq=o.object({jsonrpc:o.literal(wo),id:o.union([o.string(),o.number().int()]),result:ou}).strict(),Vq=o.object({jsonrpc:o.literal(wo),id:o.union([o.string(),o.number().int()]),error:o.object({code:o.number().int(),message:o.string(),data:o.optional(o.unknown())})}).strict(),Mq=o.object({jsonrpc:o.literal(wo)}).merge(o.object({method:o.string(),params:o.optional(f0)})).strict(),i8=o.union([Bq,Mq,Kq,Vq]);var xq=o.object({type:o.literal("text"),text:o.string(),state:o.enum(["streaming","done"]).optional(),providerMetadata:e.optional()}),Fq=o.object({type:o.literal("reasoning"),text:o.string(),state:o.enum(["streaming","done"]).optional(),providerMetadata:e.optional()}),Pq=o.object({type:o.literal("source-url"),sourceId:o.string(),url:o.string(),title:o.string().optional(),providerMetadata:e.optional()}),yq=o.object({type:o.literal("source-document"),sourceId:o.string(),mediaType:o.string(),title:o.string(),filename:o.string().optional(),providerMetadata:e.optional()}),Tq=o.object({type:o.literal("file"),mediaType:o.string(),filename:o.string().optional(),url:o.string(),providerMetadata:e.optional()}),kq=o.object({type:o.literal("step-start")}),Cq=o.object({type:o.string().startsWith("data-"),id:o.string().optional(),data:o.unknown()}),Rq=[o.object({type:o.literal("dynamic-tool"),toolName:o.string(),toolCallId:o.string(),state:o.literal("input-streaming"),input:o.unknown().optional(),output:o.never().optional(),errorText:o.never().optional()}),o.object({type:o.literal("dynamic-tool"),toolName:o.string(),toolCallId:o.string(),state:o.literal("input-available"),input:o.unknown(),output:o.never().optional(),errorText:o.never().optional(),callProviderMetadata:e.optional()}),o.object({type:o.literal("dynamic-tool"),toolName:o.string(),toolCallId:o.string(),state:o.literal("output-available"),input:o.unknown(),output:o.unknown(),errorText:o.never().optional(),callProviderMetadata:e.optional(),preliminary:o.boolean().optional()}),o.object({type:o.literal("dynamic-tool"),toolName:o.string(),toolCallId:o.string(),state:o.literal("output-error"),input:o.unknown(),output:o.never().optional(),errorText:o.string(),callProviderMetadata:e.optional()})],Zq=[o.object({type:o.string().startsWith("tool-"),toolCallId:o.string(),state:o.literal("input-streaming"),input:o.unknown().optional(),output:o.never().optional(),errorText:o.never().optional()}),o.object({type:o.string().startsWith("tool-"),toolCallId:o.string(),state:o.literal("input-available"),input:o.unknown(),output:o.never().optional(),errorText:o.never().optional(),callProviderMetadata:e.optional()}),o.object({type:o.string().startsWith("tool-"),toolCallId:o.string(),state:o.literal("output-available"),input:o.unknown(),output:o.unknown(),errorText:o.never().optional(),callProviderMetadata:e.optional(),preliminary:o.boolean().optional()}),o.object({type:o.string().startsWith("tool-"),toolCallId:o.string(),state:o.literal("output-error"),input:o.unknown(),output:o.never().optional(),errorText:o.string(),callProviderMetadata:e.optional()})],t8=o.object({id:o.string(),role:o.enum(["system","user","assistant"]),metadata:o.unknown().optional(),parts:o.array(o.union([xq,Fq,Pq,yq,Tq,kq,Cq,...Rq,...Zq]))});function E6({execute:i,onError:n=w0,originalMessages:r,onFinish:u,generateId:t=n6}){let c,g=[],h=new ReadableStream({start($){c=$}});function _($){try{c.enqueue($)}catch(w){}}try{let $=i({writer:{write(w){_(w)},merge(w){g.push((async()=>{let b=w.getReader();while(!0){let{done:v,value:f}=await b.read();if(v)break;_(f)}})().catch((b)=>{_({type:"error",errorText:n(b)})}))},onError:n}});if($)g.push($.catch((w)=>{_({type:"error",errorText:n(w)})}))}catch($){_({type:"error",errorText:n($)})}return new Promise(async($)=>{while(g.length>0)await g.shift();$()}).finally(()=>{try{c.close()}catch($){}}),Uq({stream:h,messageId:t(),originalMessages:r,onFinish:u,onError:n})}function eq(i){return typeof i=="object"&&!!i&&typeof i[Symbol.asyncIterator]=="function"}var pq=class extends Error{constructor(i,n){super(i),this.response=n}};var _8=Object.freeze({withContext(i,n){let r={};for(let u of Object.keys(i))r[u]=i[u].withContext(n);return r},with(i,n){let r={};for(let u of Object.keys(i))r[u]=i[u].withContext(n);return r},async withApproval(i){let n={};for(let[t,c]of Object.entries(i.tools)){let g=c.execute;n[t]={...c,execute:async(h,_)=>c.autoApprove&&g&&await c.autoApprove(h)?g(h,_):{type:"tool-approval",outcome:"pending"}}}let r=i.messages[i.messages.length-1];if(!r?.parts)return n;let u=[];for(let t of r.parts){if(!qn(t))continue;let c=$t(t),g=i.tools[c];g&&t.state==="output-available"&&g.execute&&dq(t.output)&&t.output.outcome==="approved"&&u.push({toolName:$t(t),tool:g,input:t.input,toolCallId:t.toolCallId})}if(u.length>0){let t=E6({execute:async({writer:c})=>{c.write({type:"start-step"}),await Promise.all(u.map(async(g)=>{if(!g.tool.execute)throw Error("Tool does not support execute.");c.write({type:"tool-input-available",toolCallId:g.toolCallId,toolName:g.toolName,input:g.input});try{let h=await g.tool.execute(g.input,{toolCallId:g.toolCallId,messages:D6(i.messages,{tools:i.tools}),abortSignal:i.abortSignal});if(eq(h))for await(let _ of h)c.write({type:"tool-output-available",toolCallId:g.toolCallId,output:_,preliminary:!0});c.write({type:"tool-output-available",toolCallId:g.toolCallId,output:h})}catch(h){c.write({type:"tool-output-error",toolCallId:g.toolCallId,errorText:h instanceof Error?h.message:String(h)})}})),c.write({type:"finish"})}});throw new pq("Executing tools",t)}return n},prefix(i,n){let r={};for(let[u,t]of Object.entries(i))r[`${n}${u}`]=t;return r}});function dq(i){return typeof i=="object"&&!!i&&"type"in i&&i.type==="tool-approval"}var H6=class extends Error{constructor(i,n){super(i),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}};function O0(i){}function aq(i){if(typeof i=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:n=O0,onError:r=O0,onRetry:u=O0,onComment:t}=i,c="",g=!0,h,_="",l="";function $(U){let z=g?U.replace(/^\\xEF\\xBB\\xBF/,""):U,[J,N]=sq(`${c}${z}`);for(let j of J)w(j);c=N,g=!1}function w(U){if(U===""){v();return}if(U.startsWith(":")){t&&t(U.slice(U.startsWith(": ")?2:1));return}let z=U.indexOf(":");if(z!==-1){let J=U.slice(0,z),N=U[z+1]===" "?2:1,j=U.slice(z+N);b(J,j,U);return}b(U,"",U)}function b(U,z,J){switch(U){case"event":l=z;break;case"data":_=`${_}${z}\n`;break;case"id":h=z.includes("\\x00")?void 0:z;break;case"retry":/^\\d+$/.test(z)?u(parseInt(z,10)):r(new H6(`Invalid \\`retry\\` value: "${z}"`,{type:"invalid-retry",value:z,line:J}));break;default:r(new H6(`Unknown field "${U.length>20?`${U.slice(0,20)}…`:U}"`,{type:"unknown-field",field:U,value:z,line:J}));break}}function v(){_.length>0&&n({id:h,event:l||void 0,data:_.endsWith(`\n`)?_.slice(0,-1):_}),h=void 0,_="",l=""}function f(U={}){c&&U.consume&&w(c),g=!0,h=void 0,_="",l="",c=""}return{feed:$,reset:f}}function sq(i){let n=[],r="",u=0;for(;u{t.enqueue(c)},onError(c){i==="terminate"?t.error(c):typeof i=="function"&&i(c)},onRetry:n,onComment:r})},transform(t){u.feed(t)}})}};var k6="vercel.ai.error",nX=Symbol.for(k6),C6,tX=class i extends Error{constructor({name:n,message:r,cause:u}){super(r),this[C6]=!0,this.name=n,this.cause=u}static isInstance(n){return i.hasMarker(n,k6)}static hasMarker(n,r){let u=Symbol.for(r);return typeof n=="object"&&!!n&&u in n&&typeof n[u]=="boolean"&&n[u]===!0}};C6=nX;var gi=tX,R6="AI_APICallError",Z6=`vercel.ai.error.${R6}`,rX=Symbol.for(Z6),e6,Pi=class extends gi{constructor({message:i,url:n,requestBodyValues:r,statusCode:u,responseHeaders:t,responseBody:c,cause:g,isRetryable:h=u!=null&&(u===408||u===409||u===429||u>=500),data:_}){super({name:R6,message:i,cause:g}),this[e6]=!0,this.url=n,this.requestBodyValues=r,this.statusCode=u,this.responseHeaders=t,this.responseBody=c,this.isRetryable=h,this.data=_}static isInstance(i){return gi.hasMarker(i,Z6)}};e6=rX;var p6="AI_EmptyResponseBodyError",d6=`vercel.ai.error.${p6}`,uX=Symbol.for(d6),a6,cX=class extends gi{constructor({message:i="Empty response body"}={}){super({name:p6,message:i}),this[a6]=!0}static isInstance(i){return gi.hasMarker(i,d6)}};a6=uX;function s6(i){return i==null?"unknown error":typeof i=="string"?i:i instanceof Error?i.message:JSON.stringify(i)}var iO="AI_InvalidArgumentError",nO=`vercel.ai.error.${iO}`,oX=Symbol.for(nO),tO,rO=class extends gi{constructor({message:i,cause:n,argument:r}){super({name:iO,message:i,cause:n}),this[tO]=!0,this.argument=r}static isInstance(i){return gi.hasMarker(i,nO)}};tO=oX;var uO="AI_InvalidPromptError",cO=`vercel.ai.error.${uO}`,gX=Symbol.for(cO),oO,hX=class extends gi{constructor({prompt:i,message:n,cause:r}){super({name:uO,message:`Invalid prompt: ${n}`,cause:r}),this[oO]=!0,this.prompt=i}static isInstance(i){return gi.hasMarker(i,cO)}};oO=gX;var gO="AI_InvalidResponseDataError",hO=`vercel.ai.error.${gO}`,_X=Symbol.for(hO),_O,j0=class extends gi{constructor({data:i,message:n=`Invalid response data: ${JSON.stringify(i)}.`}){super({name:gO,message:n}),this[_O]=!0,this.data=i}static isInstance(i){return gi.hasMarker(i,hO)}};_O=_X;var lO="AI_JSONParseError",$O=`vercel.ai.error.${lO}`,lX=Symbol.for($O),wO,vo=class extends gi{constructor({text:i,cause:n}){super({name:lO,message:`JSON parsing failed: Text: ${i}.\nError message: ${s6(n)}`,cause:n}),this[wO]=!0,this.text=i}static isInstance(i){return gi.hasMarker(i,$O)}};wO=lX;var bO="AI_LoadAPIKeyError",vO=`vercel.ai.error.${bO}`,$X=Symbol.for(vO),fO,bo=class extends gi{constructor({message:i}){super({name:bO,message:i}),this[fO]=!0}static isInstance(i){return gi.hasMarker(i,vO)}};fO=$X;var OO="AI_NoSuchModelError",jO=`vercel.ai.error.${OO}`,wX=Symbol.for(jO),UO,U0=class extends gi{constructor({errorName:i=OO,modelId:n,modelType:r,message:u=`No such ${r}: ${n}`}){super({name:i,message:u}),this[UO]=!0,this.modelId=n,this.modelType=r}static isInstance(i){return gi.hasMarker(i,jO)}};UO=wX;var NO="AI_TooManyEmbeddingValuesForCallError",zO=`vercel.ai.error.${NO}`,bX=Symbol.for(zO),WO,DO=class extends gi{constructor(i){super({name:NO,message:`Too many values for a single embedding call. The ${i.provider} model "${i.modelId}" can only embed up to ${i.maxEmbeddingsPerCall} values per call, but ${i.values.length} values were provided.`}),this[WO]=!0,this.provider=i.provider,this.modelId=i.modelId,this.maxEmbeddingsPerCall=i.maxEmbeddingsPerCall,this.values=i.values}static isInstance(i){return gi.hasMarker(i,zO)}};WO=bX;var JO="AI_TypeValidationError",EO=`vercel.ai.error.${JO}`,vX=Symbol.for(EO),HO,fX=class i extends gi{constructor({value:n,cause:r}){super({name:JO,message:`Type validation failed: Value: ${JSON.stringify(n)}.\nError message: ${s6(r)}`,cause:r}),this[HO]=!0,this.value=n}static isInstance(n){return gi.hasMarker(n,EO)}static wrap({value:n,cause:r}){return i.isInstance(r)&&r.value===n?r:new i({value:n,cause:r})}};HO=vX;var hu=fX,GO="AI_UnsupportedFunctionalityError",qO=`vercel.ai.error.${GO}`,OX=Symbol.for(qO),XO,oi=class extends gi{constructor({functionality:i,message:n=`\'${i}\' functionality not supported.`}){super({name:GO,message:n}),this[XO]=!0,this.functionality=i}static isInstance(i){return gi.hasMarker(i,qO)}};XO=OX;function Ui(...i){return i.reduce((n,r)=>({...n,...r??{}}),{})}function $u(i){return Object.fromEntries([...i.headers])}function jX(i=globalThis){return i.window?"runtime/browser":i.navigator?.userAgent?`runtime/${i.navigator.userAgent.toLowerCase()}`:i.process?.versions?.node?`runtime/node.js/${i.process.version.substring(0)}`:i.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function UX(i){return Object.fromEntries(Object.entries(i).filter(([n,r])=>r!=null))}function wu(i,...n){let r=UX(i??{}),u=new Headers(r),t=u.get("user-agent")||"";return u.set("user-agent",[t,...n].filter(Boolean).join(" ")),Object.fromEntries(u)}var Qi=(({prefix:i,size:n=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:u="-"}={})=>{let t=()=>{let c=r.length,g=Array(n);for(let h=0;h`${i}${u}${t()}`})();function N0(i){return(i instanceof Error||i instanceof DOMException)&&(i.name==="AbortError"||i.name==="ResponseAborted"||i.name==="TimeoutError")}var NX=["fetch failed","failed to fetch"];function zX({error:i,url:n,requestBodyValues:r}){if(N0(i))return i;if(i instanceof TypeError&&NX.includes(i.message.toLowerCase())){let u=i.cause;if(u!=null)return new Pi({message:`Cannot connect to API: ${u.message}`,cause:u,url:n,requestBodyValues:r,isRetryable:!0})}return i}var WX="3.0.10";function Oo({apiKey:i,environmentVariableName:n,apiKeyParameterName:r="apiKey",description:u}){if(typeof i=="string")return i;if(i!=null)throw new bo({message:`${u} API key must be a string.`});if(typeof process>"u")throw new bo({message:`${u} API key is missing. Pass it using the \'${r}\' parameter. Environment variables is not supported in this environment.`});if(i=process.env[n],i==null)throw new bo({message:`${u} API key is missing. Pass it using the \'${r}\' parameter or the ${n} environment variable.`});if(typeof i!="string")throw new bo({message:`${u} API key must be a string. The value of the ${n} environment variable is not a string.`});return i}function DX({settingValue:i,environmentVariableName:n}){if(typeof i=="string"||!(i!=null||typeof process>"u")&&(i=process.env[n],!(i==null||typeof i!="string")))return i}function JX(i){let[n,r=""]=i.toLowerCase().split("/");return{mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[r]??r}var EX=/"__proto__"\\s*:/,HX=/"constructor"\\s*:/;function GX(i){let n=JSON.parse(i);return typeof n!="object"||!n||EX.test(i)===!1&&HX.test(i)===!1?n:qX(n)}function qX(i){let n=[i];for(;n.length;){let r=n;n=[];for(let u of r){if(Object.prototype.hasOwnProperty.call(u,"__proto__")||Object.prototype.hasOwnProperty.call(u,"constructor")&&Object.prototype.hasOwnProperty.call(u.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let t in u){let c=u[t];c&&typeof c=="object"&&n.push(c)}}}return i}function W0(i){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return GX(i)}finally{Error.stackTraceLimit=n}}var z0=Symbol.for("vercel.ai.validator");function XX(i){return{[z0]:!0,validate:i}}function LX(i){return typeof i=="object"&&!!i&&z0 in i&&i[z0]===!0&&"validate"in i}function IX(i){return LX(i)?i:YX(i)}function YX(i){return XX(async(n)=>{let r=await i["~standard"].validate(n);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new hu({value:n,cause:r.issues})}})}async function QX({value:i,schema:n}){let r=await D0({value:i,schema:n});if(!r.success)throw hu.wrap({value:i,cause:r.error});return r.value}async function D0({value:i,schema:n}){let r=IX(n);try{if(r.validate==null)return{success:!0,value:i,rawValue:i};let u=await r.validate(i);return u.success?{success:!0,value:u.value,rawValue:i}:{success:!1,error:hu.wrap({value:i,cause:u.error}),rawValue:i}}catch(u){return{success:!1,error:hu.wrap({value:i,cause:u}),rawValue:i}}}async function mX({text:i,schema:n}){try{let r=W0(i);return n==null?r:QX({value:r,schema:n})}catch(r){throw vo.isInstance(r)||hu.isInstance(r)?r:new vo({text:i,cause:r})}}async function LO({text:i,schema:n}){try{let r=W0(i);return n==null?{success:!0,value:r,rawValue:r}:await D0({value:r,schema:n})}catch(r){return{success:!1,error:vo.isInstance(r)?r:new vo({text:i,cause:r}),rawValue:void 0}}}function G6(i){try{return W0(i),!0}catch{return!1}}function SX({stream:i,schema:n}){return i.pipeThrough(new TextDecoderStream).pipeThrough(new iX).pipeThrough(new TransformStream({async transform({data:r},u){r!=="[DONE]"&&u.enqueue(await LO({text:r,schema:n}))}}))}async function Hi({provider:i,providerOptions:n,schema:r}){if(n?.[i]==null)return;let u=await D0({value:n[i],schema:r});if(!u.success)throw new rO({argument:"providerOptions",message:`invalid ${i} provider options`,cause:u.error});return u.value}var AX=()=>globalThis.fetch,fi=async({url:i,headers:n,body:r,failedResponseHandler:u,successfulResponseHandler:t,abortSignal:c,fetch:g})=>IO({url:i,headers:{"Content-Type":"application/json",...n},body:{content:JSON.stringify(r),values:r},failedResponseHandler:u,successfulResponseHandler:t,abortSignal:c,fetch:g}),BX=async({url:i,headers:n,formData:r,failedResponseHandler:u,successfulResponseHandler:t,abortSignal:c,fetch:g})=>IO({url:i,headers:n,body:{content:r,values:Object.fromEntries(r.entries())},failedResponseHandler:u,successfulResponseHandler:t,abortSignal:c,fetch:g}),IO=async({url:i,headers:n={},body:r,successfulResponseHandler:u,failedResponseHandler:t,abortSignal:c,fetch:g=AX()})=>{try{let h=await g(i,{method:"POST",headers:wu(n,`ai-sdk/provider-utils/${WX}`,jX()),body:r.content,signal:c}),_=$u(h);if(!h.ok){let l;try{l=await t({response:h,url:i,requestBodyValues:r.values})}catch($){throw N0($)||Pi.isInstance($)?$:new Pi({message:"Failed to process error response",cause:$,statusCode:h.status,url:i,responseHeaders:_,requestBodyValues:r.values})}throw l.value}try{return await u({response:h,url:i,requestBodyValues:r.values})}catch(l){throw l instanceof Error&&(N0(l)||Pi.isInstance(l))?l:new Pi({message:"Failed to process successful response",cause:l,statusCode:h.status,url:i,responseHeaders:_,requestBodyValues:r.values})}}catch(h){throw zX({error:h,url:i,requestBodyValues:r.values})}};function YO(i){return i}function yi({id:i,name:n,inputSchema:r}){return({execute:u,outputSchema:t,toModelOutput:c,onInputStart:g,onInputDelta:h,onInputAvailable:_,...l})=>YO({type:"provider-defined",id:i,name:n,args:l,inputSchema:r,outputSchema:t,execute:u,toModelOutput:c,onInputStart:g,onInputDelta:h,onInputAvailable:_})}function Pn({id:i,name:n,inputSchema:r,outputSchema:u}){return({execute:t,toModelOutput:c,onInputStart:g,onInputDelta:h,onInputAvailable:_,...l})=>YO({type:"provider-defined",id:i,name:n,args:l,inputSchema:r,outputSchema:u,execute:t,toModelOutput:c,onInputStart:g,onInputDelta:h,onInputAvailable:_})}async function _u(i){return typeof i=="function"&&(i=i()),Promise.resolve(i)}var bu=({errorSchema:i,errorToMessage:n,isRetryable:r})=>async({response:u,url:t,requestBodyValues:c})=>{let g=await u.text(),h=$u(u);if(g.trim()==="")return{responseHeaders:h,value:new Pi({message:u.statusText,url:t,requestBodyValues:c,statusCode:u.status,responseHeaders:h,responseBody:g,isRetryable:r?.(u)})};try{let _=await mX({text:g,schema:i});return{responseHeaders:h,value:new Pi({message:n(_),url:t,requestBodyValues:c,statusCode:u.status,responseHeaders:h,responseBody:g,data:_,isRetryable:r?.(u,_)})}}catch{return{responseHeaders:h,value:new Pi({message:u.statusText,url:t,requestBodyValues:c,statusCode:u.status,responseHeaders:h,responseBody:g,isRetryable:r?.(u)})}}},Vt=(i)=>async({response:n})=>{let r=$u(n);if(n.body==null)throw new cX({});return{responseHeaders:r,value:SX({stream:n.body,schema:i})}},Vi=(i)=>async({response:n,url:r,requestBodyValues:u})=>{let t=await n.text(),c=await LO({text:t,schema:i}),g=$u(n);if(!c.success)throw new Pi({message:"Invalid JSON response",cause:c.error,statusCode:n.status,responseHeaders:g,responseBody:t,url:r,requestBodyValues:u});return{responseHeaders:g,value:c.value,rawValue:c.rawValue}},KX=()=>async({response:i,url:n,requestBodyValues:r})=>{let u=$u(i);if(!i.body)throw new Pi({message:"Response body is empty",url:n,requestBodyValues:r,statusCode:i.status,responseHeaders:u,responseBody:void 0});try{let t=await i.arrayBuffer();return{responseHeaders:u,value:new Uint8Array(t)}}catch(t){throw new Pi({message:"Failed to read response as array buffer",url:n,requestBodyValues:r,statusCode:i.status,responseHeaders:u,responseBody:void 0,cause:t})}},{btoa:VX,atob:MX}=globalThis;function xX(i){let n=i.replace(/-/g,"+").replace(/_/g,"/"),r=MX(n);return Uint8Array.from(r,(u)=>u.codePointAt(0))}function FX(i){let n="";for(let r=0;ri.error.message}),X6=o.object({citations:o.object({enabled:o.boolean()}).optional(),title:o.string().optional(),context:o.string().optional()}),TX=o.object({sendReasoning:o.boolean().optional(),thinking:o.object({type:o.union([o.literal("enabled"),o.literal("disabled")]),budgetTokens:o.number().optional()}).optional(),disableParallelToolUse:o.boolean().optional(),cacheControl:o.object({type:o.literal("ephemeral"),ttl:o.union([o.literal("5m"),o.literal("1h")]).optional()}).optional()});function Fn(i){let n=i?.anthropic;return n?.cacheControl??n?.cache_control}var kX=o.object({maxCharacters:o.number().optional()}),CX=yi({id:"anthropic.text_editor_20250728",name:"str_replace_based_edit_tool",inputSchema:o.object({command:o.enum(["view","create","str_replace","insert"]),path:o.string(),file_text:o.string().optional(),insert_line:o.number().int().optional(),new_str:o.string().optional(),old_str:o.string().optional(),view_range:o.array(o.number().int()).optional()})}),RX=(i={})=>CX(i),ZX=o.object({maxUses:o.number().optional(),allowedDomains:o.array(o.string()).optional(),blockedDomains:o.array(o.string()).optional(),userLocation:o.object({type:o.literal("approximate"),city:o.string().optional(),region:o.string().optional(),country:o.string().optional(),timezone:o.string().optional()}).optional()}),QO=o.array(o.object({url:o.string(),title:o.string(),pageAge:o.string().nullable(),encryptedContent:o.string(),type:o.literal("web_search_result")})),eX=Pn({id:"anthropic.web_search_20250305",name:"web_search",inputSchema:o.object({query:o.string()}),outputSchema:QO}),pX=(i={})=>eX(i),dX=o.object({maxUses:o.number().optional(),allowedDomains:o.array(o.string()).optional(),blockedDomains:o.array(o.string()).optional(),citations:o.object({enabled:o.boolean()}).optional(),maxContentTokens:o.number().optional()}),mO=o.object({type:o.literal("web_fetch_result"),url:o.string(),content:o.object({type:o.literal("document"),title:o.string(),citations:o.object({enabled:o.boolean()}).optional(),source:o.union([o.object({type:o.literal("base64"),mediaType:o.literal("application/pdf"),data:o.string()}),o.object({type:o.literal("text"),mediaType:o.literal("text/plain"),data:o.string()})])}),retrievedAt:o.string().nullable()}),aX=Pn({id:"anthropic.web_fetch_20250910",name:"web_fetch",inputSchema:o.object({url:o.string()}),outputSchema:mO}),sX=(i={})=>aX(i);function iL({tools:i,toolChoice:n,disableParallelToolUse:r}){i=i?.length?i:void 0;let u=[],t=new Set;if(i==null)return{tools:void 0,toolChoice:void 0,toolWarnings:u,betas:t};let c=[];for(let h of i)switch(h.type){case"function":{let _=Fn(h.providerOptions);c.push({name:h.name,description:h.description,input_schema:h.inputSchema,cache_control:_});break}case"provider-defined":switch(h.id){case"anthropic.code_execution_20250522":t.add("code-execution-2025-05-22"),c.push({type:"code_execution_20250522",name:"code_execution"});break;case"anthropic.computer_20250124":t.add("computer-use-2025-01-24"),c.push({name:"computer",type:"computer_20250124",display_width_px:h.args.displayWidthPx,display_height_px:h.args.displayHeightPx,display_number:h.args.displayNumber});break;case"anthropic.computer_20241022":t.add("computer-use-2024-10-22"),c.push({name:"computer",type:"computer_20241022",display_width_px:h.args.displayWidthPx,display_height_px:h.args.displayHeightPx,display_number:h.args.displayNumber});break;case"anthropic.text_editor_20250124":t.add("computer-use-2025-01-24"),c.push({name:"str_replace_editor",type:"text_editor_20250124"});break;case"anthropic.text_editor_20241022":t.add("computer-use-2024-10-22"),c.push({name:"str_replace_editor",type:"text_editor_20241022"});break;case"anthropic.text_editor_20250429":t.add("computer-use-2025-01-24"),c.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429"});break;case"anthropic.text_editor_20250728":{let _=kX.parse(h.args);c.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:_.maxCharacters});break}case"anthropic.bash_20250124":t.add("computer-use-2025-01-24"),c.push({name:"bash",type:"bash_20250124"});break;case"anthropic.bash_20241022":t.add("computer-use-2024-10-22"),c.push({name:"bash",type:"bash_20241022"});break;case"anthropic.web_fetch_20250910":{t.add("web-fetch-2025-09-10");let _=dX.parse(h.args);c.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:_.maxUses,allowed_domains:_.allowedDomains,blocked_domains:_.blockedDomains,citations:_.citations,max_content_tokens:_.maxContentTokens});break}case"anthropic.web_search_20250305":{let _=ZX.parse(h.args);c.push({type:"web_search_20250305",name:"web_search",max_uses:_.maxUses,allowed_domains:_.allowedDomains,blocked_domains:_.blockedDomains,user_location:_.userLocation});break}default:u.push({type:"unsupported-tool",tool:h});break}break;default:u.push({type:"unsupported-tool",tool:h});break}if(n==null)return{tools:c,toolChoice:r?{type:"auto",disable_parallel_tool_use:r}:void 0,toolWarnings:u,betas:t};let g=n.type;switch(g){case"auto":return{tools:c,toolChoice:{type:"auto",disable_parallel_tool_use:r},toolWarnings:u,betas:t};case"required":return{tools:c,toolChoice:{type:"any",disable_parallel_tool_use:r},toolWarnings:u,betas:t};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:u,betas:t};case"tool":return{tools:c,toolChoice:{type:"tool",name:n.toolName,disable_parallel_tool_use:r},toolWarnings:u,betas:t};default:throw new oi({functionality:`tool choice type: ${g}`})}}var SO=o.object({type:o.literal("code_execution_result"),stdout:o.string(),stderr:o.string(),return_code:o.number()}),nL=Pn({id:"anthropic.code_execution_20250522",name:"code_execution",inputSchema:o.object({code:o.string()}),outputSchema:SO}),tL=(i={})=>nL(i);function rL(i){if(typeof i=="string")return Buffer.from(i,"base64").toString("utf-8");if(i instanceof Uint8Array)return new TextDecoder().decode(i);throw i instanceof URL?new oi({functionality:"URL-based text documents are not supported for citations"}):new oi({functionality:`unsupported data type for text documents: ${typeof i}`})}async function uL({prompt:i,sendReasoning:n,warnings:r}){let u=new Set,t=cL(i),c,g=[];async function h(l){return(await Hi({provider:"anthropic",providerOptions:l,schema:X6}))?.citations?.enabled??!1}async function _(l){let $=await Hi({provider:"anthropic",providerOptions:l,schema:X6});return{title:$?.title,context:$?.context}}for(let l=0;l({type:"text",text:v,cache_control:Fn(f)}));break;case"user":{let v=[];for(let f of $.messages){let{role:U,content:z}=f;switch(U){case"user":for(let J=0;J{switch(X.type){case"text":return{type:"text",text:X.text,cache_control:void 0};case"media":if(X.mediaType.startsWith("image/"))return{type:"image",source:{type:"base64",media_type:X.mediaType,data:X.data},cache_control:void 0};throw new oi({functionality:`media type: ${X.mediaType}`})}});break;case"text":case"error-text":E=W.value;break;case"json":case"error-json":default:E=JSON.stringify(W.value);break}v.push({type:"tool_result",tool_use_id:N.toolCallId,content:E,is_error:W.type==="error-text"||W.type==="error-json"?!0:void 0,cache_control:O})}break;default:throw Error(`Unsupported role: ${U}`)}}g.push({role:"user",content:v});break}case"assistant":{let v=[];for(let f=0;f<$.messages.length;f++){let U=$.messages[f],z=f===$.messages.length-1,{content:J}=U;for(let N=0;N({url:H.url,title:H.title,page_age:H.pageAge,encrypted_content:H.encryptedContent,type:H.type})),cache_control:W});break}r.push({type:"other",message:`provider executed tool result for tool ${j.toolName} is not supported`});break}}}g.push({role:"assistant",content:v});break}default:throw Error(`content type: ${b}`)}}return{prompt:{system:c,messages:g},betas:u}}function cL(i){let n=[],r;for(let u of i){let{role:t}=u;switch(t){case"system":r?.type!=="system"&&(r={type:"system",messages:[]},n.push(r)),r.messages.push(u);break;case"assistant":r?.type!=="assistant"&&(r={type:"assistant",messages:[]},n.push(r)),r.messages.push(u);break;case"user":r?.type!=="user"&&(r={type:"user",messages:[]},n.push(r)),r.messages.push(u);break;case"tool":r?.type!=="user"&&(r={type:"user",messages:[]},n.push(r)),r.messages.push(u);break;default:throw Error(`Unsupported role: ${t}`)}}return n}function L6({finishReason:i,isJsonResponseFromTool:n}){switch(i){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return n?"stop":"tool-calls";case"max_tokens":return"length";default:return"unknown"}}var gu={webSearchResult:o.object({type:o.literal("web_search_result_location"),cited_text:o.string(),url:o.string(),title:o.string(),encrypted_index:o.string()}),pageLocation:o.object({type:o.literal("page_location"),cited_text:o.string(),document_index:o.number(),document_title:o.string().nullable(),start_page_number:o.number(),end_page_number:o.number()}),charLocation:o.object({type:o.literal("char_location"),cited_text:o.string(),document_index:o.number(),document_title:o.string().nullable(),start_char_index:o.number(),end_char_index:o.number()})},AO=o.discriminatedUnion("type",[gu.webSearchResult,gu.pageLocation,gu.charLocation]);o.discriminatedUnion("type",[gu.pageLocation,gu.charLocation]);function I6(i,n,r,u){if(i.type==="page_location"||i.type==="char_location"){let t=oL(i,n,r);t&&u(t)}}function oL(i,n,r){let u=n[i.document_index];if(!u)return null;let t=i.type==="page_location"?{citedText:i.cited_text,startPageNumber:i.start_page_number,endPageNumber:i.end_page_number}:{citedText:i.cited_text,startCharIndex:i.start_char_index,endCharIndex:i.end_char_index};return{type:"source",sourceType:"document",id:r(),mediaType:u.mediaType,title:i.document_title??u.title,filename:u.filename,providerMetadata:{anthropic:t}}}var gL=class{constructor(i,n){this.specificationVersion="v2",this.modelId=i,this.config=n,this.generateId=n.generateId??Qi}supportsUrl(i){return i.protocol==="https:"}get provider(){return this.config.provider}get supportedUrls(){var i;return(i=this.config).supportedUrls?.call(i)??{}}async getArgs({prompt:i,maxOutputTokens:n=4096,temperature:r,topP:u,topK:t,frequencyPenalty:c,presencePenalty:g,stopSequences:h,responseFormat:_,seed:l,tools:$,toolChoice:w,providerOptions:b}){let v=[];c!=null&&v.push({type:"unsupported-setting",setting:"frequencyPenalty"}),g!=null&&v.push({type:"unsupported-setting",setting:"presencePenalty"}),l!=null&&v.push({type:"unsupported-setting",setting:"seed"}),_?.type==="json"&&(_.schema==null?v.push({type:"unsupported-setting",setting:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."}):$!=null&&v.push({type:"unsupported-setting",setting:"tools",details:"JSON response format does not support tools. The provided tools are ignored."}));let f=_?.type==="json"&&_.schema!=null?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:_.schema}:void 0,U=await Hi({provider:"anthropic",providerOptions:b,schema:TX}),{prompt:z,betas:J}=await uL({prompt:i,sendReasoning:U?.sendReasoning??!0,warnings:v}),N=U?.thinking?.type==="enabled",j=U?.thinking?.budgetTokens,O={model:this.modelId,max_tokens:n,temperature:r,top_k:t,top_p:u,stop_sequences:h,...N&&{thinking:{type:"enabled",budget_tokens:j}},system:z.system,messages:z.messages};if(N){if(j==null)throw new oi({functionality:"thinking requires a budget"});O.temperature!=null&&(O.temperature=void 0,v.push({type:"unsupported-setting",setting:"temperature",details:"temperature is not supported when thinking is enabled"})),t!=null&&(O.top_k=void 0,v.push({type:"unsupported-setting",setting:"topK",details:"topK is not supported when thinking is enabled"})),u!=null&&(O.top_p=void 0,v.push({type:"unsupported-setting",setting:"topP",details:"topP is not supported when thinking is enabled"})),O.max_tokens=n+j}let{tools:W,toolChoice:E,toolWarnings:X,betas:H}=iL(f==null?{tools:$??[],toolChoice:w,disableParallelToolUse:U?.disableParallelToolUse}:{tools:[f],toolChoice:{type:"tool",toolName:f.name},disableParallelToolUse:!0});return{args:{...O,tools:W,tool_choice:E},warnings:[...v,...X],betas:new Set([...J,...H]),usesJsonResponseTool:f!=null}}async getHeaders({betas:i,headers:n}){return Ui(await _u(this.config.headers),i.size>0?{"anthropic-beta":Array.from(i).join(",")}:{},n)}buildRequestUrl(i){var n;return(n=this.config).buildRequestUrl?.call(n,this.config.baseURL,i)??`${this.config.baseURL}/messages`}transformRequestBody(i){var n;return(n=this.config).transformRequestBody?.call(n,i)??i}extractCitationDocuments(i){return i.filter((n)=>n.role==="user").flatMap((n)=>n.content).filter((n)=>n.type!=="file"||n.mediaType!=="application/pdf"&&n.mediaType!=="text/plain"?!1:n.providerOptions?.anthropic?.citations?.enabled??!1).map((n)=>{let r=n;return{title:r.filename??"Untitled Document",filename:r.filename,mediaType:r.mediaType}})}async doGenerate(i){let{args:n,warnings:r,betas:u,usesJsonResponseTool:t}=await this.getArgs(i),c=this.extractCitationDocuments(i.prompt),{responseHeaders:g,value:h,rawValue:_}=await fi({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:u,headers:i.headers}),body:this.transformRequestBody(n),failedResponseHandler:q6,successfulResponseHandler:Vi(hL),abortSignal:i.abortSignal,fetch:this.config.fetch}),l=[];for(let $ of h.content)switch($.type){case"text":if(!t&&(l.push({type:"text",text:$.text}),$.citations))for(let w of $.citations)I6(w,c,this.generateId,(b)=>l.push(b));break;case"thinking":l.push({type:"reasoning",text:$.thinking,providerMetadata:{anthropic:{signature:$.signature}}});break;case"redacted_thinking":l.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:$.data}}});break;case"tool_use":l.push(t?{type:"text",text:JSON.stringify($.input)}:{type:"tool-call",toolCallId:$.id,toolName:$.name,input:JSON.stringify($.input)});break;case"server_tool_use":($.name==="web_search"||$.name==="code_execution"||$.name==="web_fetch")&&l.push({type:"tool-call",toolCallId:$.id,toolName:$.name,input:JSON.stringify($.input),providerExecuted:!0});break;case"web_fetch_tool_result":$.content.type==="web_fetch_result"?l.push({type:"tool-result",toolCallId:$.tool_use_id,toolName:"web_fetch",result:{type:"web_fetch_result",url:$.content.url,retrievedAt:$.content.retrieved_at,content:{type:$.content.content.type,title:$.content.content.title,citations:$.content.content.citations,source:{type:$.content.content.source.type,mediaType:$.content.content.source.media_type,data:$.content.content.source.data}}},providerExecuted:!0}):$.content.type==="web_fetch_tool_result_error"&&l.push({type:"tool-result",toolCallId:$.tool_use_id,toolName:"web_fetch",isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:$.content.error_code},providerExecuted:!0});break;case"web_search_tool_result":if(Array.isArray($.content)){l.push({type:"tool-result",toolCallId:$.tool_use_id,toolName:"web_search",result:$.content.map((w)=>({url:w.url,title:w.title,pageAge:w.page_age??null,encryptedContent:w.encrypted_content,type:w.type})),providerExecuted:!0});for(let w of $.content)l.push({type:"source",sourceType:"url",id:this.generateId(),url:w.url,title:w.title,providerMetadata:{anthropic:{pageAge:w.page_age??null}}})}else l.push({type:"tool-result",toolCallId:$.tool_use_id,toolName:"web_search",isError:!0,result:{type:"web_search_tool_result_error",errorCode:$.content.error_code},providerExecuted:!0});break;case"code_execution_tool_result":$.content.type==="code_execution_result"?l.push({type:"tool-result",toolCallId:$.tool_use_id,toolName:"code_execution",result:{type:$.content.type,stdout:$.content.stdout,stderr:$.content.stderr,return_code:$.content.return_code},providerExecuted:!0}):$.content.type==="code_execution_tool_result_error"&&l.push({type:"tool-result",toolCallId:$.tool_use_id,toolName:"code_execution",isError:!0,result:{type:"code_execution_tool_result_error",errorCode:$.content.error_code},providerExecuted:!0});break}return{content:l,finishReason:L6({finishReason:h.stop_reason,isJsonResponseFromTool:t}),usage:{inputTokens:h.usage.input_tokens,outputTokens:h.usage.output_tokens,totalTokens:h.usage.input_tokens+h.usage.output_tokens,cachedInputTokens:h.usage.cache_read_input_tokens??void 0},request:{body:n},response:{id:h.id??void 0,modelId:h.model??void 0,headers:g,body:_},warnings:r,providerMetadata:{anthropic:{usage:h.usage,cacheCreationInputTokens:h.usage.cache_creation_input_tokens??null,stopSequence:h.stop_sequence??null}}}}async doStream(i){let{args:n,warnings:r,betas:u,usesJsonResponseTool:t}=await this.getArgs(i),c=this.extractCitationDocuments(i.prompt),g={...n,stream:!0},{responseHeaders:h,value:_}=await fi({url:this.buildRequestUrl(!0),headers:await this.getHeaders({betas:u,headers:i.headers}),body:this.transformRequestBody(g),failedResponseHandler:q6,successfulResponseHandler:Vt(_L),abortSignal:i.abortSignal,fetch:this.config.fetch}),l="unknown",$={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},w={},b,v=null,f=null,U,z=this.generateId;return{stream:_.pipeThrough(new TransformStream({start(J){J.enqueue({type:"stream-start",warnings:r})},transform(J,N){if(i.includeRawChunks&&N.enqueue({type:"raw",rawValue:J.rawValue}),!J.success){N.enqueue({type:"error",error:J.error});return}let j=J.value;switch(j.type){case"ping":return;case"content_block_start":{let O=j.content_block.type;switch(U=O,O){case"text":w[j.index]={type:"text"},N.enqueue({type:"text-start",id:String(j.index)});return;case"thinking":w[j.index]={type:"reasoning"},N.enqueue({type:"reasoning-start",id:String(j.index)});return;case"redacted_thinking":w[j.index]={type:"reasoning"},N.enqueue({type:"reasoning-start",id:String(j.index),providerMetadata:{anthropic:{redactedData:j.content_block.data}}});return;case"tool_use":w[j.index]=t?{type:"text"}:{type:"tool-call",toolCallId:j.content_block.id,toolName:j.content_block.name,input:""},N.enqueue(t?{type:"text-start",id:String(j.index)}:{type:"tool-input-start",id:j.content_block.id,toolName:j.content_block.name});return;case"server_tool_use":(j.content_block.name==="web_fetch"||j.content_block.name==="web_search"||j.content_block.name==="code_execution")&&(w[j.index]={type:"tool-call",toolCallId:j.content_block.id,toolName:j.content_block.name,input:"",providerExecuted:!0},N.enqueue({type:"tool-input-start",id:j.content_block.id,toolName:j.content_block.name,providerExecuted:!0}));return;case"web_fetch_tool_result":{let W=j.content_block;W.content.type==="web_fetch_result"?N.enqueue({type:"tool-result",toolCallId:W.tool_use_id,toolName:"web_fetch",result:{type:"web_fetch_result",url:W.content.url,retrievedAt:W.content.retrieved_at,content:{type:W.content.content.type,title:W.content.content.title,citations:W.content.content.citations,source:{type:W.content.content.source.type,mediaType:W.content.content.source.media_type,data:W.content.content.source.data}}}}):W.content.type==="web_fetch_tool_result_error"&&N.enqueue({type:"tool-result",toolCallId:W.tool_use_id,toolName:"web_fetch",isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:W.content.error_code},providerExecuted:!0});return}case"web_search_tool_result":{let W=j.content_block;if(Array.isArray(W.content)){N.enqueue({type:"tool-result",toolCallId:W.tool_use_id,toolName:"web_search",result:W.content.map((E)=>({url:E.url,title:E.title,pageAge:E.page_age??null,encryptedContent:E.encrypted_content,type:E.type})),providerExecuted:!0});for(let E of W.content)N.enqueue({type:"source",sourceType:"url",id:z(),url:E.url,title:E.title,providerMetadata:{anthropic:{pageAge:E.page_age??null}}})}else N.enqueue({type:"tool-result",toolCallId:W.tool_use_id,toolName:"web_search",isError:!0,result:{type:"web_search_tool_result_error",errorCode:W.content.error_code},providerExecuted:!0});return}case"code_execution_tool_result":{let W=j.content_block;W.content.type==="code_execution_result"?N.enqueue({type:"tool-result",toolCallId:W.tool_use_id,toolName:"code_execution",result:{type:W.content.type,stdout:W.content.stdout,stderr:W.content.stderr,return_code:W.content.return_code},providerExecuted:!0}):W.content.type==="code_execution_tool_result_error"&&N.enqueue({type:"tool-result",toolCallId:W.tool_use_id,toolName:"code_execution",isError:!0,result:{type:"code_execution_tool_result_error",errorCode:W.content.error_code},providerExecuted:!0});return}default:throw Error(`Unsupported content block type: ${O}`)}}case"content_block_stop":if(w[j.index]!=null){let O=w[j.index];switch(O.type){case"text":N.enqueue({type:"text-end",id:String(j.index)});break;case"reasoning":N.enqueue({type:"reasoning-end",id:String(j.index)});break;case"tool-call":t||(N.enqueue({type:"tool-input-end",id:O.toolCallId}),N.enqueue(O));break}delete w[j.index]}U=void 0;return;case"content_block_delta":{let O=j.delta.type;switch(O){case"text_delta":if(t)return;N.enqueue({type:"text-delta",id:String(j.index),delta:j.delta.text});return;case"thinking_delta":N.enqueue({type:"reasoning-delta",id:String(j.index),delta:j.delta.thinking});return;case"signature_delta":U==="thinking"&&N.enqueue({type:"reasoning-delta",id:String(j.index),delta:"",providerMetadata:{anthropic:{signature:j.delta.signature}}});return;case"input_json_delta":{let W=w[j.index],E=j.delta.partial_json;if(t){if(W?.type!=="text")return;N.enqueue({type:"text-delta",id:String(j.index),delta:E})}else{if(W?.type!=="tool-call")return;N.enqueue({type:"tool-input-delta",id:W.toolCallId,delta:E}),W.input+=E}return}case"citations_delta":{let W=j.delta.citation;I6(W,c,z,(E)=>N.enqueue(E));return}default:throw Error(`Unsupported delta type: ${O}`)}}case"message_start":$.inputTokens=j.message.usage.input_tokens,$.cachedInputTokens=j.message.usage.cache_read_input_tokens??void 0,b={...j.message.usage},v=j.message.usage.cache_creation_input_tokens??null,N.enqueue({type:"response-metadata",id:j.message.id??void 0,modelId:j.message.model??void 0});return;case"message_delta":$.outputTokens=j.usage.output_tokens,$.totalTokens=($.inputTokens??0)+(j.usage.output_tokens??0),l=L6({finishReason:j.delta.stop_reason,isJsonResponseFromTool:t}),f=j.delta.stop_sequence??null,b={...b,...j.usage};return;case"message_stop":N.enqueue({type:"finish",finishReason:l,usage:$,providerMetadata:{anthropic:{usage:b??null,cacheCreationInputTokens:v,stopSequence:f}}});return;case"error":N.enqueue({type:"error",error:j.error});return;default:throw Error(`Unsupported chunk type: ${j}`)}}})),request:{body:g},response:{headers:h}}}},hL=o.object({type:o.literal("message"),id:o.string().nullish(),model:o.string().nullish(),content:o.array(o.discriminatedUnion("type",[o.object({type:o.literal("text"),text:o.string(),citations:o.array(AO).optional()}),o.object({type:o.literal("thinking"),thinking:o.string(),signature:o.string()}),o.object({type:o.literal("redacted_thinking"),data:o.string()}),o.object({type:o.literal("tool_use"),id:o.string(),name:o.string(),input:o.unknown()}),o.object({type:o.literal("server_tool_use"),id:o.string(),name:o.string(),input:o.record(o.string(),o.unknown()).nullish()}),o.object({type:o.literal("web_fetch_tool_result"),tool_use_id:o.string(),content:o.union([o.object({type:o.literal("web_fetch_result"),url:o.string(),retrieved_at:o.string(),content:o.object({type:o.literal("document"),title:o.string().nullable(),citations:o.object({enabled:o.boolean()}).optional(),source:o.object({type:o.literal("text"),media_type:o.string(),data:o.string()})})}),o.object({type:o.literal("web_fetch_tool_result_error"),error_code:o.string()})])}),o.object({type:o.literal("web_search_tool_result"),tool_use_id:o.string(),content:o.union([o.array(o.object({type:o.literal("web_search_result"),url:o.string(),title:o.string(),encrypted_content:o.string(),page_age:o.string().nullish()})),o.object({type:o.literal("web_search_tool_result_error"),error_code:o.string()})])}),o.object({type:o.literal("code_execution_tool_result"),tool_use_id:o.string(),content:o.union([o.object({type:o.literal("code_execution_result"),stdout:o.string(),stderr:o.string(),return_code:o.number()}),o.object({type:o.literal("code_execution_tool_result_error"),error_code:o.string()})])})])),stop_reason:o.string().nullish(),stop_sequence:o.string().nullish(),usage:o.looseObject({input_tokens:o.number(),output_tokens:o.number(),cache_creation_input_tokens:o.number().nullish(),cache_read_input_tokens:o.number().nullish()})}),_L=o.discriminatedUnion("type",[o.object({type:o.literal("message_start"),message:o.object({id:o.string().nullish(),model:o.string().nullish(),usage:o.looseObject({input_tokens:o.number(),cache_creation_input_tokens:o.number().nullish(),cache_read_input_tokens:o.number().nullish()})})}),o.object({type:o.literal("content_block_start"),index:o.number(),content_block:o.discriminatedUnion("type",[o.object({type:o.literal("text"),text:o.string()}),o.object({type:o.literal("thinking"),thinking:o.string()}),o.object({type:o.literal("tool_use"),id:o.string(),name:o.string()}),o.object({type:o.literal("redacted_thinking"),data:o.string()}),o.object({type:o.literal("server_tool_use"),id:o.string(),name:o.string(),input:o.record(o.string(),o.unknown()).nullish()}),o.object({type:o.literal("web_fetch_tool_result"),tool_use_id:o.string(),content:o.union([o.object({type:o.literal("web_fetch_result"),url:o.string(),retrieved_at:o.string(),content:o.object({type:o.literal("document"),title:o.string().nullable(),citations:o.object({enabled:o.boolean()}).optional(),source:o.object({type:o.literal("text"),media_type:o.string(),data:o.string()})})}),o.object({type:o.literal("web_fetch_tool_result_error"),error_code:o.string()})])}),o.object({type:o.literal("web_search_tool_result"),tool_use_id:o.string(),content:o.union([o.array(o.object({type:o.literal("web_search_result"),url:o.string(),title:o.string(),encrypted_content:o.string(),page_age:o.string().nullish()})),o.object({type:o.literal("web_search_tool_result_error"),error_code:o.string()})])}),o.object({type:o.literal("code_execution_tool_result"),tool_use_id:o.string(),content:o.union([o.object({type:o.literal("code_execution_result"),stdout:o.string(),stderr:o.string(),return_code:o.number()}),o.object({type:o.literal("code_execution_tool_result_error"),error_code:o.string()})])})])}),o.object({type:o.literal("content_block_delta"),index:o.number(),delta:o.discriminatedUnion("type",[o.object({type:o.literal("input_json_delta"),partial_json:o.string()}),o.object({type:o.literal("text_delta"),text:o.string()}),o.object({type:o.literal("thinking_delta"),thinking:o.string()}),o.object({type:o.literal("signature_delta"),signature:o.string()}),o.object({type:o.literal("citations_delta"),citation:AO})])}),o.object({type:o.literal("content_block_stop"),index:o.number()}),o.object({type:o.literal("error"),error:o.object({type:o.string(),message:o.string()})}),o.object({type:o.literal("message_delta"),delta:o.object({stop_reason:o.string().nullish(),stop_sequence:o.string().nullish()}),usage:o.looseObject({output_tokens:o.number(),cache_creation_input_tokens:o.number().nullish()})}),o.object({type:o.literal("message_stop")}),o.object({type:o.literal("ping")})]),lL=o.object({signature:o.string().optional(),redactedData:o.string().optional()}),$L=yi({id:"anthropic.bash_20241022",name:"bash",inputSchema:gt.object({command:gt.string(),restart:gt.boolean().optional()})}),wL=yi({id:"anthropic.bash_20250124",name:"bash",inputSchema:gt.object({command:gt.string(),restart:gt.boolean().optional()})}),bL=yi({id:"anthropic.computer_20241022",name:"computer",inputSchema:o.object({action:o.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:o.array(o.number().int()).optional(),text:o.string().optional()})}),vL=yi({id:"anthropic.computer_20250124",name:"computer",inputSchema:o.object({action:o.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:o.tuple([o.number().int(),o.number().int()]).optional(),duration:o.number().optional(),scroll_amount:o.number().optional(),scroll_direction:o.enum(["up","down","left","right"]).optional(),start_coordinate:o.tuple([o.number().int(),o.number().int()]).optional(),text:o.string().optional()})}),fL=yi({id:"anthropic.text_editor_20241022",name:"str_replace_editor",inputSchema:o.object({command:o.enum(["view","create","str_replace","insert","undo_edit"]),path:o.string(),file_text:o.string().optional(),insert_line:o.number().int().optional(),new_str:o.string().optional(),old_str:o.string().optional(),view_range:o.array(o.number().int()).optional()})}),OL=yi({id:"anthropic.text_editor_20250124",name:"str_replace_editor",inputSchema:o.object({command:o.enum(["view","create","str_replace","insert","undo_edit"]),path:o.string(),file_text:o.string().optional(),insert_line:o.number().int().optional(),new_str:o.string().optional(),old_str:o.string().optional(),view_range:o.array(o.number().int()).optional()})}),jL=yi({id:"anthropic.text_editor_20250429",name:"str_replace_based_edit_tool",inputSchema:o.object({command:o.enum(["view","create","str_replace","insert"]),path:o.string(),file_text:o.string().optional(),insert_line:o.number().int().optional(),new_str:o.string().optional(),old_str:o.string().optional(),view_range:o.array(o.number().int()).optional()})}),UL={bash_20241022:$L,bash_20250124:wL,codeExecution_20250522:tL,computer_20241022:bL,computer_20250124:vL,textEditor_20241022:fL,textEditor_20250124:OL,textEditor_20250429:jL,textEditor_20250728:RX,webFetch_20250910:sX,webSearch_20250305:pX};function NL(i={}){let n=jo(i.baseURL)??"https://api.anthropic.com/v1",r=()=>wu({"anthropic-version":"2023-06-01","x-api-key":Oo({apiKey:i.apiKey,environmentVariableName:"ANTHROPIC_API_KEY",description:"Anthropic"}),...i.headers},`ai-sdk/anthropic/${PX}`),u=(c)=>new gL(c,{provider:"anthropic.messages",baseURL:n,headers:r,fetch:i.fetch,generateId:i.generateId??Qi,supportedUrls:()=>({"image/*":[/^https?:\\/\\/.*$/]})}),t=function(c){if(new.target)throw Error("The Anthropic model function cannot be called with the new keyword.");return u(c)};return t.languageModel=u,t.chat=u,t.messages=u,t.textEmbeddingModel=(c)=>{throw new U0({modelId:c,modelType:"textEmbeddingModel"})},t.imageModel=(c)=>{throw new U0({modelId:c,modelType:"imageModel"})},t.tools=UL,t}NL();var zL="2.0.17",WL=o.object({error:o.object({code:o.number().nullable(),message:o.string(),status:o.string()})}),lu=bu({errorSchema:WL,errorToMessage:(i)=>i.error.message}),DL=o.object({outputDimensionality:o.number().optional(),taskType:o.enum(["SEMANTIC_SIMILARITY","CLASSIFICATION","CLUSTERING","RETRIEVAL_DOCUMENT","RETRIEVAL_QUERY","QUESTION_ANSWERING","FACT_VERIFICATION","CODE_RETRIEVAL_QUERY"]).optional()}),JL=class{constructor(i,n){this.specificationVersion="v2",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=i,this.config=n}get provider(){return this.config.provider}async doEmbed({values:i,headers:n,abortSignal:r,providerOptions:u}){let t=await Hi({provider:"google",providerOptions:u,schema:DL});if(i.length>this.maxEmbeddingsPerCall)throw new DO({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:i});let c=Ui(await _u(this.config.headers),n);if(i.length===1){let{responseHeaders:l,value:$,rawValue:w}=await fi({url:`${this.config.baseURL}/models/${this.modelId}:embedContent`,headers:c,body:{model:`models/${this.modelId}`,content:{parts:[{text:i[0]}]},outputDimensionality:t?.outputDimensionality,taskType:t?.taskType},failedResponseHandler:lu,successfulResponseHandler:Vi(HL),abortSignal:r,fetch:this.config.fetch});return{embeddings:[$.embedding.values],usage:void 0,response:{headers:l,body:w}}}let{responseHeaders:g,value:h,rawValue:_}=await fi({url:`${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,headers:c,body:{requests:i.map((l)=>({model:`models/${this.modelId}`,content:{role:"user",parts:[{text:l}]},outputDimensionality:t?.outputDimensionality,taskType:t?.taskType}))},failedResponseHandler:lu,successfulResponseHandler:Vi(EL),abortSignal:r,fetch:this.config.fetch});return{embeddings:h.embeddings.map((l)=>l.values),usage:void 0,response:{headers:g,body:_}}}},EL=o.object({embeddings:o.array(o.object({values:o.array(o.number())}))}),HL=o.object({embedding:o.object({values:o.array(o.number())})});function gn(i){if(i==null||GL(i))return;if(typeof i=="boolean")return{type:"boolean",properties:{}};let{type:n,description:r,required:u,properties:t,items:c,allOf:g,anyOf:h,oneOf:_,format:l,const:$,minLength:w,enum:b}=i,v={};if(r&&(v.description=r),u&&(v.required=u),l&&(v.format=l),$!==void 0&&(v.enum=[$]),n&&(Array.isArray(n)?n.includes("null")?(v.type=n.filter((f)=>f!=="null")[0],v.nullable=!0):v.type=n:n==="null"?v.type="null":v.type=n),b!==void 0&&(v.enum=b),t!=null&&(v.properties=Object.entries(t).reduce((f,[U,z])=>(f[U]=gn(z),f),{})),c&&(v.items=Array.isArray(c)?c.map(gn):gn(c)),g&&(v.allOf=g.map(gn)),h)if(h.some((f)=>typeof f=="object"&&f?.type==="null")){let f=h.filter((U)=>!(typeof U=="object"&&U?.type==="null"));if(f.length===1){let U=gn(f[0]);typeof U=="object"&&(v.nullable=!0,Object.assign(v,U))}else v.anyOf=f.map(gn),v.nullable=!0}else v.anyOf=h.map(gn);return _&&(v.oneOf=_.map(gn)),w!==void 0&&(v.minLength=w),v}function GL(i){return typeof i=="object"&&!!i&&i.type==="object"&&(i.properties==null||Object.keys(i.properties).length===0)&&!i.additionalProperties}function qL(i,n){let r=[],u=[],t=!0,c=n?.isGemmaModel??!1;for(let{role:g,content:h}of i)switch(g){case"system":if(!t)throw new oi({functionality:"system messages are only supported at the beginning of the conversation"});r.push({text:h});break;case"user":{t=!1;let _=[];for(let l of h)switch(l.type){case"text":_.push({text:l.text});break;case"file":{let $=l.mediaType==="image/*"?"image/jpeg":l.mediaType;_.push(l.data instanceof URL?{fileData:{mimeType:$,fileUri:l.data.toString()}}:{inlineData:{mimeType:$,data:pi(l.data)}});break}}u.push({role:"user",parts:_});break}case"assistant":t=!1,u.push({role:"model",parts:h.map((_)=>{switch(_.type){case"text":return _.text.length===0?void 0:{text:_.text,thoughtSignature:_.providerOptions?.google?.thoughtSignature};case"reasoning":return _.text.length===0?void 0:{text:_.text,thought:!0,thoughtSignature:_.providerOptions?.google?.thoughtSignature};case"file":if(_.mediaType!=="image/png")throw new oi({functionality:"Only PNG images are supported in assistant messages"});if(_.data instanceof URL)throw new oi({functionality:"File data URLs in assistant messages are not supported"});return{inlineData:{mimeType:_.mediaType,data:pi(_.data)}};case"tool-call":return{functionCall:{name:_.toolName,args:_.input},thoughtSignature:_.providerOptions?.google?.thoughtSignature}}}).filter((_)=>_!==void 0)});break;case"tool":{t=!1;let _=[];for(let l of h){let $=l.output;if($.type==="content")for(let w of $.value)switch(w.type){case"text":_.push({functionResponse:{name:l.toolName,response:{name:l.toolName,content:w.text}}});break;case"media":_.push({inlineData:{mimeType:w.mediaType,data:w.data}},{text:"Tool executed successfully and returned this image as a response"});break;default:_.push({text:JSON.stringify(w)});break}else _.push({functionResponse:{name:l.toolName,response:{name:l.toolName,content:$.value}}})}u.push({role:"user",parts:_});break}}if(c&&r.length>0&&u.length>0&&u[0].role==="user"){let g=r.map((h)=>h.text).join(`\n\n`);u[0].parts.unshift({text:g+`\n\n`})}return{systemInstruction:r.length>0&&!c?{parts:r}:void 0,contents:u}}function Y6(i){return i.includes("/")?i:`models/${i}`}var XL=o.object({responseModalities:o.array(o.enum(["TEXT","IMAGE"])).optional(),thinkingConfig:o.object({thinkingBudget:o.number().optional(),includeThoughts:o.boolean().optional()}).optional(),cachedContent:o.string().optional(),structuredOutputs:o.boolean().optional(),safetySettings:o.array(o.object({category:o.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:o.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])})).optional(),threshold:o.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]).optional(),audioTimestamp:o.boolean().optional(),labels:o.record(o.string(),o.string()).optional()});function LL({tools:i,toolChoice:n,modelId:r}){i=i?.length?i:void 0;let u=[],t=r.includes("gemini-2"),c=r.includes("gemini-1.5-flash")&&!r.includes("-8b");if(i==null)return{tools:void 0,toolConfig:void 0,toolWarnings:u};let g=i.some(($)=>$.type==="function"),h=i.some(($)=>$.type==="provider-defined");if(g&&h&&u.push({type:"unsupported-tool",tool:i.find(($)=>$.type==="function"),details:"Cannot mix function tools with provider-defined tools in the same request. Please use either function tools or provider-defined tools, but not both."}),h){let $={};return i.filter((w)=>w.type==="provider-defined").forEach((w)=>{switch(w.id){case"google.google_search":t?$.googleSearch={}:c?$.googleSearchRetrieval={dynamicRetrievalConfig:{mode:w.args.mode,dynamicThreshold:w.args.dynamicThreshold}}:$.googleSearchRetrieval={};break;case"google.url_context":t?$.urlContext={}:u.push({type:"unsupported-tool",tool:w,details:"The URL context tool is not supported with other Gemini models than Gemini 2."});break;case"google.code_execution":t?$.codeExecution={}:u.push({type:"unsupported-tool",tool:w,details:"The code execution tools is not supported with other Gemini models than Gemini 2."});break;default:u.push({type:"unsupported-tool",tool:w});break}}),{tools:Object.keys($).length>0?$:void 0,toolConfig:void 0,toolWarnings:u}}let _=[];for(let $ of i)switch($.type){case"function":_.push({name:$.name,description:$.description??"",parameters:gn($.inputSchema)});break;default:u.push({type:"unsupported-tool",tool:$});break}if(n==null)return{tools:{functionDeclarations:_},toolConfig:void 0,toolWarnings:u};let l=n.type;switch(l){case"auto":return{tools:{functionDeclarations:_},toolConfig:{functionCallingConfig:{mode:"AUTO"}},toolWarnings:u};case"none":return{tools:{functionDeclarations:_},toolConfig:{functionCallingConfig:{mode:"NONE"}},toolWarnings:u};case"required":return{tools:{functionDeclarations:_},toolConfig:{functionCallingConfig:{mode:"ANY"}},toolWarnings:u};case"tool":return{tools:{functionDeclarations:_},toolConfig:{functionCallingConfig:{mode:"ANY",allowedFunctionNames:[n.toolName]}},toolWarnings:u};default:throw new oi({functionality:`tool choice type: ${l}`})}}function Q6({finishReason:i,hasToolCalls:n}){switch(i){case"STOP":return n?"tool-calls":"stop";case"MAX_TOKENS":return"length";case"IMAGE_SAFETY":case"RECITATION":case"SAFETY":case"BLOCKLIST":case"PROHIBITED_CONTENT":case"SPII":return"content-filter";case"FINISH_REASON_UNSPECIFIED":case"OTHER":return"other";case"MALFORMED_FUNCTION_CALL":return"error";default:return"unknown"}}var IL=o.object({web:o.object({uri:o.string(),title:o.string()}).nullish(),retrievedContext:o.object({uri:o.string(),title:o.string()}).nullish()}),BO=o.object({webSearchQueries:o.array(o.string()).nullish(),retrievalQueries:o.array(o.string()).nullish(),searchEntryPoint:o.object({renderedContent:o.string()}).nullish(),groundingChunks:o.array(IL).nullish(),groundingSupports:o.array(o.object({segment:o.object({startIndex:o.number().nullish(),endIndex:o.number().nullish(),text:o.string().nullish()}),segment_text:o.string().nullish(),groundingChunkIndices:o.array(o.number()).nullish(),supportChunkIndices:o.array(o.number()).nullish(),confidenceScores:o.array(o.number()).nullish(),confidenceScore:o.array(o.number()).nullish()})).nullish(),retrievalMetadata:o.union([o.object({webDynamicRetrievalScore:o.number()}),o.object({})]).nullish()}),YL=yi({id:"google.google_search",name:"google_search",inputSchema:o.object({mode:o.enum(["MODE_DYNAMIC","MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),dynamicThreshold:o.number().default(1)})}),QL=o.object({retrievedUrl:o.string(),urlRetrievalStatus:o.string()}),KO=o.object({urlMetadata:o.array(QL)}),mL=yi({id:"google.url_context",name:"url_context",inputSchema:o.object({})}),SL=class{constructor(i,n){this.specificationVersion="v2",this.modelId=i,this.config=n,this.generateId=n.generateId??Qi}get provider(){return this.config.provider}get supportedUrls(){var i;return(i=this.config).supportedUrls?.call(i)??{}}async getArgs({prompt:i,maxOutputTokens:n,temperature:r,topP:u,topK:t,frequencyPenalty:c,presencePenalty:g,stopSequences:h,responseFormat:_,seed:l,tools:$,toolChoice:w,providerOptions:b}){let v=[],f=await Hi({provider:"google",providerOptions:b,schema:XL});f?.thinkingConfig?.includeThoughts===!0&&!this.config.provider.startsWith("google.vertex.")&&v.push({type:"other",message:`The \'includeThoughts\' option is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`});let U=this.modelId.toLowerCase().startsWith("gemma-"),{contents:z,systemInstruction:J}=qL(i,{isGemmaModel:U}),{tools:N,toolConfig:j,toolWarnings:O}=LL({tools:$,toolChoice:w,modelId:this.modelId});return{args:{generationConfig:{maxOutputTokens:n,temperature:r,topK:t,topP:u,frequencyPenalty:c,presencePenalty:g,stopSequences:h,seed:l,responseMimeType:_?.type==="json"?"application/json":void 0,responseSchema:_?.type==="json"&&_.schema!=null&&(f?.structuredOutputs??!0)?gn(_.schema):void 0,...f?.audioTimestamp&&{audioTimestamp:f.audioTimestamp},responseModalities:f?.responseModalities,thinkingConfig:f?.thinkingConfig},contents:z,systemInstruction:U?void 0:J,safetySettings:f?.safetySettings,tools:N,toolConfig:j,cachedContent:f?.cachedContent,labels:f?.labels},warnings:[...v,...O]}}async doGenerate(i){let{args:n,warnings:r}=await this.getArgs(i),u=JSON.stringify(n),t=Ui(await _u(this.config.headers),i.headers),{responseHeaders:c,value:g,rawValue:h}=await fi({url:`${this.config.baseURL}/${Y6(this.modelId)}:generateContent`,headers:t,body:n,failedResponseHandler:lu,successfulResponseHandler:Vi(KL),abortSignal:i.abortSignal,fetch:this.config.fetch}),_=g.candidates[0],l=[],$=_.content?.parts??[],w=g.usageMetadata,b;for(let f of $)if("executableCode"in f&&f.executableCode?.code){let U=this.config.generateId();b=U,l.push({type:"tool-call",toolCallId:U,toolName:"code_execution",input:JSON.stringify(f.executableCode),providerExecuted:!0})}else"codeExecutionResult"in f&&f.codeExecutionResult?(l.push({type:"tool-result",toolCallId:b,toolName:"code_execution",result:{outcome:f.codeExecutionResult.outcome,output:f.codeExecutionResult.output},providerExecuted:!0}),b=void 0):("text"in f)&&f.text!=null&&f.text.length>0?l.push({type:f.thought===!0?"reasoning":"text",text:f.text,providerMetadata:f.thoughtSignature?{google:{thoughtSignature:f.thoughtSignature}}:void 0}):("functionCall"in f)?l.push({type:"tool-call",toolCallId:this.config.generateId(),toolName:f.functionCall.name,input:JSON.stringify(f.functionCall.args),providerMetadata:f.thoughtSignature?{google:{thoughtSignature:f.thoughtSignature}}:void 0}):("inlineData"in f)&&l.push({type:"file",data:f.inlineData.data,mediaType:f.inlineData.mimeType});let v=m6({groundingMetadata:_.groundingMetadata,generateId:this.config.generateId})??[];for(let f of v)l.push(f);return{content:l,finishReason:Q6({finishReason:_.finishReason,hasToolCalls:l.some((f)=>f.type==="tool-call")}),usage:{inputTokens:w?.promptTokenCount??void 0,outputTokens:w?.candidatesTokenCount??void 0,totalTokens:w?.totalTokenCount??void 0,reasoningTokens:w?.thoughtsTokenCount??void 0,cachedInputTokens:w?.cachedContentTokenCount??void 0},warnings:r,providerMetadata:{google:{promptFeedback:g.promptFeedback??null,groundingMetadata:_.groundingMetadata??null,urlContextMetadata:_.urlContextMetadata??null,safetyRatings:_.safetyRatings??null,usageMetadata:w??null}},request:{body:u},response:{headers:c,body:h}}}async doStream(i){let{args:n,warnings:r}=await this.getArgs(i),u=JSON.stringify(n),t=Ui(await _u(this.config.headers),i.headers),{responseHeaders:c,value:g}=await fi({url:`${this.config.baseURL}/${Y6(this.modelId)}:streamGenerateContent?alt=sse`,headers:t,body:n,failedResponseHandler:lu,successfulResponseHandler:Vt(VL),abortSignal:i.abortSignal,fetch:this.config.fetch}),h="unknown",_={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},l,$=this.config.generateId,w=!1,b=null,v=null,f=0,U=new Set,z;return{stream:g.pipeThrough(new TransformStream({start(J){J.enqueue({type:"stream-start",warnings:r})},transform(J,N){if(i.includeRawChunks&&N.enqueue({type:"raw",rawValue:J.rawValue}),!J.success){N.enqueue({type:"error",error:J.error});return}let j=J.value,O=j.usageMetadata;O!=null&&(_.inputTokens=O.promptTokenCount??void 0,_.outputTokens=O.candidatesTokenCount??void 0,_.totalTokens=O.totalTokenCount??void 0,_.reasoningTokens=O.thoughtsTokenCount??void 0,_.cachedInputTokens=O.cachedContentTokenCount??void 0);let W=j.candidates?.[0];if(W==null)return;let E=W.content,X=m6({groundingMetadata:W.groundingMetadata,generateId:$});if(X!=null)for(let H of X)H.sourceType==="url"&&!U.has(H.url)&&(U.add(H.url),N.enqueue(H));if(E!=null){let H=E.parts??[];for(let Q of H)if("executableCode"in Q&&Q.executableCode?.code){let M=$();z=M,N.enqueue({type:"tool-call",toolCallId:M,toolName:"code_execution",input:JSON.stringify(Q.executableCode),providerExecuted:!0}),w=!0}else if("codeExecutionResult"in Q&&Q.codeExecutionResult){let M=z;M&&(N.enqueue({type:"tool-result",toolCallId:M,toolName:"code_execution",result:{outcome:Q.codeExecutionResult.outcome,output:Q.codeExecutionResult.output},providerExecuted:!0}),z=void 0)}else"text"in Q&&Q.text!=null&&Q.text.length>0&&(Q.thought===!0?(b!==null&&(N.enqueue({type:"text-end",id:b}),b=null),v===null&&(v=String(f++),N.enqueue({type:"reasoning-start",id:v,providerMetadata:Q.thoughtSignature?{google:{thoughtSignature:Q.thoughtSignature}}:void 0})),N.enqueue({type:"reasoning-delta",id:v,delta:Q.text,providerMetadata:Q.thoughtSignature?{google:{thoughtSignature:Q.thoughtSignature}}:void 0})):(v!==null&&(N.enqueue({type:"reasoning-end",id:v}),v=null),b===null&&(b=String(f++),N.enqueue({type:"text-start",id:b,providerMetadata:Q.thoughtSignature?{google:{thoughtSignature:Q.thoughtSignature}}:void 0})),N.enqueue({type:"text-delta",id:b,delta:Q.text,providerMetadata:Q.thoughtSignature?{google:{thoughtSignature:Q.thoughtSignature}}:void 0})));let Y=BL(E.parts);if(Y!=null)for(let Q of Y)N.enqueue({type:"file",mediaType:Q.inlineData.mimeType,data:Q.inlineData.data});let V=AL({parts:E.parts,generateId:$});if(V!=null)for(let Q of V)N.enqueue({type:"tool-input-start",id:Q.toolCallId,toolName:Q.toolName,providerMetadata:Q.providerMetadata}),N.enqueue({type:"tool-input-delta",id:Q.toolCallId,delta:Q.args,providerMetadata:Q.providerMetadata}),N.enqueue({type:"tool-input-end",id:Q.toolCallId,providerMetadata:Q.providerMetadata}),N.enqueue({type:"tool-call",toolCallId:Q.toolCallId,toolName:Q.toolName,input:Q.args,providerMetadata:Q.providerMetadata}),w=!0}W.finishReason!=null&&(h=Q6({finishReason:W.finishReason,hasToolCalls:w}),l={google:{promptFeedback:j.promptFeedback??null,groundingMetadata:W.groundingMetadata??null,urlContextMetadata:W.urlContextMetadata??null,safetyRatings:W.safetyRatings??null}},O!=null&&(l.google.usageMetadata=O))},flush(J){b!==null&&J.enqueue({type:"text-end",id:b}),v!==null&&J.enqueue({type:"reasoning-end",id:v}),J.enqueue({type:"finish",finishReason:h,usage:_,providerMetadata:l})}})),response:{headers:c},request:{body:u}}}};function AL({parts:i,generateId:n}){let r=i?.filter((u)=>("functionCall"in u));return r==null||r.length===0?void 0:r.map((u)=>({type:"tool-call",toolCallId:n(),toolName:u.functionCall.name,args:JSON.stringify(u.functionCall.args),providerMetadata:u.thoughtSignature?{google:{thoughtSignature:u.thoughtSignature}}:void 0}))}function BL(i){return i?.filter((n)=>("inlineData"in n))}function m6({groundingMetadata:i,generateId:n}){return i?.groundingChunks?.filter((r)=>r.web!=null).map((r)=>({type:"source",sourceType:"url",id:n(),url:r.web.uri,title:r.web.title}))}var VO=o.object({parts:o.array(o.union([o.object({functionCall:o.object({name:o.string(),args:o.unknown()}),thoughtSignature:o.string().nullish()}),o.object({inlineData:o.object({mimeType:o.string(),data:o.string()})}),o.object({executableCode:o.object({language:o.string(),code:o.string()}).nullish(),codeExecutionResult:o.object({outcome:o.string(),output:o.string()}).nullish(),text:o.string().nullish(),thought:o.boolean().nullish(),thoughtSignature:o.string().nullish()})])).nullish()}),fo=o.object({category:o.string().nullish(),probability:o.string().nullish(),probabilityScore:o.number().nullish(),severity:o.string().nullish(),severityScore:o.number().nullish(),blocked:o.boolean().nullish()}),MO=o.object({cachedContentTokenCount:o.number().nullish(),thoughtsTokenCount:o.number().nullish(),promptTokenCount:o.number().nullish(),candidatesTokenCount:o.number().nullish(),totalTokenCount:o.number().nullish()}),KL=o.object({candidates:o.array(o.object({content:VO.nullish().or(o.object({}).strict()),finishReason:o.string().nullish(),safetyRatings:o.array(fo).nullish(),groundingMetadata:BO.nullish(),urlContextMetadata:KO.nullish()})),usageMetadata:MO.nullish(),promptFeedback:o.object({blockReason:o.string().nullish(),safetyRatings:o.array(fo).nullish()}).nullish()}),VL=o.object({candidates:o.array(o.object({content:VO.nullish(),finishReason:o.string().nullish(),safetyRatings:o.array(fo).nullish(),groundingMetadata:BO.nullish(),urlContextMetadata:KO.nullish()})).nullish(),usageMetadata:MO.nullish(),promptFeedback:o.object({blockReason:o.string().nullish(),safetyRatings:o.array(fo).nullish()}).nullish()}),ML=Pn({id:"google.code_execution",name:"code_execution",inputSchema:o.object({language:o.string().describe("The programming language of the code."),code:o.string().describe("The code to be executed.")}),outputSchema:o.object({outcome:o.string().describe(\'The outcome of the execution (e.g., "OUTCOME_OK").\'),output:o.string().describe("The output from the code execution.")})}),xL={googleSearch:YL,urlContext:mL,codeExecution:ML},FL=class{constructor(i,n,r){this.modelId=i,this.settings=n,this.config=r,this.specificationVersion="v2"}get maxImagesPerCall(){return this.settings.maxImagesPerCall??4}get provider(){return this.config.provider}async doGenerate(i){var n;let{prompt:r,n:u=1,size:t="1024x1024",aspectRatio:c="1:1",seed:g,providerOptions:h,headers:_,abortSignal:l}=i,$=[];t!=null&&$.push({type:"unsupported-setting",setting:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."}),g!=null&&$.push({type:"unsupported-setting",setting:"seed",details:"This model does not support the `seed` option through this provider."});let w=await Hi({provider:"google",providerOptions:h,schema:yL}),b=(n=this.config._internal)?.currentDate?.call(n)??new Date,v={sampleCount:u};c!=null&&(v.aspectRatio=c),w&&Object.assign(v,w);let f={instances:[{prompt:r}],parameters:v},{responseHeaders:U,value:z}=await fi({url:`${this.config.baseURL}/models/${this.modelId}:predict`,headers:Ui(await _u(this.config.headers),_),body:f,failedResponseHandler:lu,successfulResponseHandler:Vi(PL),abortSignal:l,fetch:this.config.fetch});return{images:z.predictions.map((J)=>J.bytesBase64Encoded),warnings:$??[],providerMetadata:{google:{images:z.predictions.map((J)=>({}))}},response:{timestamp:b,modelId:this.modelId,headers:U}}}},PL=o.object({predictions:o.array(o.object({bytesBase64Encoded:o.string()})).default([])}),yL=o.object({personGeneration:o.enum(["dont_allow","allow_adult","allow_all"]).nullish(),aspectRatio:o.enum(["1:1","3:4","4:3","9:16","16:9"]).nullish()});function TL(i={}){let n=jo(i.baseURL)??"https://generativelanguage.googleapis.com/v1beta",r=()=>wu({"x-goog-api-key":Oo({apiKey:i.apiKey,environmentVariableName:"GOOGLE_GENERATIVE_AI_API_KEY",description:"Google Generative AI"}),...i.headers},`ai-sdk/google/${zL}`),u=(h)=>new SL(h,{provider:"google.generative-ai",baseURL:n,headers:r,generateId:i.generateId??Qi,supportedUrls:()=>({"*":[RegExp(`^${n}/files/.*$`),RegExp("^https://(?:www\\\\.)?youtube\\\\.com/watch\\\\?v=[\\\\w-]+(?:&[\\\\w=&.-]*)?$"),RegExp("^https://youtu\\\\.be/[\\\\w-]+(?:\\\\?[\\\\w=&.-]*)?$")]}),fetch:i.fetch}),t=(h)=>new JL(h,{provider:"google.generative-ai",baseURL:n,headers:r,fetch:i.fetch}),c=(h,_={})=>new FL(h,_,{provider:"google.generative-ai",baseURL:n,headers:r,fetch:i.fetch}),g=function(h){if(new.target)throw Error("The Google Generative AI model function cannot be called with the new keyword.");return u(h)};return g.languageModel=u,g.chat=u,g.generativeAI=u,g.embedding=t,g.textEmbedding=t,g.textEmbeddingModel=t,g.image=c,g.imageModel=c,g.tools=xL,g}TL();var J0=o.object({error:o.object({message:o.string(),type:o.string().nullish(),param:o.any().nullish(),code:o.union([o.string(),o.number()]).nullish()})}),hn=bu({errorSchema:J0,errorToMessage:(i)=>i.error.message});function kL({prompt:i,systemMessageMode:n="system"}){let r=[],u=[];for(let{role:t,content:c}of i)switch(t){case"system":switch(n){case"system":r.push({role:"system",content:c});break;case"developer":r.push({role:"developer",content:c});break;case"remove":u.push({type:"other",message:"system messages are removed for this model"});break;default:throw Error(`Unsupported system message mode: ${n}`)}break;case"user":if(c.length===1&&c[0].type==="text"){r.push({role:"user",content:c[0].text});break}r.push({role:"user",content:c.map((g,h)=>{switch(g.type){case"text":return{type:"text",text:g.text};case"file":if(g.mediaType.startsWith("image/")){let _=g.mediaType==="image/*"?"image/jpeg":g.mediaType;return{type:"image_url",image_url:{url:g.data instanceof URL?g.data.toString():`data:${_};base64,${pi(g.data)}`,detail:g.providerOptions?.openai?.imageDetail}}}else if(g.mediaType.startsWith("audio/")){if(g.data instanceof URL)throw new oi({functionality:"audio file parts with URLs"});switch(g.mediaType){case"audio/wav":return{type:"input_audio",input_audio:{data:pi(g.data),format:"wav"}};case"audio/mp3":case"audio/mpeg":return{type:"input_audio",input_audio:{data:pi(g.data),format:"mp3"}};default:throw new oi({functionality:`audio content parts with media type ${g.mediaType}`})}}else if(g.mediaType==="application/pdf"){if(g.data instanceof URL)throw new oi({functionality:"PDF file parts with URLs"});return{type:"file",file:typeof g.data=="string"&&g.data.startsWith("file-")?{file_id:g.data}:{filename:g.filename??`part-${h}.pdf`,file_data:`data:application/pdf;base64,${pi(g.data)}`}}}else throw new oi({functionality:`file part media type ${g.mediaType}`})}})});break;case"assistant":{let g="",h=[];for(let _ of c)switch(_.type){case"text":g+=_.text;break;case"tool-call":h.push({id:_.toolCallId,type:"function",function:{name:_.toolName,arguments:JSON.stringify(_.input)}});break}r.push({role:"assistant",content:g,tool_calls:h.length>0?h:void 0});break}case"tool":for(let g of c){let h=g.output,_;switch(h.type){case"text":case"error-text":_=h.value;break;case"content":case"json":case"error-json":_=JSON.stringify(h.value);break}r.push({role:"tool",tool_call_id:g.toolCallId,content:_})}break;default:throw Error(`Unsupported role: ${t}`)}return{messages:r,warnings:u}}function S6({id:i,model:n,created:r}){return{id:i??void 0,modelId:n??void 0,timestamp:r==null?void 0:new Date(r*1000)}}function A6(i){switch(i){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"unknown"}}var CL=o.object({logitBias:o.record(o.coerce.number(),o.number()).optional(),logprobs:o.union([o.boolean(),o.number()]).optional(),parallelToolCalls:o.boolean().optional(),user:o.string().optional(),reasoningEffort:o.enum(["minimal","low","medium","high"]).optional(),maxCompletionTokens:o.number().optional(),store:o.boolean().optional(),metadata:o.record(o.string().max(64),o.string().max(512)).optional(),prediction:o.record(o.string(),o.any()).optional(),structuredOutputs:o.boolean().optional(),serviceTier:o.enum(["auto","flex","priority"]).optional(),strictJsonSchema:o.boolean().optional(),textVerbosity:o.enum(["low","medium","high"]).optional(),promptCacheKey:o.string().optional(),safetyIdentifier:o.string().optional()});function RL({tools:i,toolChoice:n,structuredOutputs:r,strictJsonSchema:u}){i=i?.length?i:void 0;let t=[];if(i==null)return{tools:void 0,toolChoice:void 0,toolWarnings:t};let c=[];for(let h of i)switch(h.type){case"function":c.push({type:"function",function:{name:h.name,description:h.description,parameters:h.inputSchema,strict:r?u:void 0}});break;default:t.push({type:"unsupported-tool",tool:h});break}if(n==null)return{tools:c,toolChoice:void 0,toolWarnings:t};let g=n.type;switch(g){case"auto":case"none":case"required":return{tools:c,toolChoice:g,toolWarnings:t};case"tool":return{tools:c,toolChoice:{type:"function",function:{name:n.toolName}},toolWarnings:t};default:throw new oi({functionality:`tool choice type: ${g}`})}}var ZL=class{constructor(i,n){this.specificationVersion="v2",this.supportedUrls={"image/*":[/^https?:\\/\\/.*$/]},this.modelId=i,this.config=n}get provider(){return this.config.provider}async getArgs({prompt:i,maxOutputTokens:n,temperature:r,topP:u,topK:t,frequencyPenalty:c,presencePenalty:g,stopSequences:h,responseFormat:_,seed:l,tools:$,toolChoice:w,providerOptions:b}){let v=[],f=await Hi({provider:"openai",providerOptions:b,schema:CL})??{},U=f.structuredOutputs??!0;t!=null&&v.push({type:"unsupported-setting",setting:"topK"}),_?.type==="json"&&_.schema!=null&&!U&&v.push({type:"unsupported-setting",setting:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{messages:z,warnings:J}=kL({prompt:i,systemMessageMode:sL(this.modelId)});v.push(...J);let N=f.strictJsonSchema??!1,j={model:this.modelId,logit_bias:f.logitBias,logprobs:f.logprobs===!0||typeof f.logprobs=="number"?!0:void 0,top_logprobs:typeof f.logprobs=="number"?f.logprobs:typeof f.logprobs=="boolean"&&f.logprobs?0:void 0,user:f.user,parallel_tool_calls:f.parallelToolCalls,max_tokens:n,temperature:r,top_p:u,frequency_penalty:c,presence_penalty:g,response_format:_?.type==="json"?U&&_.schema!=null?{type:"json_schema",json_schema:{schema:_.schema,strict:N,name:_.name??"response",description:_.description}}:{type:"json_object"}:void 0,stop:h,seed:l,verbosity:f.textVerbosity,max_completion_tokens:f.maxCompletionTokens,store:f.store,metadata:f.metadata,prediction:f.prediction,reasoning_effort:f.reasoningEffort,service_tier:f.serviceTier,prompt_cache_key:f.promptCacheKey,safety_identifier:f.safetyIdentifier,messages:z};FO(this.modelId)?(j.temperature!=null&&(j.temperature=void 0,v.push({type:"unsupported-setting",setting:"temperature",details:"temperature is not supported for reasoning models"})),j.top_p!=null&&(j.top_p=void 0,v.push({type:"unsupported-setting",setting:"topP",details:"topP is not supported for reasoning models"})),j.frequency_penalty!=null&&(j.frequency_penalty=void 0,v.push({type:"unsupported-setting",setting:"frequencyPenalty",details:"frequencyPenalty is not supported for reasoning models"})),j.presence_penalty!=null&&(j.presence_penalty=void 0,v.push({type:"unsupported-setting",setting:"presencePenalty",details:"presencePenalty is not supported for reasoning models"})),j.logit_bias!=null&&(j.logit_bias=void 0,v.push({type:"other",message:"logitBias is not supported for reasoning models"})),j.logprobs!=null&&(j.logprobs=void 0,v.push({type:"other",message:"logprobs is not supported for reasoning models"})),j.top_logprobs!=null&&(j.top_logprobs=void 0,v.push({type:"other",message:"topLogprobs is not supported for reasoning models"})),j.max_tokens!=null&&(j.max_completion_tokens??=j.max_tokens,j.max_tokens=void 0)):(this.modelId.startsWith("gpt-4o-search-preview")||this.modelId.startsWith("gpt-4o-mini-search-preview"))&&j.temperature!=null&&(j.temperature=void 0,v.push({type:"unsupported-setting",setting:"temperature",details:"temperature is not supported for the search preview models and has been removed."})),f.serviceTier==="flex"&&!dL(this.modelId)&&(v.push({type:"unsupported-setting",setting:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),j.service_tier=void 0),f.serviceTier==="priority"&&!aL(this.modelId)&&(v.push({type:"unsupported-setting",setting:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),j.service_tier=void 0);let{tools:O,toolChoice:W,toolWarnings:E}=RL({tools:$,toolChoice:w,structuredOutputs:U,strictJsonSchema:N});return{args:{...j,tools:O,tool_choice:W},warnings:[...v,...E]}}async doGenerate(i){let{args:n,warnings:r}=await this.getArgs(i),{responseHeaders:u,value:t,rawValue:c}=await fi({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),body:n,failedResponseHandler:hn,successfulResponseHandler:Vi(eL),abortSignal:i.abortSignal,fetch:this.config.fetch}),g=t.choices[0],h=[],_=g.message.content;_!=null&&_.length>0&&h.push({type:"text",text:_});for(let b of g.message.tool_calls??[])h.push({type:"tool-call",toolCallId:b.id??Qi(),toolName:b.function.name,input:b.function.arguments});for(let b of g.message.annotations??[])h.push({type:"source",sourceType:"url",id:Qi(),url:b.url,title:b.title});let l=t.usage?.completion_tokens_details,$=t.usage?.prompt_tokens_details,w={openai:{}};return l?.accepted_prediction_tokens!=null&&(w.openai.acceptedPredictionTokens=l?.accepted_prediction_tokens),l?.rejected_prediction_tokens!=null&&(w.openai.rejectedPredictionTokens=l?.rejected_prediction_tokens),g.logprobs?.content!=null&&(w.openai.logprobs=g.logprobs.content),{content:h,finishReason:A6(g.finish_reason),usage:{inputTokens:t.usage?.prompt_tokens??void 0,outputTokens:t.usage?.completion_tokens??void 0,totalTokens:t.usage?.total_tokens??void 0,reasoningTokens:l?.reasoning_tokens??void 0,cachedInputTokens:$?.cached_tokens??void 0},request:{body:n},response:{...S6(t),headers:u,body:c},warnings:r,providerMetadata:w}}async doStream(i){let{args:n,warnings:r}=await this.getArgs(i),u={...n,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:t,value:c}=await fi({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),body:u,failedResponseHandler:hn,successfulResponseHandler:Vt(pL),abortSignal:i.abortSignal,fetch:this.config.fetch}),g=[],h="unknown",_={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},l=!0,$=!1,w={openai:{}};return{stream:c.pipeThrough(new TransformStream({start(b){b.enqueue({type:"stream-start",warnings:r})},transform(b,v){if(i.includeRawChunks&&v.enqueue({type:"raw",rawValue:b.rawValue}),!b.success){h="error",v.enqueue({type:"error",error:b.error});return}let f=b.value;if("error"in f){h="error",v.enqueue({type:"error",error:f.error});return}l&&(l=!1,v.enqueue({type:"response-metadata",...S6(f)})),f.usage!=null&&(_.inputTokens=f.usage.prompt_tokens??void 0,_.outputTokens=f.usage.completion_tokens??void 0,_.totalTokens=f.usage.total_tokens??void 0,_.reasoningTokens=f.usage.completion_tokens_details?.reasoning_tokens??void 0,_.cachedInputTokens=f.usage.prompt_tokens_details?.cached_tokens??void 0,f.usage.completion_tokens_details?.accepted_prediction_tokens!=null&&(w.openai.acceptedPredictionTokens=f.usage.completion_tokens_details?.accepted_prediction_tokens),f.usage.completion_tokens_details?.rejected_prediction_tokens!=null&&(w.openai.rejectedPredictionTokens=f.usage.completion_tokens_details?.rejected_prediction_tokens));let U=f.choices[0];if(U?.finish_reason!=null&&(h=A6(U.finish_reason)),U?.logprobs?.content!=null&&(w.openai.logprobs=U.logprobs.content),U?.delta==null)return;let z=U.delta;if(z.content!=null&&($||=(v.enqueue({type:"text-start",id:"0"}),!0),v.enqueue({type:"text-delta",id:"0",delta:z.content})),z.tool_calls!=null)for(let J of z.tool_calls){let N=J.index;if(g[N]==null){if(J.type!=="function")throw new j0({data:J,message:"Expected \'function\' type."});if(J.id==null)throw new j0({data:J,message:"Expected \'id\' to be a string."});if(J.function?.name==null)throw new j0({data:J,message:"Expected \'function.name\' to be a string."});v.enqueue({type:"tool-input-start",id:J.id,toolName:J.function.name}),g[N]={id:J.id,type:"function",function:{name:J.function.name,arguments:J.function.arguments??""},hasFinished:!1};let O=g[N];O.function?.name!=null&&O.function?.arguments!=null&&(O.function.arguments.length>0&&v.enqueue({type:"tool-input-delta",id:O.id,delta:O.function.arguments}),G6(O.function.arguments)&&(v.enqueue({type:"tool-input-end",id:O.id}),v.enqueue({type:"tool-call",toolCallId:O.id??Qi(),toolName:O.function.name,input:O.function.arguments}),O.hasFinished=!0));continue}let j=g[N];j.hasFinished||(J.function?.arguments!=null&&(j.function.arguments+=J.function?.arguments??""),v.enqueue({type:"tool-input-delta",id:j.id,delta:J.function.arguments??""}),j.function?.name!=null&&j.function?.arguments!=null&&G6(j.function.arguments)&&(v.enqueue({type:"tool-input-end",id:j.id}),v.enqueue({type:"tool-call",toolCallId:j.id??Qi(),toolName:j.function.name,input:j.function.arguments}),j.hasFinished=!0))}if(z.annotations!=null)for(let J of z.annotations)v.enqueue({type:"source",sourceType:"url",id:Qi(),url:J.url,title:J.title})},flush(b){$&&b.enqueue({type:"text-end",id:"0"}),b.enqueue({type:"finish",finishReason:h,usage:_,...w==null?{}:{providerMetadata:w}})}})),request:{body:u},response:{headers:t}}}},xO=o.object({prompt_tokens:o.number().nullish(),completion_tokens:o.number().nullish(),total_tokens:o.number().nullish(),prompt_tokens_details:o.object({cached_tokens:o.number().nullish()}).nullish(),completion_tokens_details:o.object({reasoning_tokens:o.number().nullish(),accepted_prediction_tokens:o.number().nullish(),rejected_prediction_tokens:o.number().nullish()}).nullish()}).nullish(),eL=o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({message:o.object({role:o.literal("assistant").nullish(),content:o.string().nullish(),tool_calls:o.array(o.object({id:o.string().nullish(),type:o.literal("function"),function:o.object({name:o.string(),arguments:o.string()})})).nullish(),annotations:o.array(o.object({type:o.literal("url_citation"),start_index:o.number(),end_index:o.number(),url:o.string(),title:o.string()})).nullish()}),index:o.number(),logprobs:o.object({content:o.array(o.object({token:o.string(),logprob:o.number(),top_logprobs:o.array(o.object({token:o.string(),logprob:o.number()}))})).nullish()}).nullish(),finish_reason:o.string().nullish()})),usage:xO}),pL=o.union([o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({delta:o.object({role:o.enum(["assistant"]).nullish(),content:o.string().nullish(),tool_calls:o.array(o.object({index:o.number(),id:o.string().nullish(),type:o.literal("function").nullish(),function:o.object({name:o.string().nullish(),arguments:o.string().nullish()})})).nullish(),annotations:o.array(o.object({type:o.literal("url_citation"),start_index:o.number(),end_index:o.number(),url:o.string(),title:o.string()})).nullish()}).nullish(),logprobs:o.object({content:o.array(o.object({token:o.string(),logprob:o.number(),top_logprobs:o.array(o.object({token:o.string(),logprob:o.number()}))})).nullish()}).nullish(),finish_reason:o.string().nullish(),index:o.number()})),usage:xO}),J0]);function FO(i){return(i.startsWith("o")||i.startsWith("gpt-5"))&&!i.startsWith("gpt-5-chat")}function dL(i){return i.startsWith("o3")||i.startsWith("o4-mini")||i.startsWith("gpt-5")&&!i.startsWith("gpt-5-chat")}function aL(i){return i.startsWith("gpt-4")||i.startsWith("gpt-5-mini")||i.startsWith("gpt-5")&&!i.startsWith("gpt-5-nano")&&!i.startsWith("gpt-5-chat")||i.startsWith("o3")||i.startsWith("o4-mini")}function sL(i){return FO(i)?iI[i]?.systemMessageMode??"developer":"system"}var iI={"o1-mini":{systemMessageMode:"remove"},"o1-mini-2024-09-12":{systemMessageMode:"remove"},"o1-preview":{systemMessageMode:"remove"},"o1-preview-2024-09-12":{systemMessageMode:"remove"},o3:{systemMessageMode:"developer"},"o3-2025-04-16":{systemMessageMode:"developer"},"o3-mini":{systemMessageMode:"developer"},"o3-mini-2025-01-31":{systemMessageMode:"developer"},"o4-mini":{systemMessageMode:"developer"},"o4-mini-2025-04-16":{systemMessageMode:"developer"}};function nI({prompt:i,user:n="user",assistant:r="assistant"}){let u="";i[0].role==="system"&&(u+=`${i[0].content}\n\n`,i=i.slice(1));for(let{role:t,content:c}of i)switch(t){case"system":throw new hX({message:"Unexpected system message in prompt: ${content}",prompt:i});case"user":{let g=c.map((h)=>{switch(h.type){case"text":return h.text}}).filter(Boolean).join("");u+=`${n}:\n${g}\n\n`;break}case"assistant":{let g=c.map((h)=>{switch(h.type){case"text":return h.text;case"tool-call":throw new oi({functionality:"tool-call messages"})}}).join("");u+=`${r}:\n${g}\n\n`;break}case"tool":throw new oi({functionality:"tool messages"});default:throw Error(`Unsupported role: ${t}`)}return u+=`${r}:\n`,{prompt:u,stopSequences:[`\n${n}:`]}}function B6({id:i,model:n,created:r}){return{id:i??void 0,modelId:n??void 0,timestamp:r==null?void 0:new Date(r*1000)}}function K6(i){switch(i){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"unknown"}}var V6=o.object({echo:o.boolean().optional(),logitBias:o.record(o.string(),o.number()).optional(),suffix:o.string().optional(),user:o.string().optional(),logprobs:o.union([o.boolean(),o.number()]).optional()}),tI=class{constructor(i,n){this.specificationVersion="v2",this.supportedUrls={},this.modelId=i,this.config=n}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get provider(){return this.config.provider}async getArgs({prompt:i,maxOutputTokens:n,temperature:r,topP:u,topK:t,frequencyPenalty:c,presencePenalty:g,stopSequences:h,responseFormat:_,tools:l,toolChoice:$,seed:w,providerOptions:b}){let v=[],f={...await Hi({provider:"openai",providerOptions:b,schema:V6}),...await Hi({provider:this.providerOptionsName,providerOptions:b,schema:V6})};t!=null&&v.push({type:"unsupported-setting",setting:"topK"}),l?.length&&v.push({type:"unsupported-setting",setting:"tools"}),$!=null&&v.push({type:"unsupported-setting",setting:"toolChoice"}),_!=null&&_.type!=="text"&&v.push({type:"unsupported-setting",setting:"responseFormat",details:"JSON response format is not supported."});let{prompt:U,stopSequences:z}=nI({prompt:i}),J=[...z??[],...h??[]];return{args:{model:this.modelId,echo:f.echo,logit_bias:f.logitBias,logprobs:f?.logprobs===!0?0:f?.logprobs===!1?void 0:f?.logprobs,suffix:f.suffix,user:f.user,max_tokens:n,temperature:r,top_p:u,frequency_penalty:c,presence_penalty:g,seed:w,prompt:U,stop:J.length>0?J:void 0},warnings:v}}async doGenerate(i){let{args:n,warnings:r}=await this.getArgs(i),{responseHeaders:u,value:t,rawValue:c}=await fi({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),body:n,failedResponseHandler:hn,successfulResponseHandler:Vi(rI),abortSignal:i.abortSignal,fetch:this.config.fetch}),g=t.choices[0],h={openai:{}};return g.logprobs!=null&&(h.openai.logprobs=g.logprobs),{content:[{type:"text",text:g.text}],usage:{inputTokens:t.usage?.prompt_tokens,outputTokens:t.usage?.completion_tokens,totalTokens:t.usage?.total_tokens},finishReason:K6(g.finish_reason),request:{body:n},response:{...B6(t),headers:u,body:c},providerMetadata:h,warnings:r}}async doStream(i){let{args:n,warnings:r}=await this.getArgs(i),u={...n,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:t,value:c}=await fi({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),body:u,failedResponseHandler:hn,successfulResponseHandler:Vt(uI),abortSignal:i.abortSignal,fetch:this.config.fetch}),g="unknown",h={openai:{}},_={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},l=!0;return{stream:c.pipeThrough(new TransformStream({start($){$.enqueue({type:"stream-start",warnings:r})},transform($,w){if(i.includeRawChunks&&w.enqueue({type:"raw",rawValue:$.rawValue}),!$.success){g="error",w.enqueue({type:"error",error:$.error});return}let b=$.value;if("error"in b){g="error",w.enqueue({type:"error",error:b.error});return}l&&(l=!1,w.enqueue({type:"response-metadata",...B6(b)}),w.enqueue({type:"text-start",id:"0"})),b.usage!=null&&(_.inputTokens=b.usage.prompt_tokens,_.outputTokens=b.usage.completion_tokens,_.totalTokens=b.usage.total_tokens);let v=b.choices[0];v?.finish_reason!=null&&(g=K6(v.finish_reason)),v?.logprobs!=null&&(h.openai.logprobs=v.logprobs),v?.text!=null&&v.text.length>0&&w.enqueue({type:"text-delta",id:"0",delta:v.text})},flush($){l||$.enqueue({type:"text-end",id:"0"}),$.enqueue({type:"finish",finishReason:g,providerMetadata:h,usage:_})}})),request:{body:u},response:{headers:t}}}},PO=o.object({prompt_tokens:o.number(),completion_tokens:o.number(),total_tokens:o.number()}),rI=o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({text:o.string(),finish_reason:o.string(),logprobs:o.object({tokens:o.array(o.string()),token_logprobs:o.array(o.number()),top_logprobs:o.array(o.record(o.string(),o.number())).nullish()}).nullish()})),usage:PO.nullish()}),uI=o.union([o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({text:o.string(),finish_reason:o.string().nullish(),index:o.number(),logprobs:o.object({tokens:o.array(o.string()),token_logprobs:o.array(o.number()),top_logprobs:o.array(o.record(o.string(),o.number())).nullish()}).nullish()})),usage:PO.nullish()}),J0]),cI=o.object({dimensions:o.number().optional(),user:o.string().optional()}),oI=class{constructor(i,n){this.specificationVersion="v2",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=i,this.config=n}get provider(){return this.config.provider}async doEmbed({values:i,headers:n,abortSignal:r,providerOptions:u}){if(i.length>this.maxEmbeddingsPerCall)throw new DO({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:i});let t=await Hi({provider:"openai",providerOptions:u,schema:cI})??{},{responseHeaders:c,value:g,rawValue:h}=await fi({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:Ui(this.config.headers(),n),body:{model:this.modelId,input:i,encoding_format:"float",dimensions:t.dimensions,user:t.user},failedResponseHandler:hn,successfulResponseHandler:Vi(gI),abortSignal:r,fetch:this.config.fetch});return{embeddings:g.data.map((_)=>_.embedding),usage:g.usage?{tokens:g.usage.prompt_tokens}:void 0,response:{headers:c,body:h}}}},gI=o.object({data:o.array(o.object({embedding:o.array(o.number())})),usage:o.object({prompt_tokens:o.number()}).nullish()}),hI={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10},_I=new Set(["gpt-image-1"]),lI=class{constructor(i,n){this.modelId=i,this.config=n,this.specificationVersion="v2"}get maxImagesPerCall(){return hI[this.modelId]??1}get provider(){return this.config.provider}async doGenerate({prompt:i,n,size:r,aspectRatio:u,seed:t,providerOptions:c,headers:g,abortSignal:h}){var _;let l=[];u!=null&&l.push({type:"unsupported-setting",setting:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."}),t!=null&&l.push({type:"unsupported-setting",setting:"seed"});let $=(_=this.config._internal)?.currentDate?.call(_)??new Date,{value:w,responseHeaders:b}=await fi({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:Ui(this.config.headers(),g),body:{model:this.modelId,prompt:i,n,size:r,...c.openai??{},..._I.has(this.modelId)?{}:{response_format:"b64_json"}},failedResponseHandler:hn,successfulResponseHandler:Vi($I),abortSignal:h,fetch:this.config.fetch});return{images:w.data.map((v)=>v.b64_json),warnings:l,response:{timestamp:$,modelId:this.modelId,headers:b},providerMetadata:{openai:{images:w.data.map((v)=>v.revised_prompt?{revisedPrompt:v.revised_prompt}:null)}}}}},$I=o.object({data:o.array(o.object({b64_json:o.string(),revised_prompt:o.string().optional()}))}),wI=o.object({code:o.string().nullish(),containerId:o.string()}),bI=o.object({outputs:o.array(o.discriminatedUnion("type",[o.object({type:o.literal("logs"),logs:o.string()}),o.object({type:o.literal("image"),url:o.string()})])).nullish()}),vI=o.object({container:o.union([o.string(),o.object({fileIds:o.array(o.string()).optional()})]).optional()}),fI=Pn({id:"openai.code_interpreter",name:"code_interpreter",inputSchema:wI,outputSchema:bI}),OI=(i={})=>fI(i),yO=o.object({key:o.string(),type:o.enum(["eq","ne","gt","gte","lt","lte"]),value:o.union([o.string(),o.number(),o.boolean()])}),TO=o.object({type:o.enum(["and","or"]),filters:o.array(o.union([yO,o.lazy(()=>TO)]))}),jI=o.object({vectorStoreIds:o.array(o.string()),maxNumResults:o.number().optional(),ranking:o.object({ranker:o.string().optional(),scoreThreshold:o.number().optional()}).optional(),filters:o.union([yO,TO]).optional()}),UI=o.object({queries:o.array(o.string()),results:o.array(o.object({attributes:o.record(o.string(),o.unknown()),fileId:o.string(),filename:o.string(),score:o.number(),text:o.string()})).nullable()}),NI=Pn({id:"openai.file_search",name:"file_search",inputSchema:o.object({}),outputSchema:UI}),zI=o.object({background:o.enum(["auto","opaque","transparent"]).optional(),inputFidelity:o.enum(["low","high"]).optional(),inputImageMask:o.object({fileId:o.string().optional(),imageUrl:o.string().optional()}).optional(),model:o.string().optional(),moderation:o.enum(["auto"]).optional(),outputCompression:o.number().int().min(0).max(100).optional(),outputFormat:o.enum(["png","jpeg","webp"]).optional(),quality:o.enum(["auto","low","medium","high"]).optional(),size:o.enum(["1024x1024","1024x1536","1536x1024","auto"]).optional()}).strict(),WI=o.object({result:o.string()}),DI=Pn({id:"openai.image_generation",name:"image_generation",inputSchema:o.object({}),outputSchema:WI}),JI=(i={})=>DI(i),kO=o.object({action:o.object({type:o.literal("exec"),command:o.array(o.string()),timeoutMs:o.number().optional(),user:o.string().optional(),workingDirectory:o.string().optional(),env:o.record(o.string(),o.string()).optional()})}),CO=o.object({output:o.string()}),EI=Pn({id:"openai.local_shell",name:"local_shell",inputSchema:kO,outputSchema:CO}),HI=o.object({filters:o.object({allowedDomains:o.array(o.string()).optional()}).optional(),searchContextSize:o.enum(["low","medium","high"]).optional(),userLocation:o.object({type:o.literal("approximate"),country:o.string().optional(),city:o.string().optional(),region:o.string().optional(),timezone:o.string().optional()}).optional()}),GI=yi({id:"openai.web_search",name:"web_search",inputSchema:o.object({action:o.discriminatedUnion("type",[o.object({type:o.literal("search"),query:o.string().nullish()}),o.object({type:o.literal("open_page"),url:o.string()}),o.object({type:o.literal("find"),url:o.string(),pattern:o.string()})]).nullish()})}),qI=(i={})=>GI(i),XI=o.object({searchContextSize:o.enum(["low","medium","high"]).optional(),userLocation:o.object({type:o.literal("approximate"),country:o.string().optional(),city:o.string().optional(),region:o.string().optional(),timezone:o.string().optional()}).optional()}),LI=yi({id:"openai.web_search_preview",name:"web_search_preview",inputSchema:o.object({action:o.discriminatedUnion("type",[o.object({type:o.literal("search"),query:o.string().nullish()}),o.object({type:o.literal("open_page"),url:o.string()}),o.object({type:o.literal("find"),url:o.string(),pattern:o.string()})]).nullish()})}),II={codeInterpreter:OI,fileSearch:NI,imageGeneration:JI,localShell:EI,webSearchPreview:LI,webSearch:qI};function M6(i,n){return n?n.some((r)=>i.startsWith(r)):!1}async function YI({prompt:i,systemMessageMode:n,fileIdPrefixes:r,store:u,hasLocalShellTool:t=!1}){let c=[],g=[];for(let{role:h,content:_}of i)switch(h){case"system":switch(n){case"system":c.push({role:"system",content:_});break;case"developer":c.push({role:"developer",content:_});break;case"remove":g.push({type:"other",message:"system messages are removed for this model"});break;default:throw Error(`Unsupported system message mode: ${n}`)}break;case"user":c.push({role:"user",content:_.map((l,$)=>{switch(l.type){case"text":return{type:"input_text",text:l.text};case"file":if(l.mediaType.startsWith("image/")){let w=l.mediaType==="image/*"?"image/jpeg":l.mediaType;return{type:"input_image",...l.data instanceof URL?{image_url:l.data.toString()}:typeof l.data=="string"&&M6(l.data,r)?{file_id:l.data}:{image_url:`data:${w};base64,${pi(l.data)}`},detail:l.providerOptions?.openai?.imageDetail}}else if(l.mediaType==="application/pdf")return l.data instanceof URL?{type:"input_file",file_url:l.data.toString()}:{type:"input_file",...typeof l.data=="string"&&M6(l.data,r)?{file_id:l.data}:{filename:l.filename??`part-${$}.pdf`,file_data:`data:application/pdf;base64,${pi(l.data)}`}};else throw new oi({functionality:`file part media type ${l.mediaType}`})}})});break;case"assistant":{let l={},$={};for(let w of _)switch(w.type){case"text":c.push({role:"assistant",content:[{type:"output_text",text:w.text}],id:w.providerOptions?.openai?.itemId??void 0});break;case"tool-call":if($[w.toolCallId]=w,w.providerExecuted)break;if(t&&w.toolName==="local_shell"){let b=kO.parse(w.input);c.push({type:"local_shell_call",call_id:w.toolCallId,id:w.providerOptions?.openai?.itemId??void 0,action:{type:"exec",command:b.action.command,timeout_ms:b.action.timeoutMs,user:b.action.user,working_directory:b.action.workingDirectory,env:b.action.env}});break}c.push({type:"function_call",call_id:w.toolCallId,name:w.toolName,arguments:JSON.stringify(w.input),id:w.providerOptions?.openai?.itemId??void 0});break;case"tool-result":u?c.push({type:"item_reference",id:w.toolCallId}):g.push({type:"other",message:`Results for OpenAI tool ${w.toolName} are not sent to the API when store is false`});break;case"reasoning":{let b=await Hi({provider:"openai",providerOptions:w.providerOptions,schema:QI}),v=b?.itemId;if(v!=null){let f=l[v];if(u)f===void 0&&(c.push({type:"item_reference",id:v}),l[v]={type:"reasoning",id:v,summary:[]});else{let U=[];w.text.length>0?U.push({type:"summary_text",text:w.text}):f!==void 0&&g.push({type:"other",message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(w)}.`}),f===void 0?(l[v]={type:"reasoning",id:v,encrypted_content:b?.reasoningEncryptedContent,summary:U},c.push(l[v])):f.summary.push(...U)}}else g.push({type:"other",message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(w)}.`});break}}break}case"tool":for(let l of _){let $=l.output;if(t&&l.toolName==="local_shell"&&$.type==="json"){c.push({type:"local_shell_call_output",call_id:l.toolCallId,output:CO.parse($.value).output});break}let w;switch($.type){case"text":case"error-text":w=$.value;break;case"content":case"json":case"error-json":w=JSON.stringify($.value);break}c.push({type:"function_call_output",call_id:l.toolCallId,output:w})}break;default:throw Error(`Unsupported role: ${h}`)}return{input:c,warnings:g}}var QI=o.object({itemId:o.string().nullish(),reasoningEncryptedContent:o.string().nullish()});function x6({finishReason:i,hasFunctionCall:n}){switch(i){case void 0:case null:return n?"tool-calls":"stop";case"max_output_tokens":return"length";case"content_filter":return"content-filter";default:return n?"tool-calls":"unknown"}}function mI({tools:i,toolChoice:n,strictJsonSchema:r}){i=i?.length?i:void 0;let u=[];if(i==null)return{tools:void 0,toolChoice:void 0,toolWarnings:u};let t=[];for(let g of i)switch(g.type){case"function":t.push({type:"function",name:g.name,description:g.description,parameters:g.inputSchema,strict:r});break;case"provider-defined":switch(g.id){case"openai.file_search":{let h=jI.parse(g.args);t.push({type:"file_search",vector_store_ids:h.vectorStoreIds,max_num_results:h.maxNumResults,ranking_options:h.ranking?{ranker:h.ranking.ranker,score_threshold:h.ranking.scoreThreshold}:void 0,filters:h.filters});break}case"openai.local_shell":t.push({type:"local_shell"});break;case"openai.web_search_preview":{let h=XI.parse(g.args);t.push({type:"web_search_preview",search_context_size:h.searchContextSize,user_location:h.userLocation});break}case"openai.web_search":{let h=HI.parse(g.args);t.push({type:"web_search",filters:h.filters==null?void 0:{allowed_domains:h.filters.allowedDomains},search_context_size:h.searchContextSize,user_location:h.userLocation});break}case"openai.code_interpreter":{let h=vI.parse(g.args);t.push({type:"code_interpreter",container:h.container==null?{type:"auto",file_ids:void 0}:typeof h.container=="string"?h.container:{type:"auto",file_ids:h.container.fileIds}});break}case"openai.image_generation":{let h=zI.parse(g.args);t.push({type:"image_generation",background:h.background,input_fidelity:h.inputFidelity,input_image_mask:h.inputImageMask?{file_id:h.inputImageMask.fileId,image_url:h.inputImageMask.imageUrl}:void 0,model:h.model,size:h.size,quality:h.quality,moderation:h.moderation,output_format:h.outputFormat,output_compression:h.outputCompression});break}}break;default:u.push({type:"unsupported-tool",tool:g});break}if(n==null)return{tools:t,toolChoice:void 0,toolWarnings:u};let c=n.type;switch(c){case"auto":case"none":case"required":return{tools:t,toolChoice:c,toolWarnings:u};case"tool":return{tools:t,toolChoice:n.toolName==="code_interpreter"||n.toolName==="file_search"||n.toolName==="image_generation"||n.toolName==="web_search_preview"||n.toolName==="web_search"?{type:n.toolName}:{type:"function",name:n.toolName},toolWarnings:u};default:throw new oi({functionality:`tool choice type: ${c}`})}}var RO=o.object({type:o.literal("web_search_call"),id:o.string(),status:o.string(),action:o.discriminatedUnion("type",[o.object({type:o.literal("search"),query:o.string().nullish()}),o.object({type:o.literal("open_page"),url:o.string()}),o.object({type:o.literal("find"),url:o.string(),pattern:o.string()})]).nullish()}),ZO=o.object({type:o.literal("file_search_call"),id:o.string(),queries:o.array(o.string()),results:o.array(o.object({attributes:o.record(o.string(),o.unknown()),file_id:o.string(),filename:o.string(),score:o.number(),text:o.string()})).nullish()}),eO=o.object({type:o.literal("code_interpreter_call"),id:o.string(),code:o.string().nullable(),container_id:o.string(),outputs:o.array(o.discriminatedUnion("type",[o.object({type:o.literal("logs"),logs:o.string()}),o.object({type:o.literal("image"),url:o.string()})])).nullable()}),pO=o.object({type:o.literal("local_shell_call"),id:o.string(),call_id:o.string(),action:o.object({type:o.literal("exec"),command:o.array(o.string()),timeout_ms:o.number().optional(),user:o.string().optional(),working_directory:o.string().optional(),env:o.record(o.string(),o.string()).optional()})}),dO=o.object({type:o.literal("image_generation_call"),id:o.string(),result:o.string()}),aO=20,sO=o.array(o.object({token:o.string(),logprob:o.number(),top_logprobs:o.array(o.object({token:o.string(),logprob:o.number()}))})),SI=class{constructor(i,n){this.specificationVersion="v2",this.supportedUrls={"image/*":[/^https?:\\/\\/.*$/],"application/pdf":[/^https?:\\/\\/.*$/]},this.modelId=i,this.config=n}get provider(){return this.config.provider}async getArgs({maxOutputTokens:i,temperature:n,stopSequences:r,topP:u,topK:t,presencePenalty:c,frequencyPenalty:g,seed:h,prompt:_,providerOptions:l,tools:$,toolChoice:w,responseFormat:b}){let v=[],f=oY(this.modelId);t!=null&&v.push({type:"unsupported-setting",setting:"topK"}),h!=null&&v.push({type:"unsupported-setting",setting:"seed"}),c!=null&&v.push({type:"unsupported-setting",setting:"presencePenalty"}),g!=null&&v.push({type:"unsupported-setting",setting:"frequencyPenalty"}),r!=null&&v.push({type:"unsupported-setting",setting:"stopSequences"});let U=await Hi({provider:"openai",providerOptions:l,schema:gY}),{input:z,warnings:J}=await YI({prompt:_,systemMessageMode:f.systemMessageMode,fileIdPrefixes:this.config.fileIdPrefixes,store:U?.store??!0,hasLocalShellTool:W("openai.local_shell")});v.push(...J);let N=U?.strictJsonSchema??!1,j=U?.include;function O(M){j=j==null?[M]:[...j,M]}function W(M){return $?.find((p)=>p.type==="provider-defined"&&p.id===M)!=null}let E=typeof U?.logprobs=="number"?U?.logprobs:U?.logprobs===!0?aO:void 0;E&&O("message.output_text.logprobs");let X=$?.find((M)=>M.type==="provider-defined"&&(M.id==="openai.web_search"||M.id==="openai.web_search_preview"))?.name;X&&O("web_search_call.action.sources"),W("openai.code_interpreter")&&O("code_interpreter_call.outputs");let H={model:this.modelId,input:z,temperature:n,top_p:u,max_output_tokens:i,...(b?.type==="json"||U?.textVerbosity)&&{text:{...b?.type==="json"&&{format:b.schema==null?{type:"json_object"}:{type:"json_schema",strict:N,name:b.name??"response",description:b.description,schema:b.schema}},...U?.textVerbosity&&{verbosity:U.textVerbosity}}},max_tool_calls:U?.maxToolCalls,metadata:U?.metadata,parallel_tool_calls:U?.parallelToolCalls,previous_response_id:U?.previousResponseId,store:U?.store,user:U?.user,instructions:U?.instructions,service_tier:U?.serviceTier,include:j,prompt_cache_key:U?.promptCacheKey,safety_identifier:U?.safetyIdentifier,top_logprobs:E,...f.isReasoningModel&&(U?.reasoningEffort!=null||U?.reasoningSummary!=null)&&{reasoning:{...U?.reasoningEffort!=null&&{effort:U.reasoningEffort},...U?.reasoningSummary!=null&&{summary:U.reasoningSummary}}},...f.requiredAutoTruncation&&{truncation:"auto"}};f.isReasoningModel?(H.temperature!=null&&(H.temperature=void 0,v.push({type:"unsupported-setting",setting:"temperature",details:"temperature is not supported for reasoning models"})),H.top_p!=null&&(H.top_p=void 0,v.push({type:"unsupported-setting",setting:"topP",details:"topP is not supported for reasoning models"}))):(U?.reasoningEffort!=null&&v.push({type:"unsupported-setting",setting:"reasoningEffort",details:"reasoningEffort is not supported for non-reasoning models"}),U?.reasoningSummary!=null&&v.push({type:"unsupported-setting",setting:"reasoningSummary",details:"reasoningSummary is not supported for non-reasoning models"})),U?.serviceTier==="flex"&&!f.supportsFlexProcessing&&(v.push({type:"unsupported-setting",setting:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),delete H.service_tier),U?.serviceTier==="priority"&&!f.supportsPriorityProcessing&&(v.push({type:"unsupported-setting",setting:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),delete H.service_tier);let{tools:Y,toolChoice:V,toolWarnings:Q}=mI({tools:$,toolChoice:w,strictJsonSchema:N});return{webSearchToolName:X,args:{...H,tools:Y,tool_choice:V},warnings:[...v,...Q]}}async doGenerate(i){var n,r;let{args:u,warnings:t,webSearchToolName:c}=await this.getArgs(i),g=this.config.url({path:"/responses",modelId:this.modelId}),{responseHeaders:h,value:_,rawValue:l}=await fi({url:g,headers:Ui(this.config.headers(),i.headers),body:u,failedResponseHandler:hn,successfulResponseHandler:Vi(o.object({id:o.string(),created_at:o.number(),error:o.object({code:o.string(),message:o.string()}).nullish(),model:o.string(),output:o.array(o.discriminatedUnion("type",[o.object({type:o.literal("message"),role:o.literal("assistant"),id:o.string(),content:o.array(o.object({type:o.literal("output_text"),text:o.string(),logprobs:sO.nullish(),annotations:o.array(o.discriminatedUnion("type",[o.object({type:o.literal("url_citation"),start_index:o.number(),end_index:o.number(),url:o.string(),title:o.string()}),o.object({type:o.literal("file_citation"),file_id:o.string(),filename:o.string().nullish(),index:o.number().nullish(),start_index:o.number().nullish(),end_index:o.number().nullish(),quote:o.string().nullish()}),o.object({type:o.literal("container_file_citation")})]))}))}),RO,ZO,eO,dO,pO,o.object({type:o.literal("function_call"),call_id:o.string(),name:o.string(),arguments:o.string(),id:o.string()}),o.object({type:o.literal("computer_call"),id:o.string(),status:o.string().optional()}),o.object({type:o.literal("reasoning"),id:o.string(),encrypted_content:o.string().nullish(),summary:o.array(o.object({type:o.literal("summary_text"),text:o.string()}))})])),service_tier:o.string().nullish(),incomplete_details:o.object({reason:o.string()}).nullish(),usage:ij})),abortSignal:i.abortSignal,fetch:this.config.fetch});if(_.error)throw new Pi({message:_.error.message,url:g,requestBodyValues:u,statusCode:400,responseHeaders:h,responseBody:l,isRetryable:!1});let $=[],w=[],b=!1;for(let f of _.output)switch(f.type){case"reasoning":f.summary.length===0&&f.summary.push({type:"summary_text",text:""});for(let U of f.summary)$.push({type:"reasoning",text:U.text,providerMetadata:{openai:{itemId:f.id,reasoningEncryptedContent:f.encrypted_content??null}}});break;case"image_generation_call":$.push({type:"tool-call",toolCallId:f.id,toolName:"image_generation",input:"{}",providerExecuted:!0}),$.push({type:"tool-result",toolCallId:f.id,toolName:"image_generation",result:{result:f.result},providerExecuted:!0});break;case"local_shell_call":$.push({type:"tool-call",toolCallId:f.call_id,toolName:"local_shell",input:JSON.stringify({action:f.action}),providerMetadata:{openai:{itemId:f.id}}});break;case"message":for(let U of f.content){i.providerOptions?.openai?.logprobs&&U.logprobs&&w.push(U.logprobs),$.push({type:"text",text:U.text,providerMetadata:{openai:{itemId:f.id}}});for(let z of U.annotations)z.type==="url_citation"?$.push({type:"source",sourceType:"url",id:(n=this.config).generateId?.call(n)??Qi(),url:z.url,title:z.title}):z.type==="file_citation"&&$.push({type:"source",sourceType:"document",id:(r=this.config).generateId?.call(r)??Qi(),mediaType:"text/plain",title:z.quote??z.filename??"Document",filename:z.filename??z.file_id})}break;case"function_call":b=!0,$.push({type:"tool-call",toolCallId:f.call_id,toolName:f.name,input:f.arguments,providerMetadata:{openai:{itemId:f.id}}});break;case"web_search_call":$.push({type:"tool-call",toolCallId:f.id,toolName:c??"web_search",input:JSON.stringify({action:f.action}),providerExecuted:!0}),$.push({type:"tool-result",toolCallId:f.id,toolName:c??"web_search",result:{status:f.status},providerExecuted:!0});break;case"computer_call":$.push({type:"tool-call",toolCallId:f.id,toolName:"computer_use",input:"",providerExecuted:!0}),$.push({type:"tool-result",toolCallId:f.id,toolName:"computer_use",result:{type:"computer_use_tool_result",status:f.status||"completed"},providerExecuted:!0});break;case"file_search_call":$.push({type:"tool-call",toolCallId:f.id,toolName:"file_search",input:"{}",providerExecuted:!0}),$.push({type:"tool-result",toolCallId:f.id,toolName:"file_search",result:{queries:f.queries,results:f.results?.map((U)=>({attributes:U.attributes,fileId:U.file_id,filename:U.filename,score:U.score,text:U.text}))??null},providerExecuted:!0});break;case"code_interpreter_call":$.push({type:"tool-call",toolCallId:f.id,toolName:"code_interpreter",input:JSON.stringify({code:f.code,containerId:f.container_id}),providerExecuted:!0}),$.push({type:"tool-result",toolCallId:f.id,toolName:"code_interpreter",result:{outputs:f.outputs},providerExecuted:!0});break}let v={openai:{responseId:_.id}};return w.length>0&&(v.openai.logprobs=w),typeof _.service_tier=="string"&&(v.openai.serviceTier=_.service_tier),{content:$,finishReason:x6({finishReason:_.incomplete_details?.reason,hasFunctionCall:b}),usage:{inputTokens:_.usage.input_tokens,outputTokens:_.usage.output_tokens,totalTokens:_.usage.input_tokens+_.usage.output_tokens,reasoningTokens:_.usage.output_tokens_details?.reasoning_tokens??void 0,cachedInputTokens:_.usage.input_tokens_details?.cached_tokens??void 0},request:{body:u},response:{id:_.id,timestamp:new Date(_.created_at*1000),modelId:_.model,headers:h,body:l},providerMetadata:v,warnings:t}}async doStream(i){let{args:n,warnings:r,webSearchToolName:u}=await this.getArgs(i),{responseHeaders:t,value:c}=await fi({url:this.config.url({path:"/responses",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),body:{...n,stream:!0},failedResponseHandler:hn,successfulResponseHandler:Vt(RI),abortSignal:i.abortSignal,fetch:this.config.fetch}),g=this,h="unknown",_={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},l=[],$=null,w={},b=!1,v={},f;return{stream:c.pipeThrough(new TransformStream({start(U){U.enqueue({type:"stream-start",warnings:r})},transform(U,z){var J,N,j;if(i.includeRawChunks&&z.enqueue({type:"raw",rawValue:U.rawValue}),!U.success){h="error",z.enqueue({type:"error",error:U.error});return}let O=U.value;if(tj(O))O.item.type==="function_call"?(w[O.output_index]={toolName:O.item.name,toolCallId:O.item.call_id},z.enqueue({type:"tool-input-start",id:O.item.call_id,toolName:O.item.name})):O.item.type==="web_search_call"?(w[O.output_index]={toolName:u??"web_search",toolCallId:O.item.id},z.enqueue({type:"tool-input-start",id:O.item.id,toolName:u??"web_search"})):O.item.type==="computer_call"?(w[O.output_index]={toolName:"computer_use",toolCallId:O.item.id},z.enqueue({type:"tool-input-start",id:O.item.id,toolName:"computer_use"})):O.item.type==="code_interpreter_call"?(w[O.output_index]={toolName:"code_interpreter",toolCallId:O.item.id,codeInterpreter:{containerId:O.item.container_id}},z.enqueue({type:"tool-input-start",id:O.item.id,toolName:"code_interpreter"}),z.enqueue({type:"tool-input-delta",id:O.item.id,delta:`{"containerId":"${O.item.container_id}","code":"`})):O.item.type==="file_search_call"?z.enqueue({type:"tool-call",toolCallId:O.item.id,toolName:"file_search",input:"{}",providerExecuted:!0}):O.item.type==="image_generation_call"?z.enqueue({type:"tool-call",toolCallId:O.item.id,toolName:"image_generation",input:"{}",providerExecuted:!0}):O.item.type==="message"?z.enqueue({type:"text-start",id:O.item.id,providerMetadata:{openai:{itemId:O.item.id}}}):nY(O)&&(v[O.item.id]={encryptedContent:O.item.encrypted_content,summaryParts:[0]},z.enqueue({type:"reasoning-start",id:`${O.item.id}:0`,providerMetadata:{openai:{itemId:O.item.id,reasoningEncryptedContent:O.item.encrypted_content??null}}}));else if(nj(O)){if(O.item.type==="function_call")w[O.output_index]=void 0,b=!0,z.enqueue({type:"tool-input-end",id:O.item.call_id}),z.enqueue({type:"tool-call",toolCallId:O.item.call_id,toolName:O.item.name,input:O.item.arguments,providerMetadata:{openai:{itemId:O.item.id}}});else if(O.item.type==="web_search_call")w[O.output_index]=void 0,z.enqueue({type:"tool-input-end",id:O.item.id}),z.enqueue({type:"tool-call",toolCallId:O.item.id,toolName:"web_search",input:JSON.stringify({action:O.item.action}),providerExecuted:!0}),z.enqueue({type:"tool-result",toolCallId:O.item.id,toolName:"web_search",result:{status:O.item.status},providerExecuted:!0});else if(O.item.type==="computer_call")w[O.output_index]=void 0,z.enqueue({type:"tool-input-end",id:O.item.id}),z.enqueue({type:"tool-call",toolCallId:O.item.id,toolName:"computer_use",input:"",providerExecuted:!0}),z.enqueue({type:"tool-result",toolCallId:O.item.id,toolName:"computer_use",result:{type:"computer_use_tool_result",status:O.item.status||"completed"},providerExecuted:!0});else if(O.item.type==="file_search_call")w[O.output_index]=void 0,z.enqueue({type:"tool-result",toolCallId:O.item.id,toolName:"file_search",result:{queries:O.item.queries,results:O.item.results?.map((W)=>({attributes:W.attributes,fileId:W.file_id,filename:W.filename,score:W.score,text:W.text}))??null},providerExecuted:!0});else if(O.item.type==="code_interpreter_call")w[O.output_index]=void 0,z.enqueue({type:"tool-result",toolCallId:O.item.id,toolName:"code_interpreter",result:{outputs:O.item.outputs},providerExecuted:!0});else if(O.item.type==="image_generation_call")z.enqueue({type:"tool-result",toolCallId:O.item.id,toolName:"image_generation",result:{result:O.item.result},providerExecuted:!0});else if(O.item.type==="local_shell_call")w[O.output_index]=void 0,z.enqueue({type:"tool-call",toolCallId:O.item.call_id,toolName:"local_shell",input:JSON.stringify({action:{type:"exec",command:O.item.action.command,timeoutMs:O.item.action.timeout_ms,user:O.item.action.user,workingDirectory:O.item.action.working_directory,env:O.item.action.env}}),providerMetadata:{openai:{itemId:O.item.id}}});else if(O.item.type==="message")z.enqueue({type:"text-end",id:O.item.id});else if(eI(O)){let W=v[O.item.id];for(let E of W.summaryParts)z.enqueue({type:"reasoning-end",id:`${O.item.id}:${E}`,providerMetadata:{openai:{itemId:O.item.id,reasoningEncryptedContent:O.item.encrypted_content??null}}});delete v[O.item.id]}}else if(aI(O)){let W=w[O.output_index];W!=null&&z.enqueue({type:"tool-input-delta",id:W.toolCallId,delta:O.delta})}else if(sI(O)){let W=w[O.output_index];W!=null&&z.enqueue({type:"tool-input-delta",id:W.toolCallId,delta:JSON.stringify(O.delta).slice(1,-1)})}else if(iY(O)){let W=w[O.output_index];W!=null&&(z.enqueue({type:"tool-input-delta",id:W.toolCallId,delta:\'"}\'}),z.enqueue({type:"tool-input-end",id:W.toolCallId}),z.enqueue({type:"tool-call",toolCallId:W.toolCallId,toolName:"code_interpreter",input:JSON.stringify({code:O.code,containerId:W.codeInterpreter.containerId}),providerExecuted:!0}))}else dI(O)?($=O.response.id,z.enqueue({type:"response-metadata",id:O.response.id,timestamp:new Date(O.response.created_at*1000),modelId:O.response.model})):ZI(O)?(z.enqueue({type:"text-delta",id:O.item_id,delta:O.delta}),i.providerOptions?.openai?.logprobs&&O.logprobs&&l.push(O.logprobs)):rY(O)?O.summary_index>0&&((J=v[O.item_id])==null||J.summaryParts.push(O.summary_index),z.enqueue({type:"reasoning-start",id:`${O.item_id}:${O.summary_index}`,providerMetadata:{openai:{itemId:O.item_id,reasoningEncryptedContent:v[O.item_id]?.encryptedContent??null}}})):uY(O)?z.enqueue({type:"reasoning-delta",id:`${O.item_id}:${O.summary_index}`,delta:O.delta,providerMetadata:{openai:{itemId:O.item_id}}}):pI(O)?(h=x6({finishReason:O.response.incomplete_details?.reason,hasFunctionCall:b}),_.inputTokens=O.response.usage.input_tokens,_.outputTokens=O.response.usage.output_tokens,_.totalTokens=O.response.usage.input_tokens+O.response.usage.output_tokens,_.reasoningTokens=O.response.usage.output_tokens_details?.reasoning_tokens??void 0,_.cachedInputTokens=O.response.usage.input_tokens_details?.cached_tokens??void 0,typeof O.response.service_tier=="string"&&(f=O.response.service_tier)):tY(O)?O.annotation.type==="url_citation"?z.enqueue({type:"source",sourceType:"url",id:(N=g.config).generateId?.call(N)??Qi(),url:O.annotation.url,title:O.annotation.title}):O.annotation.type==="file_citation"&&z.enqueue({type:"source",sourceType:"document",id:(j=g.config).generateId?.call(j)??Qi(),mediaType:"text/plain",title:O.annotation.quote??O.annotation.filename??"Document",filename:O.annotation.filename??O.annotation.file_id}):cY(O)&&z.enqueue({type:"error",error:O})},flush(U){let z={openai:{responseId:$}};l.length>0&&(z.openai.logprobs=l),f!==void 0&&(z.openai.serviceTier=f),U.enqueue({type:"finish",finishReason:h,usage:_,providerMetadata:z})}})),request:{body:n},response:{headers:t}}}},ij=o.object({input_tokens:o.number(),input_tokens_details:o.object({cached_tokens:o.number().nullish()}).nullish(),output_tokens:o.number(),output_tokens_details:o.object({reasoning_tokens:o.number().nullish()}).nullish()}),AI=o.object({type:o.literal("response.output_text.delta"),item_id:o.string(),delta:o.string(),logprobs:sO.nullish()}),BI=o.object({type:o.literal("error"),code:o.string(),message:o.string(),param:o.string().nullish(),sequence_number:o.number()}),KI=o.object({type:o.enum(["response.completed","response.incomplete"]),response:o.object({incomplete_details:o.object({reason:o.string()}).nullish(),usage:ij,service_tier:o.string().nullish()})}),VI=o.object({type:o.literal("response.created"),response:o.object({id:o.string(),created_at:o.number(),model:o.string(),service_tier:o.string().nullish()})}),MI=o.object({type:o.literal("response.output_item.added"),output_index:o.number(),item:o.discriminatedUnion("type",[o.object({type:o.literal("message"),id:o.string()}),o.object({type:o.literal("reasoning"),id:o.string(),encrypted_content:o.string().nullish()}),o.object({type:o.literal("function_call"),id:o.string(),call_id:o.string(),name:o.string(),arguments:o.string()}),o.object({type:o.literal("web_search_call"),id:o.string(),status:o.string(),action:o.object({type:o.literal("search"),query:o.string().optional()}).nullish()}),o.object({type:o.literal("computer_call"),id:o.string(),status:o.string()}),o.object({type:o.literal("file_search_call"),id:o.string()}),o.object({type:o.literal("image_generation_call"),id:o.string()}),o.object({type:o.literal("code_interpreter_call"),id:o.string(),container_id:o.string(),code:o.string().nullable(),outputs:o.array(o.discriminatedUnion("type",[o.object({type:o.literal("logs"),logs:o.string()}),o.object({type:o.literal("image"),url:o.string()})])).nullable(),status:o.string()})])}),xI=o.object({type:o.literal("response.output_item.done"),output_index:o.number(),item:o.discriminatedUnion("type",[o.object({type:o.literal("message"),id:o.string()}),o.object({type:o.literal("reasoning"),id:o.string(),encrypted_content:o.string().nullish()}),o.object({type:o.literal("function_call"),id:o.string(),call_id:o.string(),name:o.string(),arguments:o.string(),status:o.literal("completed")}),eO,dO,RO,ZO,pO,o.object({type:o.literal("computer_call"),id:o.string(),status:o.literal("completed")})])}),FI=o.object({type:o.literal("response.function_call_arguments.delta"),item_id:o.string(),output_index:o.number(),delta:o.string()}),PI=o.object({type:o.literal("response.code_interpreter_call_code.delta"),item_id:o.string(),output_index:o.number(),delta:o.string()}),yI=o.object({type:o.literal("response.code_interpreter_call_code.done"),item_id:o.string(),output_index:o.number(),code:o.string()}),TI=o.object({type:o.literal("response.output_text.annotation.added"),annotation:o.discriminatedUnion("type",[o.object({type:o.literal("url_citation"),url:o.string(),title:o.string()}),o.object({type:o.literal("file_citation"),file_id:o.string(),filename:o.string().nullish(),index:o.number().nullish(),start_index:o.number().nullish(),end_index:o.number().nullish(),quote:o.string().nullish()})])}),kI=o.object({type:o.literal("response.reasoning_summary_part.added"),item_id:o.string(),summary_index:o.number()}),CI=o.object({type:o.literal("response.reasoning_summary_text.delta"),item_id:o.string(),summary_index:o.number(),delta:o.string()}),RI=o.union([AI,KI,VI,MI,xI,FI,PI,yI,TI,kI,CI,BI,o.object({type:o.string()}).loose()]);function ZI(i){return i.type==="response.output_text.delta"}function nj(i){return i.type==="response.output_item.done"}function eI(i){return nj(i)&&i.item.type==="reasoning"}function pI(i){return i.type==="response.completed"||i.type==="response.incomplete"}function dI(i){return i.type==="response.created"}function aI(i){return i.type==="response.function_call_arguments.delta"}function sI(i){return i.type==="response.code_interpreter_call_code.delta"}function iY(i){return i.type==="response.code_interpreter_call_code.done"}function tj(i){return i.type==="response.output_item.added"}function nY(i){return tj(i)&&i.item.type==="reasoning"}function tY(i){return i.type==="response.output_text.annotation.added"}function rY(i){return i.type==="response.reasoning_summary_part.added"}function uY(i){return i.type==="response.reasoning_summary_text.delta"}function cY(i){return i.type==="error"}function oY(i){let n=i.startsWith("o3")||i.startsWith("o4-mini")||i.startsWith("gpt-5")&&!i.startsWith("gpt-5-chat"),r=i.startsWith("gpt-4")||i.startsWith("gpt-5-mini")||i.startsWith("gpt-5")&&!i.startsWith("gpt-5-nano")&&!i.startsWith("gpt-5-chat")||i.startsWith("o3")||i.startsWith("o4-mini"),u={requiredAutoTruncation:!1,systemMessageMode:"system",supportsFlexProcessing:n,supportsPriorityProcessing:r};return i.startsWith("gpt-5-chat")?{...u,isReasoningModel:!1}:i.startsWith("o")||i.startsWith("gpt-5")||i.startsWith("codex-")||i.startsWith("computer-use")?i.startsWith("o1-mini")||i.startsWith("o1-preview")?{...u,isReasoningModel:!0,systemMessageMode:"remove"}:{...u,isReasoningModel:!0,systemMessageMode:"developer"}:{...u,isReasoningModel:!1}}var gY=o.object({include:o.array(o.enum(["reasoning.encrypted_content","file_search_call.results","message.output_text.logprobs"])).nullish(),instructions:o.string().nullish(),logprobs:o.union([o.boolean(),o.number().min(1).max(aO)]).optional(),maxToolCalls:o.number().nullish(),metadata:o.any().nullish(),parallelToolCalls:o.boolean().nullish(),previousResponseId:o.string().nullish(),promptCacheKey:o.string().nullish(),reasoningEffort:o.string().nullish(),reasoningSummary:o.string().nullish(),safetyIdentifier:o.string().nullish(),serviceTier:o.enum(["auto","flex","priority"]).nullish(),store:o.boolean().nullish(),strictJsonSchema:o.boolean().nullish(),textVerbosity:o.enum(["low","medium","high"]).nullish(),user:o.string().nullish()}),hY=o.object({instructions:o.string().nullish(),speed:o.number().min(0.25).max(4).default(1).nullish()}),_Y=class{constructor(i,n){this.modelId=i,this.config=n,this.specificationVersion="v2"}get provider(){return this.config.provider}async getArgs({text:i,voice:n="alloy",outputFormat:r="mp3",speed:u,instructions:t,language:c,providerOptions:g}){let h=[],_=await Hi({provider:"openai",providerOptions:g,schema:hY}),l={model:this.modelId,input:i,voice:n,response_format:"mp3",speed:u,instructions:t};if(r&&(["mp3","opus","aac","flac","wav","pcm"].includes(r)?l.response_format=r:h.push({type:"unsupported-setting",setting:"outputFormat",details:`Unsupported output format: ${r}. Using mp3 instead.`})),_){let $={};for(let w in $){let b=$[w];b!==void 0&&(l[w]=b)}}return c&&h.push({type:"unsupported-setting",setting:"language",details:`OpenAI speech models do not support language selection. Language parameter "${c}" was ignored.`}),{requestBody:l,warnings:h}}async doGenerate(i){var n;let r=(n=this.config._internal)?.currentDate?.call(n)??new Date,{requestBody:u,warnings:t}=await this.getArgs(i),{value:c,responseHeaders:g,rawValue:h}=await fi({url:this.config.url({path:"/audio/speech",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),body:u,failedResponseHandler:hn,successfulResponseHandler:KX(),abortSignal:i.abortSignal,fetch:this.config.fetch});return{audio:c,warnings:t,request:{body:JSON.stringify(u)},response:{timestamp:r,modelId:this.modelId,headers:g,body:h}}}},lY=o.object({include:o.array(o.string()).optional(),language:o.string().optional(),prompt:o.string().optional(),temperature:o.number().min(0).max(1).default(0).optional(),timestampGranularities:o.array(o.enum(["word","segment"])).default(["segment"]).optional()}),F6={afrikaans:"af",arabic:"ar",armenian:"hy",azerbaijani:"az",belarusian:"be",bosnian:"bs",bulgarian:"bg",catalan:"ca",chinese:"zh",croatian:"hr",czech:"cs",danish:"da",dutch:"nl",english:"en",estonian:"et",finnish:"fi",french:"fr",galician:"gl",german:"de",greek:"el",hebrew:"he",hindi:"hi",hungarian:"hu",icelandic:"is",indonesian:"id",italian:"it",japanese:"ja",kannada:"kn",kazakh:"kk",korean:"ko",latvian:"lv",lithuanian:"lt",macedonian:"mk",malay:"ms",marathi:"mr",maori:"mi",nepali:"ne",norwegian:"no",persian:"fa",polish:"pl",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"sr",slovak:"sk",slovenian:"sl",spanish:"es",swahili:"sw",swedish:"sv",tagalog:"tl",tamil:"ta",thai:"th",turkish:"tr",ukrainian:"uk",urdu:"ur",vietnamese:"vi",welsh:"cy"},$Y=class{constructor(i,n){this.modelId=i,this.config=n,this.specificationVersion="v2"}get provider(){return this.config.provider}async getArgs({audio:i,mediaType:n,providerOptions:r}){let u=[],t=await Hi({provider:"openai",providerOptions:r,schema:lY}),c=new FormData,g=i instanceof Uint8Array?new Blob([i]):new Blob([xX(i)]);c.append("model",this.modelId);let h=JX(n);if(c.append("file",new File([g],"audio",{type:n}),`audio.${h}`),t){let _={include:t.include,language:t.language,prompt:t.prompt,response_format:["gpt-4o-transcribe","gpt-4o-mini-transcribe"].includes(this.modelId)?"json":"verbose_json",temperature:t.temperature,timestamp_granularities:t.timestampGranularities};for(let[l,$]of Object.entries(_))if($!=null)if(Array.isArray($))for(let w of $)c.append(`${l}[]`,String(w));else c.append(l,String($))}return{formData:c,warnings:u}}async doGenerate(i){var n;let r=(n=this.config._internal)?.currentDate?.call(n)??new Date,{formData:u,warnings:t}=await this.getArgs(i),{value:c,responseHeaders:g,rawValue:h}=await BX({url:this.config.url({path:"/audio/transcriptions",modelId:this.modelId}),headers:Ui(this.config.headers(),i.headers),formData:u,failedResponseHandler:hn,successfulResponseHandler:Vi(wY),abortSignal:i.abortSignal,fetch:this.config.fetch}),_=c.language!=null&&c.language in F6?F6[c.language]:void 0;return{text:c.text,segments:c.segments?.map((l)=>({text:l.text,startSecond:l.start,endSecond:l.end}))??c.words?.map((l)=>({text:l.word,startSecond:l.start,endSecond:l.end}))??[],language:_,durationInSeconds:c.duration??void 0,warnings:t,response:{timestamp:r,modelId:this.modelId,headers:g,body:h}}}},wY=o.object({text:o.string(),language:o.string().nullish(),duration:o.number().nullish(),words:o.array(o.object({word:o.string(),start:o.number(),end:o.number()})).nullish(),segments:o.array(o.object({id:o.number(),seek:o.number(),start:o.number(),end:o.number(),text:o.string(),tokens:o.array(o.number()),temperature:o.number(),avg_logprob:o.number(),compression_ratio:o.number(),no_speech_prob:o.number()})).nullish()}),bY="2.0.42";function vY(i={}){let n=jo(DX({settingValue:i.baseURL,environmentVariableName:"OPENAI_BASE_URL"}))??"https://api.openai.com/v1",r=i.name??"openai",u=()=>wu({Authorization:`Bearer ${Oo({apiKey:i.apiKey,environmentVariableName:"OPENAI_API_KEY",description:"OpenAI"})}`,"OpenAI-Organization":i.organization,"OpenAI-Project":i.project,...i.headers},`ai-sdk/openai/${bY}`),t=(v)=>new ZL(v,{provider:`${r}.chat`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch}),c=(v)=>new tI(v,{provider:`${r}.completion`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch}),g=(v)=>new oI(v,{provider:`${r}.embedding`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch}),h=(v)=>new lI(v,{provider:`${r}.image`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch}),_=(v)=>new $Y(v,{provider:`${r}.transcription`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch}),l=(v)=>new _Y(v,{provider:`${r}.speech`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch}),$=(v)=>{if(new.target)throw Error("The OpenAI model function cannot be called with the new keyword.");return w(v)},w=(v)=>new SI(v,{provider:`${r}.responses`,url:({path:f})=>`${n}${f}`,headers:u,fetch:i.fetch,fileIdPrefixes:["file-"]}),b=function(v){return $(v)};return b.languageModel=$,b.chat=t,b.completion=c,b.responses=w,b.embedding=g,b.textEmbedding=g,b.textEmbeddingModel=g,b.image=h,b.imageModel=h,b.transcription=_,b.transcriptionModel=_,b.speech=l,b.speechModel=l,b.tools=II,b}vY(),o.object({user:o.string().optional(),reasoningEffort:o.string().optional()});var fY={errorSchema:o.object({error:o.object({message:o.string(),type:o.string().nullish(),param:o.any().nullish(),code:o.union([o.string(),o.number()]).nullish()})}),errorToMessage:(i)=>i.error.message},OY=o.object({prompt_tokens:o.number().nullish(),completion_tokens:o.number().nullish(),total_tokens:o.number().nullish(),prompt_tokens_details:o.object({cached_tokens:o.number().nullish()}).nullish(),completion_tokens_details:o.object({reasoning_tokens:o.number().nullish(),accepted_prediction_tokens:o.number().nullish(),rejected_prediction_tokens:o.number().nullish()}).nullish()}).nullish();o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({message:o.object({role:o.literal("assistant").nullish(),content:o.string().nullish(),reasoning_content:o.string().nullish(),reasoning:o.string().nullish(),tool_calls:o.array(o.object({id:o.string().nullish(),function:o.object({name:o.string(),arguments:o.string()})})).nullish()}),finish_reason:o.string().nullish()})),usage:OY}),o.object({echo:o.boolean().optional(),logitBias:o.record(o.string(),o.number()).optional(),suffix:o.string().optional(),user:o.string().optional()});var jY=o.object({prompt_tokens:o.number(),completion_tokens:o.number(),total_tokens:o.number()});o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({text:o.string(),finish_reason:o.string()})),usage:jY.nullish()}),o.object({dimensions:o.number().optional(),user:o.string().optional()}),o.object({data:o.array(o.object({embedding:o.array(o.number())})),usage:o.object({prompt_tokens:o.number()}).nullish(),providerMetadata:o.record(o.string(),o.record(o.string(),o.any())).optional()});var UY=class{constructor(i,n){this.modelId=i,this.config=n,this.specificationVersion="v2",this.maxImagesPerCall=10}get provider(){return this.config.provider}async doGenerate({prompt:i,n,size:r,aspectRatio:u,seed:t,providerOptions:c,headers:g,abortSignal:h}){var _;let l=[];u!=null&&l.push({type:"unsupported-setting",setting:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."}),t!=null&&l.push({type:"unsupported-setting",setting:"seed"});let $=(_=this.config._internal)?.currentDate?.call(_)??new Date,{value:w,responseHeaders:b}=await fi({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:Ui(this.config.headers(),g),body:{model:this.modelId,prompt:i,n,size:r,...c.openai??{},response_format:"b64_json"},failedResponseHandler:bu(this.config.errorStructure??fY),successfulResponseHandler:Vi(NY),abortSignal:h,fetch:this.config.fetch});return{images:w.data.map((v)=>v.b64_json),warnings:l,response:{timestamp:$,modelId:this.modelId,headers:b}}}},NY=o.object({data:o.array(o.object({b64_json:o.string()}))});function zY(i){let n=[],r=[];for(let{role:u,content:t}of i)switch(u){case"system":n.push({role:"system",content:t});break;case"user":if(t.length===1&&t[0].type==="text"){n.push({role:"user",content:t[0].text});break}n.push({role:"user",content:t.map((c)=>{switch(c.type){case"text":return{type:"text",text:c.text};case"file":if(c.mediaType.startsWith("image/")){let g=c.mediaType==="image/*"?"image/jpeg":c.mediaType;return{type:"image_url",image_url:{url:c.data instanceof URL?c.data.toString():`data:${g};base64,${pi(c.data)}`}}}else throw new oi({functionality:`file part media type ${c.mediaType}`})}})});break;case"assistant":{let c="",g=[];for(let h of t)switch(h.type){case"text":c+=h.text;break;case"tool-call":g.push({id:h.toolCallId,type:"function",function:{name:h.toolName,arguments:JSON.stringify(h.input)}});break}n.push({role:"assistant",content:c,tool_calls:g.length>0?g:void 0});break}case"tool":for(let c of t){let g=c.output,h;switch(g.type){case"text":case"error-text":h=g.value;break;case"content":case"json":case"error-json":h=JSON.stringify(g.value);break}n.push({role:"tool",tool_call_id:c.toolCallId,content:h})}break;default:throw Error(`Unsupported role: ${u}`)}return{messages:n,warnings:r}}function P6({id:i,model:n,created:r}){return{id:i??void 0,modelId:n??void 0,timestamp:r==null?void 0:new Date(r*1000)}}function y6(i){switch(i){case"stop":return"stop";case"length":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"unknown"}}var WY=o.object({type:o.literal("web"),country:o.string().length(2).optional(),excludedWebsites:o.array(o.string()).max(5).optional(),allowedWebsites:o.array(o.string()).max(5).optional(),safeSearch:o.boolean().optional()}),DY=o.object({type:o.literal("x"),excludedXHandles:o.array(o.string()).optional(),includedXHandles:o.array(o.string()).optional(),postFavoriteCount:o.number().int().optional(),postViewCount:o.number().int().optional(),xHandles:o.array(o.string()).optional()}),JY=o.object({type:o.literal("news"),country:o.string().length(2).optional(),excludedWebsites:o.array(o.string()).max(5).optional(),safeSearch:o.boolean().optional()}),EY=o.object({type:o.literal("rss"),links:o.array(o.string().url()).max(1)}),HY=o.discriminatedUnion("type",[WY,DY,JY,EY]),GY=o.object({reasoningEffort:o.enum(["low","high"]).optional(),searchParameters:o.object({mode:o.enum(["off","auto","on"]),returnCitations:o.boolean().optional(),fromDate:o.string().optional(),toDate:o.string().optional(),maxSearchResults:o.number().min(1).max(50).optional(),sources:o.array(HY).optional()}).optional()}),rj=o.object({error:o.object({message:o.string(),type:o.string().nullish(),param:o.any().nullish(),code:o.union([o.string(),o.number()]).nullish()})}),T6=bu({errorSchema:rj,errorToMessage:(i)=>i.error.message});function qY({tools:i,toolChoice:n}){i=i?.length?i:void 0;let r=[];if(i==null)return{tools:void 0,toolChoice:void 0,toolWarnings:r};let u=[];for(let c of i)c.type==="provider-defined"?r.push({type:"unsupported-tool",tool:c}):u.push({type:"function",function:{name:c.name,description:c.description,parameters:c.inputSchema}});if(n==null)return{tools:u,toolChoice:void 0,toolWarnings:r};let t=n.type;switch(t){case"auto":case"none":return{tools:u,toolChoice:t,toolWarnings:r};case"required":return{tools:u,toolChoice:"required",toolWarnings:r};case"tool":return{tools:u,toolChoice:{type:"function",function:{name:n.toolName}},toolWarnings:r};default:throw new oi({functionality:`tool choice type: ${t}`})}}var XY=class{constructor(i,n){this.specificationVersion="v2",this.supportedUrls={"image/*":[/^https?:\\/\\/.*$/]},this.modelId=i,this.config=n}get provider(){return this.config.provider}async getArgs({prompt:i,maxOutputTokens:n,temperature:r,topP:u,topK:t,frequencyPenalty:c,presencePenalty:g,stopSequences:h,seed:_,responseFormat:l,providerOptions:$,tools:w,toolChoice:b}){let v=[],f=await Hi({provider:"xai",providerOptions:$,schema:GY})??{};t!=null&&v.push({type:"unsupported-setting",setting:"topK"}),c!=null&&v.push({type:"unsupported-setting",setting:"frequencyPenalty"}),g!=null&&v.push({type:"unsupported-setting",setting:"presencePenalty"}),h!=null&&v.push({type:"unsupported-setting",setting:"stopSequences"}),l!=null&&l.type==="json"&&l.schema!=null&&v.push({type:"unsupported-setting",setting:"responseFormat",details:"JSON response format schema is not supported"});let{messages:U,warnings:z}=zY(i);v.push(...z);let{tools:J,toolChoice:N,toolWarnings:j}=qY({tools:w,toolChoice:b});return v.push(...j),{args:{model:this.modelId,max_tokens:n,temperature:r,top_p:u,seed:_,reasoning_effort:f.reasoningEffort,response_format:l?.type==="json"?l.schema==null?{type:"json_object"}:{type:"json_schema",json_schema:{name:l.name??"response",schema:l.schema,strict:!0}}:void 0,search_parameters:f.searchParameters?{mode:f.searchParameters.mode,return_citations:f.searchParameters.returnCitations,from_date:f.searchParameters.fromDate,to_date:f.searchParameters.toDate,max_search_results:f.searchParameters.maxSearchResults,sources:f.searchParameters.sources?.map((O)=>({type:O.type,...O.type==="web"&&{country:O.country,excluded_websites:O.excludedWebsites,allowed_websites:O.allowedWebsites,safe_search:O.safeSearch},...O.type==="x"&&{excluded_x_handles:O.excludedXHandles,included_x_handles:O.includedXHandles??O.xHandles,post_favorite_count:O.postFavoriteCount,post_view_count:O.postViewCount},...O.type==="news"&&{country:O.country,excluded_websites:O.excludedWebsites,safe_search:O.safeSearch},...O.type==="rss"&&{links:O.links}}))}:void 0,messages:U,tools:J,tool_choice:N},warnings:v}}async doGenerate(i){let{args:n,warnings:r}=await this.getArgs(i),{responseHeaders:u,value:t,rawValue:c}=await fi({url:`${this.config.baseURL??"https://api.x.ai/v1"}/chat/completions`,headers:Ui(this.config.headers(),i.headers),body:n,failedResponseHandler:T6,successfulResponseHandler:Vi(LY),abortSignal:i.abortSignal,fetch:this.config.fetch}),g=t.choices[0],h=[];if(g.message.content!=null&&g.message.content.length>0){let _=g.message.content,l=n.messages[n.messages.length-1];l?.role==="assistant"&&_===l.content&&(_=""),_.length>0&&h.push({type:"text",text:_})}if(g.message.reasoning_content!=null&&g.message.reasoning_content.length>0&&h.push({type:"reasoning",text:g.message.reasoning_content}),g.message.tool_calls!=null)for(let _ of g.message.tool_calls)h.push({type:"tool-call",toolCallId:_.id,toolName:_.function.name,input:_.function.arguments});if(t.citations!=null)for(let _ of t.citations)h.push({type:"source",sourceType:"url",id:this.config.generateId(),url:_});return{content:h,finishReason:y6(g.finish_reason),usage:{inputTokens:t.usage.prompt_tokens,outputTokens:t.usage.completion_tokens,totalTokens:t.usage.total_tokens,reasoningTokens:t.usage.completion_tokens_details?.reasoning_tokens??void 0},request:{body:n},response:{...P6(t),headers:u,body:c},warnings:r}}async doStream(i){let{args:n,warnings:r}=await this.getArgs(i),u={...n,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:t,value:c}=await fi({url:`${this.config.baseURL??"https://api.x.ai/v1"}/chat/completions`,headers:Ui(this.config.headers(),i.headers),body:u,failedResponseHandler:T6,successfulResponseHandler:Vt(IY),abortSignal:i.abortSignal,fetch:this.config.fetch}),g="unknown",h={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},_=!0,l={},$={},w=this;return{stream:c.pipeThrough(new TransformStream({start(b){b.enqueue({type:"stream-start",warnings:r})},transform(b,v){if(i.includeRawChunks&&v.enqueue({type:"raw",rawValue:b.rawValue}),!b.success){v.enqueue({type:"error",error:b.error});return}let f=b.value;if(_&&=(v.enqueue({type:"response-metadata",...P6(f)}),!1),f.citations!=null)for(let N of f.citations)v.enqueue({type:"source",sourceType:"url",id:w.config.generateId(),url:N});f.usage!=null&&(h.inputTokens=f.usage.prompt_tokens,h.outputTokens=f.usage.completion_tokens,h.totalTokens=f.usage.total_tokens,h.reasoningTokens=f.usage.completion_tokens_details?.reasoning_tokens??void 0);let U=f.choices[0];if(U?.finish_reason!=null&&(g=y6(U.finish_reason)),U?.delta==null)return;let{delta:z,index:J}=U;if(z.content!=null&&z.content.length>0){let N=z.content,j=u.messages[u.messages.length-1];if(j?.role==="assistant"&&N===j.content)return;let O=`text-${f.id||J}`;l[O]??(l[O]={type:"text"},v.enqueue({type:"text-start",id:O})),v.enqueue({type:"text-delta",id:O,delta:N})}if(z.reasoning_content!=null&&z.reasoning_content.length>0){let N=`reasoning-${f.id||J}`;if($[N]===z.reasoning_content)return;$[N]=z.reasoning_content,l[N]??(l[N]={type:"reasoning"},v.enqueue({type:"reasoning-start",id:N})),v.enqueue({type:"reasoning-delta",id:N,delta:z.reasoning_content})}if(z.tool_calls!=null)for(let N of z.tool_calls){let j=N.id;v.enqueue({type:"tool-input-start",id:j,toolName:N.function.name}),v.enqueue({type:"tool-input-delta",id:j,delta:N.function.arguments}),v.enqueue({type:"tool-input-end",id:j}),v.enqueue({type:"tool-call",toolCallId:j,toolName:N.function.name,input:N.function.arguments})}},flush(b){for(let[v,f]of Object.entries(l))b.enqueue({type:f.type==="text"?"text-end":"reasoning-end",id:v});b.enqueue({type:"finish",finishReason:g,usage:h})}})),request:{body:u},response:{headers:t}}}},uj=o.object({prompt_tokens:o.number(),completion_tokens:o.number(),total_tokens:o.number(),completion_tokens_details:o.object({reasoning_tokens:o.number().nullish()}).nullish()}),LY=o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({message:o.object({role:o.literal("assistant"),content:o.string().nullish(),reasoning_content:o.string().nullish(),tool_calls:o.array(o.object({id:o.string(),type:o.literal("function"),function:o.object({name:o.string(),arguments:o.string()})})).nullish()}),index:o.number(),finish_reason:o.string().nullish()})),object:o.literal("chat.completion"),usage:uj,citations:o.array(o.string().url()).nullish()}),IY=o.object({id:o.string().nullish(),created:o.number().nullish(),model:o.string().nullish(),choices:o.array(o.object({delta:o.object({role:o.enum(["assistant"]).optional(),content:o.string().nullish(),reasoning_content:o.string().nullish(),tool_calls:o.array(o.object({id:o.string(),type:o.literal("function"),function:o.object({name:o.string(),arguments:o.string()})})).nullish()}),finish_reason:o.string().nullish(),index:o.number()})),usage:uj.nullish(),citations:o.array(o.string().url()).nullish()}),YY="2.0.23",QY={errorSchema:rj,errorToMessage:(i)=>i.error.message};function mY(i={}){let n=jo(i.baseURL??"https://api.x.ai/v1"),r=()=>wu({Authorization:`Bearer ${Oo({apiKey:i.apiKey,environmentVariableName:"XAI_API_KEY",description:"xAI API key"})}`,...i.headers},`ai-sdk/xai/${YY}`),u=(g)=>new XY(g,{provider:"xai.chat",baseURL:n,headers:r,generateId:Qi,fetch:i.fetch}),t=(g)=>new UY(g,{provider:"xai.image",url:({path:h})=>`${n}${h}`,headers:r,fetch:i.fetch,errorStructure:QY}),c=(g)=>u(g);return c.languageModel=u,c.chat=u,c.textEmbeddingModel=(g)=>{throw new U0({modelId:g,modelType:"textEmbeddingModel"})},c.imageModel=t,c.image=t,c}mY();var cj="BLINK_API_URL";function gj(){let i,n=()=>{return new Ru({baseURL:process.env[G0],authToken:i})},r=process.env[zo]?parseInt(process.env[zo]):12345,u={get(h){return n().getStorage(h)},set(h,_){return n().setStorage(h,_)},delete(h){return n().deleteStorage(h)},list(h,_){return n().listStorage(h,_)}},t={traces(h){return n().proxyOtlpTraces(h)}},c={upsert:async(h)=>{let _=await n().upsertChat(JSON.stringify(h));return{created:_.created,id:_.id,createdAt:_.created_at}},delete:async(h)=>{await n().deleteChat(h)},deleteMessages:async(h,_)=>{await n().deleteMessages(h,_)},get:async(h)=>{let _=await n().getChat(h);if(!_)return;return{id:_.id,createdAt:_.createdAt}},getMessages:async(h)=>{return(await n().getMessages(h)).map((l)=>({id:l.id,role:l.role,parts:l.parts,metadata:l.metadata}))},start:async(h)=>{await n().startChat(h)},stop:async(h)=>{await n().stopChat(h)},sendMessages:async(h,_,l)=>{await n().sendMessages(h,{messages:_.map(($)=>({id:$.id,role:$.role,parts:$.parts,metadata:$.metadata})),behavior:l?.behavior??"enqueue"})}},g=SY(Gg((h)=>{return zf.fetch(h,{chat:c,store:u,otlp:t})}));return g.listen(r,"127.0.0.1"),process.env[cj]=`http://127.0.0.1:${r}`,{server:g,port:r,setAuthToken(h){i=h,process.env.BLINK_INVOCATION_AUTH_TOKEN=h}}}async function hj(i,n,r=!1){let u=process.env.PORT;process.env.PORT=n.toString();let t=oj.prototype.listen,c=new Promise((_,l)=>{oj.prototype.listen=function(...$){if(this.on("listening",()=>{_(void 0)}),this.on("error",(w)=>{l(w)}),r)this.unref();return t.apply(this,$)}});await import(i),process.env.PORT=u;let g=`http://127.0.0.1:${n}`,h=Gg((_)=>{let l=new URL(_.url),$=new URL(g);return $.pathname=l.pathname,$.search=l.search,fetch($.toString(),_)});return await c,h}var{setAuthToken:KY,server:VY}=gj();VY.unref();if(!process.env.ENTRYPOINT)throw new Error("developer error: ENTRYPOINT is not set");var E0=process.env.PORT?parseInt(process.env.PORT):12345,MY=await hj(BY(process.env.ENTRYPOINT),E0+1);AY.createServer((i,n)=>{KY(i.headers[H0]),MY(i,n)}).listen(E0,()=>{console.log(`Server is running on port ${E0}`)});\n'; diff --git a/packages/runtime/src/node/wrapper-node.ts b/packages/runtime/src/node/wrapper-node.ts new file mode 100644 index 0000000..c42cdb4 --- /dev/null +++ b/packages/runtime/src/node/wrapper-node.ts @@ -0,0 +1,27 @@ +// The purpose of this file is to wrap the Node.js runtime +// request/resposne handling in a way that is compatible with +// the Blink Agent exports. + +import { BlinkInvocationTokenHeader } from "@blink.so/runtime/types"; +import http from "http"; +import { resolve } from "node:path"; +import { startAgentServer, startInternalAPIServer } from "../server"; + +const { setAuthToken, server } = startInternalAPIServer(); +server.unref(); + +if (!process.env.ENTRYPOINT) { + throw new Error("developer error: ENTRYPOINT is not set"); +} + +const port = process.env.PORT ? parseInt(process.env.PORT) : 12345; +const agent = await startAgentServer(resolve(process.env.ENTRYPOINT), port + 1); + +http + .createServer((req, res) => { + setAuthToken(req.headers[BlinkInvocationTokenHeader] as string); + agent(req, res); + }) + .listen(port, () => { + console.log(`Server is running on port ${port}`); + }); diff --git a/packages/runtime/src/server.ts b/packages/runtime/src/server.ts new file mode 100644 index 0000000..8b4cb42 --- /dev/null +++ b/packages/runtime/src/server.ts @@ -0,0 +1,173 @@ +// This is imported by the generated wrapper files. +// It should be *very* cautious about what it imports, +// as we don't want that bundle to be too large. + +import AgentInvocationClient from "@blink.so/api/agents/me"; +import { createServerAdapter } from "@whatwg-node/server"; +import { AgentChat, AgentOtel, AgentStore, ID } from "blink"; +import { APIServerURLEnvironmentVariable } from "blink/client"; +import { api } from "blink/control"; +import { createServer, Server } from "node:http"; +import { + InternalAPIServerListenPortEnvironmentVariable, + InternalAPIServerURLEnvironmentVariable, +} from "./types"; + +/** + * Starts the internal API server that routes internal Blink APIs to use + * the Blink Cloud API server. + * + * @returns A function to set the authentication token. + */ +export function startInternalAPIServer() { + let blinkAuthToken: string | undefined; + + const getClient = () => { + return new AgentInvocationClient({ + baseURL: process.env[InternalAPIServerURLEnvironmentVariable], + authToken: blinkAuthToken, + }); + }; + + // Start the API server that routes internal Blink APIs to use + // the Blink Cloud API server. + const port = process.env[InternalAPIServerListenPortEnvironmentVariable] + ? parseInt(process.env[InternalAPIServerListenPortEnvironmentVariable]) + : 12345; + + const store: AgentStore = { + get(key) { + return getClient().getStorage(key); + }, + set(key, value) { + return getClient().setStorage(key, value); + }, + delete(key) { + return getClient().deleteStorage(key); + }, + list(prefix, options) { + return getClient().listStorage(prefix, options); + }, + }; + const otlp: AgentOtel = { + traces(request) { + return getClient().proxyOtlpTraces(request); + }, + }; + + const chat: AgentChat = { + upsert: async (key) => { + const resp = await getClient().upsertChat(JSON.stringify(key)); + return { + created: resp.created, + id: resp.id as ID, + createdAt: resp.created_at, + }; + }, + delete: async (id) => { + await getClient().deleteChat(id); + }, + deleteMessages: async (id, messageIds) => { + await getClient().deleteMessages(id, messageIds); + }, + get: async (id) => { + const resp = await getClient().getChat(id); + if (!resp) { + return undefined; + } + return { + id: resp.id as ID, + createdAt: resp.createdAt, + }; + }, + getMessages: async (id) => { + const messages = await getClient().getMessages(id); + return messages.map((message) => ({ + id: message.id as ID, + role: message.role, + parts: message.parts, + metadata: message.metadata, + })); + }, + start: async (id) => { + await getClient().startChat(id); + }, + stop: async (id) => { + await getClient().stopChat(id); + }, + sendMessages: async (id, messages, options) => { + await getClient().sendMessages(id, { + messages: messages.map((msg) => ({ + id: msg.id, + role: msg.role, + parts: msg.parts, + metadata: msg.metadata, + })), + behavior: options?.behavior ?? "enqueue", + }); + }, + }; + const server = createServer( + createServerAdapter((request) => { + return api.fetch(request, { + chat, + store, + otlp, + }); + }) + ); + server.listen(port, "127.0.0.1"); + // This is for the agents to know where to send requests to. + process.env[APIServerURLEnvironmentVariable] = `http://127.0.0.1:${port}`; + + return { + server, + port, + setAuthToken(authToken: string) { + blinkAuthToken = authToken; + // This is an environment variable that is used by SDKs + // to send authenticated requests to the API. + process.env["BLINK_INVOCATION_AUTH_TOKEN"] = authToken; + }, + }; +} + +export async function startAgentServer( + entrypoint: string, + port: number, + unref: boolean = false +) { + const priorEnvPort = process.env.PORT; + process.env.PORT = port.toString(); + + const originalListen = Server.prototype.listen; + const listeningPromise = new Promise((resolve, reject) => { + Server.prototype.listen = function (...args) { + this.on("listening", () => { + resolve(undefined); + }); + this.on("error", (err) => { + reject(err); + }); + if (unref) { + this.unref(); + } + return originalListen.apply(this, args); + }; + }); + + // The server starts immediately, so we don't need to wait for it. + await import(entrypoint); + process.env.PORT = priorEnvPort; + + const agentUrl = `http://127.0.0.1:${port}`; + const handler = createServerAdapter((request) => { + const reqURL = new URL(request.url); + const newURL = new URL(agentUrl); + newURL.pathname = reqURL.pathname; + newURL.search = reqURL.search; + return fetch(newURL.toString(), request); + }); + await listeningPromise; + return handler; +} diff --git a/packages/runtime/src/types.ts b/packages/runtime/src/types.ts new file mode 100644 index 0000000..d91ad9f --- /dev/null +++ b/packages/runtime/src/types.ts @@ -0,0 +1,13 @@ +// BlinkInvocationTokenHeader is the header that contains +// the invocation token for the agent. +// +// This must be used to send requests from the Lambda to the API. +export const BlinkInvocationTokenHeader = "x-blink-invocation-token"; + +// This is only used for tests, but maybe someday +// we'll change the API server and be very happy. +export const InternalAPIServerURLEnvironmentVariable = + "INTERNAL_BLINK_API_SERVER_URL"; + +export const InternalAPIServerListenPortEnvironmentVariable = + "INTERNAL_BLINK_API_SERVER_LISTEN_PORT"; diff --git a/packages/scout-agent/lib/compute/daytona/index.test.ts b/packages/scout-agent/lib/compute/daytona/index.test.ts index 2ad5056..dc6e651 100644 --- a/packages/scout-agent/lib/compute/daytona/index.test.ts +++ b/packages/scout-agent/lib/compute/daytona/index.test.ts @@ -1,10 +1,7 @@ import { describe, expect, mock, test } from "bun:test"; import { WebSocketServer } from "ws"; import type { DaytonaClient, DaytonaSandbox } from "./index"; -import { - getDaytonaWorkspaceClient, - initializeDaytonaWorkspace, -} from "./index"; +import { getDaytonaWorkspaceClient, initializeDaytonaWorkspace } from "./index"; const noopLogger = { info: () => {}, @@ -35,7 +32,8 @@ const createMockWebSocketServer = () => { let receivedHeaders: Record = {}; const wss = new WebSocketServer({ port: 0 }); const address = wss.address(); - const port = typeof address === "object" && address !== null ? address.port : 0; + const port = + typeof address === "object" && address !== null ? address.port : 0; const url = `ws://localhost:${port}`; wss.on("connection", (_ws, req) => { diff --git a/packages/scout-agent/lib/compute/docker.ts b/packages/scout-agent/lib/compute/docker.ts index b5e4ad1..1e95610 100644 --- a/packages/scout-agent/lib/compute/docker.ts +++ b/packages/scout-agent/lib/compute/docker.ts @@ -1,7 +1,7 @@ +import type { Client } from "@blink-sdk/compute-protocol/client"; import { exec as execChildProcess } from "node:child_process"; import crypto from "node:crypto"; import util from "node:util"; -import type { Client } from "@blink-sdk/compute-protocol/client"; import { WebSocket } from "ws"; import { z } from "zod"; import { newComputeClient } from "./common"; diff --git a/packages/scout-agent/lib/core.test.ts b/packages/scout-agent/lib/core.test.ts index e3a65ff..b4c0213 100644 --- a/packages/scout-agent/lib/core.test.ts +++ b/packages/scout-agent/lib/core.test.ts @@ -1,4 +1,3 @@ -import { describe, expect, mock, test } from "bun:test"; import { Server as ComputeServer } from "@blink-sdk/compute-protocol/server"; import { readUIMessageStream, @@ -9,6 +8,7 @@ import { import { MockLanguageModelV2 } from "ai/test"; import * as blink from "blink"; import { Client } from "blink/client"; +import { describe, expect, mock, test } from "bun:test"; import { WebSocketServer } from "ws"; import type { DaytonaClient, DaytonaSandbox } from "./compute/daytona/index"; import { type Message, Scout } from "./index"; diff --git a/packages/scout-agent/lib/core.ts b/packages/scout-agent/lib/core.ts index 634d61a..f31182f 100644 --- a/packages/scout-agent/lib/core.ts +++ b/packages/scout-agent/lib/core.ts @@ -1,4 +1,3 @@ -import util from "node:util"; import type { ModelMessage, ProviderOptions } from "@ai-sdk/provider-utils"; import type * as github from "@blink-sdk/github"; import withModelIntent from "@blink-sdk/model-intent"; @@ -6,6 +5,7 @@ import * as slack from "@blink-sdk/slack"; import type { App } from "@slack/bolt"; import { convertToModelMessages, type LanguageModel, type Tool } from "ai"; import type * as blink from "blink"; +import util from "node:util"; import { type DaytonaClient, type DaytonaWorkspaceInfo, diff --git a/packages/scout-agent/lib/github.test.ts b/packages/scout-agent/lib/github.test.ts index 5a00cbf..bbb2b1b 100644 --- a/packages/scout-agent/lib/github.test.ts +++ b/packages/scout-agent/lib/github.test.ts @@ -1,3 +1,9 @@ +import type { + EmitterWebhookEvent, + EmitterWebhookEventName, +} from "@octokit/webhooks"; +import type { UIMessage } from "ai"; +import * as blink from "blink"; import { afterAll, afterEach, @@ -6,15 +12,9 @@ import { expect, test, } from "bun:test"; -import * as crypto from "node:crypto"; -import type { - EmitterWebhookEvent, - EmitterWebhookEventName, -} from "@octokit/webhooks"; -import type { UIMessage } from "ai"; -import * as blink from "blink"; import { HttpResponse, http as mswHttp } from "msw"; import { setupServer } from "msw/node"; +import * as crypto from "node:crypto"; import { createGitHubTools, githubAppContextFactory, diff --git a/packages/scout-agent/lib/test-helpers.ts b/packages/scout-agent/lib/test-helpers.ts index 27dd1f0..1abb1d4 100644 --- a/packages/scout-agent/lib/test-helpers.ts +++ b/packages/scout-agent/lib/test-helpers.ts @@ -1,7 +1,7 @@ -import * as http from "node:http"; import { createServerAdapter } from "@whatwg-node/server"; import type * as blink from "blink"; import { api as controlApi } from "blink/control"; +import * as http from "node:http"; /** * Creates a mock Blink API server for integration tests. diff --git a/packages/server/.gitignore b/packages/server/.gitignore new file mode 100644 index 0000000..5d625fe --- /dev/null +++ b/packages/server/.gitignore @@ -0,0 +1,5 @@ +dist/ +node_modules/ +.env +.env.local + diff --git a/packages/server/README.md b/packages/server/README.md new file mode 100644 index 0000000..7d8569d --- /dev/null +++ b/packages/server/README.md @@ -0,0 +1 @@ +🚧🚧🚧 diff --git a/packages/server/package.json b/packages/server/package.json new file mode 100644 index 0000000..1a39000 --- /dev/null +++ b/packages/server/package.json @@ -0,0 +1,43 @@ +{ + "name": "blink-server", + "description": "Agents as a Service", + "version": "0.0.7", + "author": { + "name": "Coder", + "email": "support@coder.com", + "url": "https://coder.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/coder/blink" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "dist" + ], + "bin": { + "blink-server": "dist/cli.js" + }, + "type": "module", + "scripts": { + "build": "bun scripts/build.ts", + "typecheck": "tsgo --noEmit" + }, + "devDependencies": { + "@types/node": "^22.10.2", + "@types/pg": "^8.11.10", + "@types/ws": "^8.5.13", + "chalk": "^5.4.1", + "boxen": "^8.0.1", + "commander": "^12.1.0", + "drizzle-orm": "^0.44.5", + "fetch-to-node": "^2.1.0", + "pg": "^8.16.0", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=20.0.0" + } +} diff --git a/packages/server/scripts/build.ts b/packages/server/scripts/build.ts new file mode 100644 index 0000000..8e2fe13 --- /dev/null +++ b/packages/server/scripts/build.ts @@ -0,0 +1,91 @@ +import { build } from "bun"; +import { execSync } from "child_process"; +import { cpSync, mkdirSync, rmSync, writeFileSync } from "fs"; +import { join } from "path"; + +const distDir = join(import.meta.dirname, "..", "dist"); +const repoRoot = join(import.meta.dirname, "..", "..", ".."); + +/** + * buildServer builds the CLI for the server. + */ +async function buildServer() { + await build({ + entrypoints: [join(__dirname, "..", "src", "cli.ts")], + outdir: "dist", + target: "node", + format: "esm", + minify: true, + }); +} + +/** + * buildNextSite builds the NextJS site and copies the necessary files to the dist directory. + */ +function buildNextSite() { + const sitePackage = join(repoRoot, "packages", "site"); + + execSync("bun run build", { + cwd: sitePackage, + stdio: "inherit", + env: { + ...process.env, + NODE_ENV: "production", + // This ensures the site is bundled alone. + NEXT_OUTPUT: "standalone", + }, + }); + + rmSync(join(distDir, "site"), { recursive: true, force: true }); + mkdirSync(join(distDir, "site"), { recursive: true }); + // This moves all of the compiled site and sources to run the server-side. + cpSync( + join(sitePackage, ".next", "standalone", "packages", "site", ".next"), + join(distDir, "site", ".next"), + { recursive: true } + ); + // This copies all of the static assets. + cpSync( + join(sitePackage, ".next", "static"), + join(distDir, "site", ".next", "static"), + { recursive: true } + ); + // This copies all public assets. + cpSync(join(sitePackage, "public"), join(distDir, "site", "public"), { + recursive: true, + }); + // This copies the required server node_modules. + cpSync( + join(sitePackage, ".next", "standalone", "node_modules"), + join(distDir, "site", "node_modules"), + { recursive: true } + ); + // Write minimal package.json for module.createRequire() to work. + writeFileSync( + join(distDir, "site", "package.json"), + JSON.stringify({ type: "module" }) + ); +} + +function copyMigrations() { + const databasePackage = join(repoRoot, "packages", "database"); + + rmSync(join(distDir, "migrations"), { recursive: true, force: true }); + cpSync(join(databasePackage, "migrations"), join(distDir, "migrations"), { + recursive: true, + }); +} + +console.time("buildServer"); +await buildServer(); +console.timeEnd("buildServer"); + +if (process.env.BUILD_SITE) { + console.time("buildNextSite"); + buildNextSite(); + console.timeEnd("buildNextSite"); +} + +console.time("copyMigrations"); +copyMigrations(); +console.timeEnd("copyMigrations"); diff --git a/packages/server/src/agent-deployment.ts b/packages/server/src/agent-deployment.ts new file mode 100644 index 0000000..a10d4bf --- /dev/null +++ b/packages/server/src/agent-deployment.ts @@ -0,0 +1,236 @@ +import type Querier from "@blink.so/database/querier"; +import type { AgentDeployment } from "@blink.so/database/schema"; +import { + InternalAPIServerListenPortEnvironmentVariable, + InternalAPIServerURLEnvironmentVariable, +} from "@blink.so/runtime/types"; +import { spawn } from "child_process"; +import { mkdir, writeFile } from "fs/promises"; +import { createServer } from "net"; +import { tmpdir } from "os"; +import { join } from "path"; + +interface DockerDeployOptions { + deployment: AgentDeployment; + querier: Querier; + baseUrl: string; + downloadFile: (id: string) => Promise<{ + stream: ReadableStream; + type: string; + name: string; + size: number; + }>; +} + +/** + * Janky Docker-based agent deployment for self-hosted + * This will download files, write them to a temp directory, + * and run them in a Docker container. + */ +export async function deployAgentWithDocker(opts: DockerDeployOptions) { + const { deployment, querier, baseUrl, downloadFile } = opts; + console.log(`Deploying agent ${deployment.agent_id} (${deployment.id})`); + + try { + await querier.updateAgentDeployment({ + id: deployment.id, + status: "deploying", + }); + + if (!deployment.output_files || deployment.output_files.length === 0) { + throw new Error("No output files provided"); + } + + // Create a temp directory for this deployment + const deploymentDir = join(tmpdir(), `blink-agent-${deployment.id}`); + await mkdir(deploymentDir, { recursive: true }); + + console.log(`Writing files to ${deploymentDir}`); + + // Download and write all files + for (const file of deployment.output_files) { + const fileData = await downloadFile(file.id); + const filePath = join(deploymentDir, file.path); + + // Create parent directories if needed + const parentDir = join(filePath, ".."); + await mkdir(parentDir, { recursive: true }); + + // Convert ReadableStream to Buffer + const reader = fileData.stream.getReader(); + const chunks: Uint8Array[] = []; + while (true) { + const { done, value } = await reader.read(); + if (done) break; + chunks.push(value); + } + const buffer = Buffer.concat(chunks); + + await writeFile(filePath, buffer); + console.log(`Wrote ${file.path} (${buffer.length} bytes)`); + } + + // Add the node wrapper runtime + const runtime = await import("@blink.so/runtime/node/wrapper"); + const wrapperPath = join(deploymentDir, "__wrapper.js"); + await writeFile(wrapperPath, runtime.default); + console.log(`Wrote __wrapper.js (runtime wrapper)`); + + // The original entrypoint becomes an env var for the wrapper + const originalEntrypoint = deployment.entrypoint; + const wrapperEntrypoint = "__wrapper.js"; + + // Get environment variables for the agent + const envs = await querier.selectAgentEnvironmentVariablesByAgentID({ + agentID: deployment.agent_id, + }); + const target = await querier.selectAgentDeploymentTargetByID( + deployment.target_id + ); + + // Find free ports for this agent (one for external access, one for internal API) + const externalPort = await findFreePort(); + const internalAPIPort = await findFreePort(); + + // Build Docker env args + const dockerEnvArgs: string[] = []; + // Wrapper runtime configuration + dockerEnvArgs.push("-e", `ENTRYPOINT=./${originalEntrypoint}`); + dockerEnvArgs.push( + "-e", + `${InternalAPIServerListenPortEnvironmentVariable}=${internalAPIPort}` + ); + dockerEnvArgs.push( + "-e", + `${InternalAPIServerURLEnvironmentVariable}=${baseUrl}` + ); + // Agent configuration + dockerEnvArgs.push("-e", `BLINK_REQUEST_URL=${baseUrl}`); + dockerEnvArgs.push("-e", `BLINK_REQUEST_ID=${target?.request_id}`); + dockerEnvArgs.push("-e", `PORT=${externalPort}`); + // User-defined environment variables + for (const envVar of envs) { + if (envVar.value !== null) { + dockerEnvArgs.push("-e", `${envVar.key}=${envVar.value}`); + } + } + + // Run docker container + // Mount the deployment directory as /app + // Expose the port so we can access the agent + const containerName = `blink-agent-${deployment.agent_id}`; + + // Stop and remove existing container if it exists + try { + await runCommand("docker", ["stop", containerName]); + await runCommand("docker", ["rm", containerName]); + } catch { + // Ignore errors if container doesn't exist + } + + const dockerArgs = [ + "run", + "-d", + "--name", + containerName, + "--restart", + "unless-stopped", + "--network", + "host", + "-v", + `${deploymentDir}:/app`, + "-w", + "/app", + ...dockerEnvArgs, + "node:22", + "node", + wrapperEntrypoint, + ]; + + console.log(`Running: docker ${dockerArgs.join(" ")}`); + const containerId = await runCommand("docker", dockerArgs); + + console.log(`Container started: ${containerId}`); + + // Update deployment status and set as active if target is production + await querier.tx(async (tx) => { + await tx.updateAgentDeployment({ + id: deployment.id, + status: "success", + direct_access_url: `http://localhost:${externalPort}`, + platform_metadata: { + type: "lambda", + arn: `container:${containerId.trim()}`, + }, + }); + + const deploymentTarget = await tx.selectAgentDeploymentTargetByID( + deployment.target_id + ); + // TODO: We should probably not have this hardcoded. + if (deploymentTarget && deploymentTarget.target === "production") { + await tx.updateAgent({ + id: deployment.agent_id, + active_deployment_id: deployment.id, + }); + } + }); + + console.log(`Deployment ${deployment.id} successful`); + } catch (error) { + console.error(`Deployment ${deployment.id} failed:`, error); + await querier.updateAgentDeployment({ + id: deployment.id, + status: "failed", + error_message: error instanceof Error ? error.message : String(error), + }); + throw error; + } +} + +function runCommand(command: string, args: string[]): Promise { + return new Promise((resolve, reject) => { + const proc = spawn(command, args); + let stdout = ""; + let stderr = ""; + + proc.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + proc.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + proc.on("close", (code) => { + if (code === 0) { + resolve(stdout); + } else { + reject(new Error(`Command failed with code ${code}: ${stderr}`)); + } + }); + + proc.on("error", (error) => { + reject(error); + }); + }); +} + +function findFreePort(): Promise { + return new Promise((resolve, reject) => { + const server = createServer(); + server.listen(0, () => { + const address = server.address(); + if (address && typeof address !== "string") { + const port = address.port; + server.close(() => { + resolve(port); + }); + } else { + server.close(); + reject(new Error("Failed to get port")); + } + }); + server.on("error", reject); + }); +} diff --git a/packages/server/src/chat.ts b/packages/server/src/chat.ts new file mode 100644 index 0000000..18a3e14 --- /dev/null +++ b/packages/server/src/chat.ts @@ -0,0 +1,278 @@ +import type { StreamChatEvent } from "@blink.so/api"; +import { runChat } from "@blink.so/api/util/chat"; +import type Querier from "@blink.so/database/querier"; +import type { DBMessage } from "@blink.so/database/schema"; +import type { WebSocketServer } from "ws"; +import { WebSocket } from "ws"; + +class ChatSession { + private sseStreams: Set> = new Set(); + private streamingBuffer: string[] = []; + private streamAbortController?: AbortController; + private running = false; + + constructor(private id: string) {} + + addSSEStream(writer: WritableStreamDefaultWriter) { + this.sseStreams.add(writer); + writer.closed.then(() => { + this.sseStreams.delete(writer); + }); + + // Send buffered events to new connection + (async () => { + for (const encoded of this.streamingBuffer) { + await writer.write(encoded); + } + })(); + } + + broadcast( + event: StreamChatEvent, + wss: WebSocketServer, + wsDataMap: WeakMap< + WebSocket, + { type: "token"; id: string } | { type: "chat"; chatID: string } + > + ) { + const encoded = encodeStreamChatEvent(event); + + // Store message chunks for reconnecting clients + if (event.event === "message.chunk.added") { + this.streamingBuffer.push(encoded); + } + + // Broadcast to WebSockets + wss.clients.forEach((client) => { + const data = wsDataMap.get(client); + if ( + client.readyState === WebSocket.OPEN && + data?.type === "chat" && + data.chatID === this.id + ) { + client.send(encoded); + } + }); + + // Broadcast to SSE streams + for (const writer of this.sseStreams) { + writer.write(encoded).catch(() => { + // Client disconnected, ignore + }); + } + } + + async start(opts: { + interrupt: boolean; + db: Querier; + env: Record; + wss: WebSocketServer; + wsDataMap: WeakMap< + WebSocket, + { type: "token"; id: string } | { type: "chat"; chatID: string } + >; + }) { + if (opts.interrupt) { + this.streamAbortController?.abort(); + } + + if (this.running && !opts.interrupt) { + return; + } + + this.running = true; + this.executeChat(opts); + } + + stop() { + this.streamAbortController?.abort(); + this.running = false; + } + + private async executeChat(opts: { + db: Querier; + env: Record; + wss: WebSocketServer; + wsDataMap: WeakMap< + WebSocket, + { type: "token"; id: string } | { type: "chat"; chatID: string } + >; + }) { + this.streamAbortController?.abort(); + const controller = new AbortController(); + this.streamAbortController = controller; + + try { + this.streamingBuffer = []; + const result = await runChat({ + id: this.id, + signal: controller.signal, + db: opts.db, + broadcast: async (event) => { + this.broadcast(event, opts.wss, opts.wsDataMap); + }, + waitUntil: async (promise) => { + // In Node/Bun we can just let it run + promise.catch(console.error); + }, + env: opts.env as any, + writePlatformLog: async () => { + // No-op for now + }, + }); + + this.streamingBuffer = []; + + if (result.continue) { + // Continue executing + await this.executeChat(opts); + } else { + this.running = false; + } + } catch (error) { + if (error instanceof Error && error.name === "AbortError") { + // Expected when stopping + return; + } + console.error("Chat execution error:", error); + this.running = false; + } finally { + if (this.streamAbortController === controller) { + this.streamAbortController = undefined; + } + } + } + + async broadcastMessagesChanged( + event: "message.created" | "message.updated", + messages: DBMessage[], + wss: WebSocketServer, + wsDataMap: WeakMap< + WebSocket, + { type: "token"; id: string } | { type: "chat"; chatID: string } + > + ) { + for (const message of messages) { + this.broadcast( + { + event, + data: { + id: message.id, + chat_id: message.chat_id, + role: message.role, + parts: message.parts, + format: "ai-sdk", + created_at: message.created_at.toISOString(), + metadata: message.metadata, + }, + }, + wss, + wsDataMap + ); + } + } + + getBufferedEvents() { + return this.streamingBuffer; + } + + sendBufferedEvents(ws: any) { + for (const encoded of this.streamingBuffer) { + ws.send(encoded); + } + } +} + +export class ChatManager { + private sessions = new Map(); + + constructor( + private wss: WebSocketServer, + private wsDataMap: WeakMap< + WebSocket, + { type: "token"; id: string } | { type: "chat"; chatID: string } + >, + private getDB: () => Promise, + private env: Record + ) {} + + private getSession(id: string): ChatSession { + let session = this.sessions.get(id); + if (!session) { + session = new ChatSession(id); + this.sessions.set(id, session); + } + return session; + } + + async handleStream(id: string, request: Request): Promise { + const session = this.getSession(id); + + // Handle SSE + if (request.headers.get("Accept") === "text/event-stream") { + const transform = new TextEncoderStream(); + const writer = transform.writable.getWriter(); + session.addSSEStream(writer); + + return new Response(transform.readable, { + status: 200, + headers: { + "content-type": "text/event-stream", + "cache-control": "no-cache, no-transform", + "transfer-encoding": "chunked", + connection: "keep-alive", + }, + }); + } + + return new Response("Bad Request", { status: 400 }); + } + + async handleStart(opts: { id: string; interrupt: boolean }) { + const session = this.getSession(opts.id); + const db = await this.getDB(); + await session.start({ + interrupt: opts.interrupt, + db, + env: this.env, + wss: this.wss, + wsDataMap: this.wsDataMap, + }); + } + + async handleStop(id: string) { + const session = this.sessions.get(id); + if (session) { + session.stop(); + } + } + + async handleMessagesChanged( + event: "message.created" | "message.updated", + id: string, + messages: DBMessage[] + ) { + const session = this.getSession(id); + await session.broadcastMessagesChanged( + event, + messages, + this.wss, + this.wsDataMap + ); + } + + sendBufferedEventsToWebSocket(chatID: string, ws: any) { + const session = this.sessions.get(chatID); + if (session) { + session.sendBufferedEvents(ws); + } + } +} + +function encodeStreamChatEvent(event: StreamChatEvent): string { + return [ + `event: ${event.event}`, + `data: ${JSON.stringify(event.data)}`, + "\n", + ].join("\n"); +} diff --git a/packages/server/src/cli.ts b/packages/server/src/cli.ts new file mode 100644 index 0000000..7e60841 --- /dev/null +++ b/packages/server/src/cli.ts @@ -0,0 +1,78 @@ +#!/usr/bin/env node + +import boxen from "boxen"; +import chalk from "chalk"; +import { Command } from "commander"; +import { version } from "../package.json"; +import * as logger from "./logger"; +import { ensurePostgres } from "./postgres"; +import { startServer } from "./server"; + +const program = new Command(); + +program + .name("blink-server") + .description("Self-hosted Blink server") + .version(version) + .option("-p, --port ", "Port to run the server on", "3005") + .action(async (options) => { + try { + await runServer(options); + } catch (error) { + console.error(error, error instanceof Error ? error.stack : undefined); + logger.error( + error instanceof Error ? error.message : "An unknown error occurred" + ); + process.exit(1); + } + }); + +async function runServer(options: { port: string }) { + const port = parseInt(options.port, 10); + if (isNaN(port) || port < 1 || port > 65535) { + throw new Error(`Invalid port: ${options.port}`); + } + + console.log(chalk.bold("blink■"), version, chalk.gray("agents as a service")); + + // Check and setup environment variables + let postgresUrl = process.env.POSTGRES_URL || process.env.DATABASE_URL; + + if (!postgresUrl) { + postgresUrl = await ensurePostgres(); + } + + // Generate or use existing AUTH_SECRET + const authSecret = + process.env.AUTH_SECRET || "fake-random-string-should-be-in-db"; + + const baseUrl = process.env.BASE_URL || `http://localhost:${port}`; + + // Start the server + const srv = await startServer({ + port, + postgresUrl, + authSecret, + baseUrl, + }); + + const box = boxen( + [ + "View the Web UI:", + chalk.magenta.underline(baseUrl), + "", + `Set ${chalk.bold("BLINK_API_URL=" + baseUrl)} when using the Blink CLI.`, + ].join("\n"), + { + borderColor: "cyan", + padding: { + left: 4, + right: 4, + }, + textAlignment: "center", + } + ); + console.log(box); +} + +program.parse(); diff --git a/packages/server/src/logger.ts b/packages/server/src/logger.ts new file mode 100644 index 0000000..7e847a0 --- /dev/null +++ b/packages/server/src/logger.ts @@ -0,0 +1,29 @@ +import chalk from "chalk"; + +function formatTimestamp(): string { + const now = new Date(); + const date = now.toISOString().split("T")[0]!; + const time = now.toTimeString().split(" ")[0]!; + const ms = now.getMilliseconds().toString().padStart(3, "0"); + return chalk.gray(`${date} ${time}.${ms}`); +} + +export function info(message: string) { + console.log(`${formatTimestamp()} ${chalk.cyan("[info]")} ${message}`); +} + +export function warn(message: string) { + console.log(`${formatTimestamp()} ${chalk.yellow("[warn]")} ${message}`); +} + +export function error(message: string) { + console.log(`${formatTimestamp()} ${chalk.red("[error]")} ${message}`); +} + +export function success(message: string) { + console.log(`${formatTimestamp()} ${chalk.green("[info]")} ${message}`); +} + +export function plain(message: string) { + console.log(message); +} diff --git a/packages/server/src/postgres.ts b/packages/server/src/postgres.ts new file mode 100644 index 0000000..a3055b4 --- /dev/null +++ b/packages/server/src/postgres.ts @@ -0,0 +1,225 @@ +import { spawn } from "child_process"; +import { createServer } from "net"; +import * as logger from "./logger"; + +const CONTAINER_NAME = "blink-server-postgres"; +const POSTGRES_PASSWORD = "blink-server-dev-password"; +const POSTGRES_USER = "postgres"; +const POSTGRES_DB = "blink"; +const POSTGRES_PORT = 54321; + +function runCommand(command: string, args: string[]): Promise { + return new Promise((resolve, reject) => { + const proc = spawn(command, args); + let stdout = ""; + let stderr = ""; + + proc.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + proc.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + proc.on("close", (code) => { + if (code === 0) { + resolve(stdout.trim()); + } else { + reject(new Error(`Command failed with code ${code}: ${stderr}`)); + } + }); + + proc.on("error", (error) => { + reject(error); + }); + }); +} + +async function isPortAvailable(port: number): Promise { + return new Promise((resolve) => { + const server = createServer(); + + server.once("error", () => { + resolve(false); + }); + + server.once("listening", () => { + server.close(); + resolve(true); + }); + + server.listen(port); + }); +} + +async function isDockerRunning(): Promise { + try { + await runCommand("docker", ["info"]); + return true; + } catch { + return false; + } +} + +async function getContainerStatus(): Promise< + "running" | "stopped" | "not-found" +> { + try { + const output = await runCommand("docker", [ + "ps", + "-a", + "--filter", + `name=^${CONTAINER_NAME}$`, + "--format", + "{{.State}}", + ]); + + if (!output) { + return "not-found"; + } + + return output === "running" ? "running" : "stopped"; + } catch { + return "not-found"; + } +} + +async function startExistingContainer(): Promise { + logger.plain(`Starting existing PostgreSQL container: ${CONTAINER_NAME}`); + await runCommand("docker", ["start", CONTAINER_NAME]); + + // Wait for PostgreSQL to be ready + await waitForPostgres(); +} + +async function createAndStartContainer(): Promise { + logger.plain(`Creating PostgreSQL container: ${CONTAINER_NAME}`); + + const portAvailable = await isPortAvailable(POSTGRES_PORT); + if (!portAvailable) { + throw new Error( + `Port ${POSTGRES_PORT} is already in use. Please free the port or set POSTGRES_URL manually.` + ); + } + + await runCommand("docker", [ + "run", + "-d", + "--name", + CONTAINER_NAME, + "--restart", + "unless-stopped", + "-e", + `POSTGRES_PASSWORD=${POSTGRES_PASSWORD}`, + "-e", + `POSTGRES_DB=${POSTGRES_DB}`, + "-p", + `${POSTGRES_PORT}:5432`, + "pgvector/pgvector:pg17", + ]); + + logger.plain("PostgreSQL container created"); + + // Wait for PostgreSQL to be ready + await waitForPostgres(); +} + +async function waitForPostgres(): Promise { + logger.plain("Waiting for PostgreSQL to be ready..."); + + const maxAttempts = 30; + for (let i = 0; i < maxAttempts; i++) { + try { + await runCommand("docker", [ + "exec", + CONTAINER_NAME, + "pg_isready", + "-U", + POSTGRES_USER, + ]); + logger.plain("PostgreSQL is ready"); + return; + } catch { + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + } + + throw new Error("PostgreSQL failed to become ready in time"); +} + +async function promptUser(question: string): Promise { + logger.plain(question); + process.stdout.write("(y/n): "); + + return new Promise((resolve) => { + const stdin = process.stdin; + stdin.setRawMode(true); + stdin.resume(); + stdin.setEncoding("utf8"); + + const onData = (key: string) => { + stdin.setRawMode(false); + stdin.pause(); + stdin.removeListener("data", onData); + + console.log(key); + + if (key === "y" || key === "Y") { + resolve(true); + } else { + resolve(false); + } + }; + + stdin.on("data", onData); + }); +} + +export async function ensurePostgres(): Promise { + // Check if Docker is running + const dockerRunning = await isDockerRunning(); + if (!dockerRunning) { + throw new Error( + "Docker is not running. Please start Docker or set POSTGRES_URL manually." + ); + } + + const status = await getContainerStatus(); + + if (status === "running") { + logger.info( + `Using Docker PostgreSQL '${CONTAINER_NAME}' because POSTGRES_URL is not set` + ); + return getConnectionString(); + } + + if (status === "stopped") { + await startExistingContainer(); + logger.info( + `Using Docker PostgreSQL '${CONTAINER_NAME}' because POSTGRES_URL is not set` + ); + return getConnectionString(); + } + + // Container doesn't exist, ask user if they want to create it + const shouldCreate = await promptUser( + "No PostgreSQL container found. Create one with Docker?" + ); + + if (!shouldCreate) { + throw new Error( + "PostgreSQL is required. Please set POSTGRES_URL manually." + ); + } + + await createAndStartContainer(); + logger.info( + `Using Docker PostgreSQL '${CONTAINER_NAME}' because POSTGRES_URL is not set` + ); + return getConnectionString(); +} + +export function getConnectionString(): string { + return `postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${POSTGRES_DB}`; +} diff --git a/packages/server/src/server.ts b/packages/server/src/server.ts new file mode 100644 index 0000000..c1a7d10 --- /dev/null +++ b/packages/server/src/server.ts @@ -0,0 +1,474 @@ +import api from "@blink.so/api/server"; +import connectToPostgres from "@blink.so/database/postgres"; +import Querier from "@blink.so/database/querier"; +import { migrate } from "drizzle-orm/node-postgres/migrator"; +import { existsSync } from "fs"; +import { readFile } from "fs/promises"; +import { createServer, IncomingMessage } from "http"; +import module from "module"; +import path, { join } from "path"; +import { parse } from "url"; +import { WebSocket, WebSocketServer } from "ws"; +import { deployAgentWithDocker } from "./agent-deployment"; +import { ChatManager } from "./chat"; + +type WSData = { type: "token"; id: string } | { type: "chat"; chatID: string }; + +interface ServerOptions { + port: number; + postgresUrl: string; + authSecret: string; + baseUrl: string; +} + +// Files are now stored in the database instead of in-memory + +export async function startServer(options: ServerOptions) { + const { port, postgresUrl, authSecret, baseUrl } = options; + + const db = await connectToPostgres(postgresUrl); + const querier = new Querier(db); + + // Here we find the correct directories for the site and migrations. + let siteDir = join(import.meta.dirname, "site"); + let migrationsDir = join(import.meta.dirname, "migrations"); + if (import.meta.filename.endsWith("server.ts")) { + // We're running in development mode, so we need to point to the dist directory. + const distDir = join(import.meta.dirname, "..", "dist"); + if (!existsSync(distDir)) { + throw new Error( + `Dist directory not found: ${distDir}. Run 'bun run build' to build the server.` + ); + } + siteDir = join(distDir, "site"); + migrationsDir = join(distDir, "migrations"); + } + + // Run database migrations... + await migrate(db, { migrationsFolder: migrationsDir }); + + const app = await startNextServer({ + siteDir, + postgresUrl, + authSecret, + baseUrl, + }); + await app.prepare(); + const nextHandler = app.getRequestHandler(); + + const chatManagerRef: { current?: ChatManager } = {}; + + // Store WebSocket metadata without monkey-patching + const wsDataMap = new WeakMap(); + + // Create WebSocket server first (needed in api.fetch below) + const wss = new WebSocketServer({ noServer: true }); + + // Helper to convert Node.js request to Fetch Request + const toFetchRequest = (nodeReq: IncomingMessage): Request => { + const protocol = "http"; + const host = nodeReq.headers.host || `localhost:${port}`; + const fullUrl = `${protocol}://${host}${nodeReq.url}`; + + const headers = new Headers(); + for (const [key, value] of Object.entries(nodeReq.headers)) { + if (value) { + if (Array.isArray(value)) { + for (const v of value) headers.append(key, v); + } else { + headers.set(key, value); + } + } + } + + // Node.js IncomingMessage is a ReadableStream but needs type assertion + // for the Fetch API Request constructor + const body = + nodeReq.method !== "GET" && nodeReq.method !== "HEAD" + ? (nodeReq as any) + : undefined; + + return new Request(fullUrl, { + method: nodeReq.method, + headers, + body, + // @ts-ignore - this is a NodeJS thing. + duplex: "half", + }); + }; + + // Create HTTP server + const server = createServer(async (nodeReq, nodeRes) => { + try { + const url = new URL( + nodeReq.url || "/", + `http://${nodeReq.headers.host || `localhost:${port}`}` + ); + + if (url.pathname.startsWith("/api")) { + const req = toFetchRequest(nodeReq); + const response = await api.fetch( + req, + { + AUTH_SECRET: authSecret, + NODE_ENV: "development", + agentStore: (deploymentTargetID) => { + return { + delete: async (key) => { + await querier.deleteAgentStorageKV({ + deployment_target_id: deploymentTargetID, + key, + }); + }, + get: async (key) => { + const value = await querier.selectAgentStorageKV({ + deployment_target_id: deploymentTargetID, + key, + }); + if (!value) { + return undefined; + } + return value.value; + }, + set: async (key, value) => { + const target = + await querier.selectAgentDeploymentTargetByID( + deploymentTargetID + ); + if (!target) { + throw new Error("Deployment target not found"); + } + await querier.upsertAgentStorageKV({ + agent_deployment_target_id: target.id, + agent_id: target.agent_id, + key: key, + value: value, + }); + }, + list: async (prefix, options) => { + const values = await querier.selectAgentStorageKVByPrefix({ + deployment_target_id: deploymentTargetID, + prefix: prefix ?? "", + limit: options?.limit ?? 100, + cursor: options?.cursor, + }); + return { + entries: values.items.map((value) => ({ + key: value.key, + value: value.value, + })), + cursor: values.next_cursor ? values.next_cursor : undefined, + }; + }, + }; + }, + database: async () => { + const conn = await connectToPostgres(postgresUrl); + return new Querier(conn); + }, + apiBaseURL: url, + auth: { + handleWebSocketTokenRequest: async (id, request) => { + // WebSocket upgrades are handled in the 'upgrade' event + return new Response(null, { status: 101 }); + }, + sendTokenToWebSocket: async (id, token) => { + wss.clients.forEach((client) => { + const data = wsDataMap.get(client); + if ( + client.readyState === WebSocket.OPEN && + data?.type === "token" && + data.id === id + ) { + client.send(token); + } + }); + }, + }, + chat: { + async handleMessagesChanged(event, id, messages) { + await chatManagerRef.current?.handleMessagesChanged( + event, + id, + messages + ); + }, + handleStart: async (opts) => { + await chatManagerRef.current?.handleStart(opts); + }, + handleStop: async (id) => { + await chatManagerRef.current?.handleStop(id); + }, + handleStream: async (id, req) => { + if (!chatManagerRef.current) { + return new Response("Server not ready", { status: 503 }); + } + // WebSocket upgrades are handled in the 'upgrade' event + if (req.headers.get("upgrade")?.toLowerCase() === "websocket") { + return new Response(null, { status: 101 }); + } + return await chatManagerRef.current.handleStream(id, req); + }, + generateTitle: async (opts) => { + // noop + }, + }, + deployAgent: async (deployment) => { + await deployAgentWithDocker({ + deployment, + querier, + baseUrl, + downloadFile: async (id: string) => { + const file = await querier.selectFileByID(id); + if (!file || !file.content) { + throw new Error("File not found"); + } + + // Convert buffer back to ReadableStream + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(file.content); + controller.close(); + }, + }); + + return { + stream, + type: file.content_type, + name: file.name, + size: file.byte_length, + }; + }, + }); + }, + files: { + upload: async (opts) => { + const id = crypto.randomUUID(); + + // Read file content into buffer + const arrayBuffer = await opts.file.arrayBuffer(); + const buffer = Buffer.from(arrayBuffer); + + // Store file in database + await querier.insertFile({ + id, + name: opts.file.name, + message_id: null, + user_id: null, + organization_id: null, + content_type: opts.file.type, + byte_length: opts.file.size, + pdf_page_count: null, + content: buffer, + }); + + return { + id, + url: `${baseUrl}/api/files/${id}`, + }; + }, + download: async (id) => { + const file = await querier.selectFileByID(id); + if (!file || !file.content) { + throw new Error("File not found"); + } + + // Convert buffer back to ReadableStream + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(file.content); + controller.close(); + }, + }); + + return { + stream, + type: file.content_type, + name: file.name, + size: file.byte_length, + }; + }, + }, + logs: { + get: async (opts) => { + return querier.getAgentLogs(opts); + }, + write: async (opts) => { + await querier.writeAgentLog(opts); + }, + }, + traces: { + write: async (spans) => { + await querier.writeAgentTraces(spans); + }, + read: async (opts) => { + return querier.readAgentTraces(opts); + }, + }, + runtime: { + usage: async (opts) => { + // noop + throw new Error("Not implemented"); + }, + }, + }, + { + waitUntil: async (promise) => { + // noop + }, + passThroughOnException: () => { + // noop + }, + props: {}, + } + ); + + // Write Fetch Response to Node.js response + const headersObj: Record = {}; + response.headers.forEach((value, key) => { + const existing = headersObj[key]; + if (existing) { + if (Array.isArray(existing)) { + existing.push(value); + } else { + headersObj[key] = [existing, value]; + } + } else { + headersObj[key] = value; + } + }); + nodeRes.writeHead(response.status, response.statusText, headersObj); + + if (response.body) { + const reader = response.body.getReader(); + while (true) { + const { done, value } = await reader.read(); + if (done) break; + nodeRes.write(value); + } + } + nodeRes.end(); + return; + } + + // Handle Next.js routes + await nextHandler(nodeReq, nodeRes); + } catch (error) { + console.error("Request error:", error); + if (!nodeRes.headersSent) { + nodeRes.writeHead(500, { "Content-Type": "text/plain" }); + nodeRes.end("Internal Server Error"); + } + } + }); + + // Handle WebSocket upgrades + server.on("upgrade", (request, socket, head) => { + const { pathname, query } = parse(request.url || "", true); + + // Check if this is a token auth WebSocket + if (pathname?.startsWith("/api/auth/token")) { + const id = query.id as string; + wss.handleUpgrade(request, socket, head, (ws) => { + wsDataMap.set(ws, { type: "token", id }); + wss.emit("connection", ws, request); + }); + return; + } + + // Check if this is a chat WebSocket + const chatMatch = pathname?.match(/\/api\/chats\/([^/]+)\/stream/); + if (chatMatch?.[1]) { + const chatID = chatMatch[1]; + wss.handleUpgrade(request, socket, head, (ws) => { + wsDataMap.set(ws, { type: "chat", chatID }); + wss.emit("connection", ws, request); + }); + return; + } + + socket.destroy(); + }); + + wss.on("connection", (ws) => { + const data = wsDataMap.get(ws); + + if (data?.type === "chat") { + // Send buffered chunk events to reconnecting client + chatManagerRef.current?.sendBufferedEventsToWebSocket(data.chatID, ws); + } + + ws.on("close", () => { + wsDataMap.delete(ws); + }); + }); + + chatManagerRef.current = new ChatManager( + wss, + wsDataMap, + async () => { + const conn = await connectToPostgres(postgresUrl); + return new Querier(conn); + }, + process.env as Record + ); + + server.listen(port); + + return server; +} + +export interface StartNextServerOptions { + siteDir: string; + + postgresUrl: string; + authSecret: string; + baseUrl: string; +} + +/** + * startNextServer starts the Next.js server. + * It does this in a kinda convoluted way because we use the standalone + * mode but want to handle all the routes ourselves, not having it listen + * on it's own port and such. + */ +const startNextServer = async (opts: StartNextServerOptions) => { + // createRequire needs a filename (not directory) to establish module resolution context. + // We create a minimal package.json in the site dir during build for this purpose. + const packageJsonPath = path.join(opts.siteDir, "package.json"); + if (!existsSync(packageJsonPath)) { + throw new Error( + `package.json not found at ${packageJsonPath}. Make sure you built with BUILD_SITE=1.` + ); + } + const customRequire = module.createRequire(packageJsonPath); + + // These are env vars that the server needs to run. + // We could technically make these use the same DB instance somehow. + process.env.POSTGRES_URL = opts.postgresUrl; + process.env.AUTH_SECRET = opts.authSecret; + process.env.NEXT_PUBLIC_BASE_URL = opts.baseUrl; + + let nextConfig: any = {}; + try { + const content = await readFile( + path.join(opts.siteDir, ".next", "required-server-files.json"), + "utf-8" + ); + nextConfig = JSON.parse(content).config; + } catch (err) { + throw new Error( + `dev error: required next config file not found at ${path.join(opts.siteDir, ".next", "required-server-files.json")}: ${err}` + ); + } + // This is required for Next to not freak out about not having a config. + // Their standalone generated file does exactly this. + process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig); + + const next = customRequire("next") as typeof import("next").default; + const app = next({ + dev: false, + dir: opts.siteDir, + }); + return app; +}; diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json new file mode 100644 index 0000000..99559bc --- /dev/null +++ b/packages/server/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src", + "types": ["bun-types"] + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/server/tsdown.config.ts b/packages/server/tsdown.config.ts new file mode 100644 index 0000000..f1f3628 --- /dev/null +++ b/packages/server/tsdown.config.ts @@ -0,0 +1,103 @@ +import { execSync } from "child_process"; +import { cpSync, existsSync, mkdirSync } from "fs"; +import { join } from "path"; +import { defineConfig } from "tsdown"; + +export default defineConfig({ + entry: "src/main.ts", + format: ["esm"], + target: "node20", + outDir: "dist", + clean: true, + dts: false, + // Only externalize Next.js + external: [/^next/], + // Use shims to ensure circular deps work + shims: true, + onSuccess: async () => { + console.log("\n📦 Building production assets..."); + + const rootDir = join(import.meta.dirname, "..", ".."); + const siteDir = join(rootDir, "packages", "site"); + const dbDir = join(rootDir, "packages", "database"); + const distDir = join(import.meta.dirname, "dist"); + const siteBuildDir = join(distDir, "site"); + + // Build Next.js site in its source directory + console.log("🔨 Building Next.js site..."); + execSync("bun run build", { + cwd: siteDir, + stdio: "inherit", + }); + + // Copy only essential parts of .next folder (exclude cache) + const nextBuildSource = join(siteDir, ".next"); + const nextBuildTarget = join(siteBuildDir, ".next"); + + if (existsSync(nextBuildSource)) { + console.log("📄 Copying Next.js build output (excluding cache)..."); + mkdirSync(siteBuildDir, { recursive: true }); + + // Copy only the essential directories + const essentialDirs = [ + "server", + "static", + "types", + "app-paths-manifest.json", + "build-manifest.json", + "package.json", + "prerender-manifest.json", + "react-loadable-manifest.json", + "required-server-files.json", + "routes-manifest.json", + ]; + + for (const item of essentialDirs) { + const src = join(nextBuildSource, item); + const dest = join(nextBuildTarget, item); + if (existsSync(src)) { + cpSync(src, dest, { recursive: true }); + } + } + } else { + throw new Error("Next.js build not found at " + nextBuildSource); + } + + // Copy public folder if exists + const publicSource = join(siteDir, "public"); + if (existsSync(publicSource)) { + console.log("📄 Copying public assets..."); + cpSync(publicSource, join(siteBuildDir, "public"), { recursive: true }); + } + + // Copy migrations + const migrationsSource = join(dbDir, "migrations"); + const migrationsTarget = join(distDir, "migrations"); + + if (existsSync(migrationsSource)) { + console.log("📄 Copying migrations..."); + cpSync(migrationsSource, migrationsTarget, { recursive: true }); + } + + // Create minimal package.json for external dependencies + const packageJsonPath = join(distDir, "package.json"); + const packageJson = { + type: "module", + dependencies: { + next: "*", + pg: "*", + "drizzle-orm": "*", + }, + }; + console.log("📄 Creating package.json..."); + cpSync(join(import.meta.dirname, "package.json"), packageJsonPath); + + console.log("✅ Build complete!"); + console.log(` Server: ${distDir}/main.js + chunks`); + console.log(` Site: ${siteBuildDir}/`); + console.log(` Migrations: ${migrationsTarget}/`); + console.log(`\n📝 Next steps:`); + console.log(` cd dist && bun install (for Next.js)`); + console.log(` bun run start:prod`); + }, +}); diff --git a/packages/site/.gitignore b/packages/site/.gitignore new file mode 100644 index 0000000..e985853 --- /dev/null +++ b/packages/site/.gitignore @@ -0,0 +1 @@ +.vercel diff --git a/packages/site/.storybook/main.ts b/packages/site/.storybook/main.ts new file mode 100644 index 0000000..ac93f15 --- /dev/null +++ b/packages/site/.storybook/main.ts @@ -0,0 +1,93 @@ +import type { StorybookConfig } from "@storybook/experimental-nextjs-vite"; +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; +import Inspect from "vite-plugin-inspect"; +import { nodePolyfills } from "vite-plugin-node-polyfills"; + +const config: StorybookConfig = { + stories: ["../**/*.stories.@(js|jsx|mjs|ts|tsx)"], + features: { + experimentalRSC: true, + }, + framework: { + name: "@storybook/experimental-nextjs-vite", + options: {}, + }, + viteFinal: async (config) => { + const basePath = path.resolve(fileURLToPath(import.meta.url), "../../"); + config.define = { + __dirname: JSON.stringify("/"), + }; + + // Ensure '@' alias points to the site root so '@/...' imports resolve in stories + config.resolve ||= {}; + (config.resolve as any).alias ||= {}; + (config.resolve as any).alias["@"] = basePath; + + // This is a custom resolver plugin that looks for `mock.ts` files to replace + // original files when being imported. This allows us to mock server actions, + // database queries, etc. + // + // All RSC components are actually rendered in the browser. + const mockResolverPlugin = { + name: "storybook-mock-resolver", + enforce: "pre" as const, // Run before other plugins + + async resolveId(source, importer, options) { + // Handle @/ alias resolution + let resolvedPath; + if (source.startsWith("@/")) { + // Convert @/ to basePath (where tsconfig.json maps @/* to ./*) + resolvedPath = path.join(basePath, source.slice(2)); + } else if (path.isAbsolute(source)) { + // Handle absolute paths + resolvedPath = source; + } else { + // Handle relative paths by resolving against the importer directory + const importerDir = path.dirname(importer || ""); + resolvedPath = path.resolve(importerDir, source); + } + + // Check if this is a path we want to potentially mock + const relativePath = path.relative(basePath, resolvedPath); + if ( + relativePath.startsWith("app/") || + relativePath.startsWith("lib/") + ) { + // Remove file extension and look for mock files + const withoutSuffix = path.join( + path.dirname(resolvedPath), + path.basename(resolvedPath, path.extname(resolvedPath)) + ); + + for (const ext of [ + ".mock.ts", + ".mock.tsx", + ".mock.js", + ".mock.jsx", + ]) { + const mockPath = withoutSuffix + ext; + if (fs.existsSync(mockPath)) { + console.log( + `[Mocking] ${path.relative(basePath, resolvedPath)} -> ${path.relative(basePath, mockPath)}` + ); + return mockPath; + } + } + } + + // Let other plugins handle the resolution (including the original file) + return null; + }, + }; + + config.plugins ||= []; + config.plugins.push(mockResolverPlugin); + config.plugins.push(Inspect()); + config.plugins.push(nodePolyfills()); + + return config; + }, +}; +export default config; diff --git a/packages/site/.storybook/preview.tsx b/packages/site/.storybook/preview.tsx new file mode 100644 index 0000000..b235707 --- /dev/null +++ b/packages/site/.storybook/preview.tsx @@ -0,0 +1,46 @@ +import type { Preview } from "@storybook/react"; +import { Geist, Geist_Mono } from "next/font/google"; +import "../app/globals.css"; +import { ThemeProvider } from "../components/theme-provider"; +import { TooltipProvider } from "../components/ui/tooltip"; + +const geist = Geist({ + subsets: ["latin"], + display: "swap", + variable: "--font-geist", +}); + +const geistMono = Geist_Mono({ + subsets: ["latin"], + display: "swap", + variable: "--font-geist-mono", +}); + +const preview: Preview = { + parameters: { + layout: "fullscreen", + nextjs: { + appDirectory: true, + }, + }, + decorators: [ + (Story) => { + if (!document.documentElement.classList.contains(geist.variable)) { + document.documentElement.classList.add(geist.variable); + } + if (!document.documentElement.classList.contains(geistMono.variable)) { + document.documentElement.classList.add(geistMono.variable); + } + + return ( + + + + + + ); + }, + ], +}; + +export default preview; diff --git a/packages/site/.storybook/utils.tsx b/packages/site/.storybook/utils.tsx new file mode 100644 index 0000000..77471f7 --- /dev/null +++ b/packages/site/.storybook/utils.tsx @@ -0,0 +1,176 @@ +import { Emitter, type Disposable } from "@blink-sdk/events"; +import type { StoryFn } from "@storybook/react"; +import { useEffect } from "react"; + +export interface MockWebSocket { + readonly url: string; + + onClose(listener: () => void): Disposable; + onMessage(listener: (data: Uint8Array | string) => void): Disposable; + send(data: Uint8Array | string): void; + close(): void; + open(): void; +} + +const withMockWebSocket = (cb: (ws: MockWebSocket) => void) => { + return (Story: StoryFn) => { + const onDispose = new Emitter(); + + window.WebSocket = class extends EventTarget { + public static readonly CLOSING = 2; + + private readonly onSend = new Emitter(); + private readonly onClose = new Emitter(); + + // connecting state + public readyState = 0; + + constructor(private readonly url: string) { + super(); + + const ws: MockWebSocket = { + url: this.url, + onClose: (fn) => { + return this.onClose.event(fn); + }, + onMessage: (fn) => { + return this.onSend.event(fn); + }, + send: (data) => { + this.dispatchEvent(new MessageEvent("message", { data })); + }, + close: () => { + this.readyState = 2; + this.dispatchEvent(new Event("close")); + this.readyState = 3; + }, + open: () => { + this.readyState = 1; + this.dispatchEvent(new Event("open")); + }, + }; + setTimeout(() => cb(ws), 1); + + onDispose.event(() => { + this.onClose.dispose(); + this.onSend.dispose(); + }); + } + + public send(data: Uint8Array | string) { + this.onSend.emit(data); + } + + public close() { + this.onClose.emit(); + } + } as any; + + useEffect(() => { + // Cleanup after the story is re-rendered. + return () => { + onDispose.emit(); + }; + }, []); + + // @ts-expect-error + return ; + }; +}; + +// Generic fetch interceptor decorator with teardown and chaining support +export function withFetch( + respond: ( + url: URL, + init: RequestInit | undefined, + prev: typeof fetch + ) => (Promise | Response) | undefined +) { + return (Story: StoryFn) => { + let restore: (() => void) | undefined; + + const g: any = typeof globalThis !== "undefined" ? globalThis : undefined; + if (g && g.fetch) { + const previous = g.fetch as typeof fetch; + const boundPrev = previous.bind(g) as typeof fetch; + + const handler = (async ( + input: RequestInfo | URL, + init?: RequestInit + ): Promise => { + try { + const url = + typeof input === "string" || input instanceof URL + ? new URL( + input.toString(), + (g.location?.origin as string) || "http://localhost" + ) + : new URL( + (input as Request).url, + (g.location?.origin as string) || "http://localhost" + ); + + const result = await respond(url, init, boundPrev); + if (result) { + return result; + } + } catch { + // fall through + } + return boundPrev(input as any, init); + }) as typeof fetch; + + // Preserve any extended properties from Bun's fetch (e.g., preconnect) + const patched = Object.assign(handler, previous); + g.fetch = patched; + if (typeof window !== "undefined") { + (window as any).fetch = patched; + } + restore = () => { + g.fetch = previous; + if (typeof window !== "undefined") { + (window as any).fetch = previous; + } + }; + } + + useEffect(() => restore, []); + + // @ts-expect-error + return ; + }; +} + +// Chat history-specific decorator built on withFetch +// ChatHistory type (placeholder for removed schema type) +type ChatHistory = { chats: any[]; hasMore: boolean }; + +type ChatHistoryPage = Pick; + +function withChatHistory( + pages?: ChatHistoryPage[] | (() => ChatHistoryPage[]) +) { + return withFetch((url) => { + if (url.pathname !== "/api/history") { + return undefined; + } + const arr = typeof pages === "function" ? pages() : (pages ?? []); + + // Build cursor -> next page mapping + const map = new Map(); + if (arr[0]) map.set("", arr[0]!); + for (let i = 0; i < arr.length - 1; i++) { + const last = arr[i]!.chats.at(-1) as any; + const lastId = last?.chat?.id as string | undefined; + if (lastId) map.set(lastId, arr[i + 1]!); + } + + const cursor = url.searchParams.get("ending_before") ?? ""; + const body = map.get(cursor) ?? { chats: [], hasMore: false }; + + return new Response(JSON.stringify(body), { + status: 200, + headers: { "Content-Type": "application/json" }, + }); + }); +} diff --git a/packages/site/README.md b/packages/site/README.md new file mode 100644 index 0000000..6a485d6 --- /dev/null +++ b/packages/site/README.md @@ -0,0 +1,15 @@ +# site + +To install dependencies: + +```bash +bun install +``` + +To run: + +```bash +bun run index.ts +``` + +This project was created using `bun init` in bun v1.2.5. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/packages/site/app/(app)/[organization]/[agent]/access/add-member-modal.tsx b/packages/site/app/(app)/[organization]/[agent]/access/add-member-modal.tsx new file mode 100644 index 0000000..f3bdddf --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/access/add-member-modal.tsx @@ -0,0 +1,203 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { UserSelector } from "@/components/user-selector"; +import Client from "@blink.so/api"; +import { ChevronDown } from "lucide-react"; +import { useMemo, useState } from "react"; + +interface AddMemberModalProps { + agentId: string; + organizationId: string; + orgAdminsAndOwners?: Set; + isOpen: boolean; + onClose: () => void; + onSuccess: () => void; +} + +const PERMISSIONS = [ + { + value: "read" as const, + label: "Read", + description: "Use the agent and view their own chats", + }, + { + value: "write" as const, + label: "Write", + description: "Develop agents and access logs & traces", + }, + { + value: "admin" as const, + label: "Admin", + description: "Manage settings, access, and all agent features", + }, +]; + +export function AddMemberModal({ + agentId, + organizationId, + orgAdminsAndOwners = new Set(), + isOpen, + onClose, + onSuccess, +}: AddMemberModalProps) { + const [selectedUserId, setSelectedUserId] = useState(null); + const [permission, setPermission] = useState<"read" | "write" | "admin">( + "read" + ); + const [isSubmitting, setIsSubmitting] = useState(false); + const [error, setError] = useState(null); + const client = useMemo(() => new Client(), []); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setError(null); + + if (!selectedUserId) { + setError("Please select a member"); + return; + } + + setIsSubmitting(true); + try { + await client.agents.members.grant({ + agent_id: agentId, + user_id: selectedUserId, + permission, + }); + + // Reset form and close + setSelectedUserId(null); + setPermission("read"); + onSuccess(); + onClose(); + } catch (err) { + setError(err instanceof Error ? err.message : "Failed to add member"); + } finally { + setIsSubmitting(false); + } + }; + + const handleClose = () => { + if (!isSubmitting) { + setSelectedUserId(null); + setPermission("read"); + setError(null); + onClose(); + } + }; + + const selectedPermission = PERMISSIONS.find((p) => p.value === permission); + + return ( + + + + Add Member + + Grant a specific member access to this agent + + + +
+ {error && ( +
+

{error}

+
+ )} + +
+ + +
+ +
+ + + + + + + {PERMISSIONS.map((perm) => ( + setPermission(perm.value)} + className="cursor-pointer" + > +
+ {perm.label} + + {perm.description} + +
+
+ ))} +
+
+
+ +
+ + +
+
+
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/access/agent-access-client.tsx b/packages/site/app/(app)/[organization]/[agent]/access/agent-access-client.tsx new file mode 100644 index 0000000..253b4f3 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/access/agent-access-client.tsx @@ -0,0 +1,142 @@ +"use client"; + +import { PageContainer, PageHeader } from "@/components/page-header"; +import { Button } from "@/components/ui/button"; +import Client from "@blink.so/api"; +import { UserPlus } from "lucide-react"; +import { useMemo, useState } from "react"; +import useSWR from "swr"; +import { AddMemberModal } from "./add-member-modal"; +import { MembersTable } from "./members-table"; +import { PermissionsReference } from "./permissions-reference"; +import { VisibilitySection } from "./visibility-section"; + +interface AgentAccessClientProps { + agentId: string; + organizationId: string; + agentVisibility: "private" | "public" | "organization"; + currentUserId: string; + organizationName: string; +} + +export function AgentAccessClient({ + agentId, + organizationId, + agentVisibility, + currentUserId, + organizationName, +}: AgentAccessClientProps) { + const [isAddingMember, setIsAddingMember] = useState(false); + const client = useMemo(() => new Client(), []); + + const { data: members, mutate: mutateMembers } = useSWR( + ["agent-members", agentId], + async () => { + const response = await client.agents.members.list({ + agent_id: agentId, + }); + return response.items; + } + ); + + const { data: orgMembers } = useSWR( + ["organization-members", organizationId], + async () => { + const response = await client.organizations.members.list({ + organization_id: organizationId, + }); + return response.items; + } + ); + + const handleDelete = async (userId: string | null) => { + await client.agents.members.revoke({ + agent_id: agentId, + user_id: userId, + }); + mutateMembers(); + }; + + const handleUpdatePermission = async ( + userId: string | null, + permission: "read" | "write" | "admin" + ) => { + await client.agents.members.grant({ + agent_id: agentId, + user_id: userId, + permission, + }); + mutateMembers(); + }; + + // Get organization admins and owners - they have implicit admin access + const orgAdminsAndOwners = + orgMembers?.filter((m) => m.role === "owner" || m.role === "admin") || []; + + const orgAdminsAndOwnersIds = new Set( + orgAdminsAndOwners.map((m) => m.user.id) + ); + + // Filter out org admins and owners from the member list since they always have access + const explicitMembers = (members || []).filter( + (member) => !member.user_id || !orgAdminsAndOwnersIds.has(member.user_id) + ); + + // Total count includes both explicit and implicit members + const totalMembersCount = explicitMembers.length + orgAdminsAndOwners.length; + + return ( + + + +
+ + + + +
+
+
+

Members

+

+ {totalMembersCount}{" "} + {totalMembersCount === 1 ? "member has" : "members have"} access + to this agent +

+
+ +
+ + +
+ + setIsAddingMember(false)} + onSuccess={() => { + mutateMembers(); + }} + /> +
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/access/members-table.tsx b/packages/site/app/(app)/[organization]/[agent]/access/members-table.tsx new file mode 100644 index 0000000..d93a7d2 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/access/members-table.tsx @@ -0,0 +1,240 @@ +"use client"; + +import Avatar from "@/components/ui/avatar"; +import type { AgentMember, OrganizationMember } from "@blink.so/api"; +import { Shield } from "lucide-react"; +import { useState } from "react"; + +interface MembersTableProps { + explicitMembers: AgentMember[]; + implicitMembers: OrganizationMember[]; + currentUserId: string; + onDelete: (userId: string | null) => void; + onUpdatePermission: ( + userId: string | null, + permission: "read" | "write" | "admin" + ) => void; +} + +export function MembersTable({ + explicitMembers, + implicitMembers, + currentUserId, + onDelete, + onUpdatePermission, +}: MembersTableProps) { + const totalCount = explicitMembers.length + implicitMembers.length; + + return ( +
+
+ + + + + + + + + + + {/* Implicit members (org owners and admins) */} + {implicitMembers.map((orgMember) => ( + + ))} + {/* Explicit members */} + {explicitMembers.map((member) => ( + + ))} + +
+ Member + + Permission + + Source + + Actions +
+ {totalCount === 0 && ( +
+ No members have been granted explicit access to this agent. +
+ )} +
+
+ ); +} + +// Implicit member row for org owners/admins +function ImplicitMemberRow({ orgMember }: { orgMember: OrganizationMember }) { + const displayName = + orgMember.user.display_name || orgMember.user.username || "Unknown"; + + return ( + + +
+ +
+
+ {displayName} +
+
+ @{orgMember.user.username} +
+
+
+ + + + Admin + + + +
+ + {orgMember.role} +
+ + + + — + + + + ); +} + +// Explicit member row for directly granted permissions +function ExplicitMemberRow({ + member, + currentUserId, + onDelete, + onUpdatePermission, +}: { + member: AgentMember; + currentUserId: string; + onDelete: (userId: string | null) => void; + onUpdatePermission: ( + userId: string | null, + permission: "read" | "write" | "admin" + ) => void; +}) { + const [isEditing, setIsEditing] = useState(false); + + const displayName = member.user + ? member.user.display_name || member.user.username + : "Organization Default"; + + return ( + + +
+ {member.user ? ( + + ) : ( +
+ + ORG + +
+ )} +
+
+ {displayName} +
+ {member.user && ( +
+ @{member.user.username} +
+ )} +
+
+ + + {isEditing ? ( + + ) : ( + + )} + + + + Direct + + + + + + + ); +} + +function formatPermission(permission: string): string { + return permission.charAt(0).toUpperCase() + permission.slice(1); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/access/page.tsx b/packages/site/app/(app)/[organization]/[agent]/access/page.tsx new file mode 100644 index 0000000..fab8298 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/access/page.tsx @@ -0,0 +1,65 @@ +import { auth } from "@/app/(auth)/auth"; +import { getQuerier } from "@/lib/database"; +import type { Metadata } from "next"; +import { notFound, redirect } from "next/navigation"; +import { getAgent, getOrganization } from "../../layout"; +import { AgentAccessClient } from "./agent-access-client"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string }>; +}): Promise { + const session = await auth(); + const { organization, agent } = await props.params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const [org, ag] = await Promise.all([ + getOrganization(session.user.id, organization), + getAgent(organization, agent), + ]); + return { title: `Access · ${ag.name} · ${org.name} - Blink` }; +} + +export default async function AccessPage({ + params, +}: { + params: Promise<{ organization: string; agent: string }>; +}) { + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + + const { organization: organizationName, agent: agentName } = await params; + const [organization, agent] = await Promise.all([ + getOrganization(session.user.id, organizationName), + getAgent(organizationName, agentName), + ]); + + // Check organization kind from database + const db = await getQuerier(); + const dbOrg = await db.selectOrganizationForUser({ + organizationName, + userID: session.user.id, + }); + + // Access management is not available for personal organizations + if (dbOrg?.kind === "personal") { + return notFound(); + } + + // Check if user has admin permission for this agent + if (!agent.user_permission || agent.user_permission !== "admin") { + return notFound(); + } + + return ( + + ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/access/permissions-reference.tsx b/packages/site/app/(app)/[organization]/[agent]/access/permissions-reference.tsx new file mode 100644 index 0000000..0a8d28f --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/access/permissions-reference.tsx @@ -0,0 +1,178 @@ +"use client"; + +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Check, X } from "lucide-react"; + +const PERMISSION_FEATURES = [ + { + category: "Using the agent", + features: [ + { name: "Create and use chats", read: true, write: true, admin: true }, + { name: "View own chat history", read: true, write: true, admin: true }, + { name: "View all chats", read: false, write: true, admin: true }, + ], + }, + { + category: "Development & debugging", + features: [ + { + name: "View source code", + read: true, + write: true, + admin: true, + }, + { + name: "Create deployments", + read: false, + write: true, + admin: true, + }, + { name: "View logs & traces", read: false, write: true, admin: true }, + { + name: "Manage environment variables", + read: false, + write: true, + admin: true, + }, + { name: "View usage analytics", read: true, write: true, admin: true }, + ], + }, + { + category: "Management", + features: [ + { + name: "Change agent settings", + read: false, + write: false, + admin: true, + }, + { + name: "Manage member access", + read: false, + write: false, + admin: true, + }, + { name: "Delete agent", read: false, write: false, admin: true }, + ], + }, +]; + +function PermissionIcon({ allowed }: { allowed: boolean }) { + if (allowed) { + return ( +
+ +
+ ); + } + return ( +
+ +
+ ); +} + +export function PermissionsReference() { + return ( + + + Permission levels +

+ Understand what each permission level allows +

+
+ +
+

+ Note: Organization admins and owners automatically + have admin permission on all agents in this organization. +

+
+
+ {/* Permission headers */} +
+
+ Feature +
+
Read
+
Write
+
Admin
+
+ + {/* Permission categories */} + {PERMISSION_FEATURES.map((category, categoryIndex) => ( +
+

+ {category.category} +

+
+ {category.features.map((feature, featureIndex) => ( +
+
+ {feature.name} +
+
+ +
+
+ +
+
+ +
+
+ ))} +
+
+ ))} + + {/* Summary section */} +
+
+
+ + R + +
+
+

Read

+

+ Perfect for team members who need to use the agent +

+
+
+
+
+ + W + +
+
+

Write

+

+ For developers who build and debug agents +

+
+
+
+
+ + A + +
+
+

Admin

+

+ Full control for managing the agent and its access +

+
+
+
+
+
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/access/visibility-section.tsx b/packages/site/app/(app)/[organization]/[agent]/access/visibility-section.tsx new file mode 100644 index 0000000..70b1cec --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/access/visibility-section.tsx @@ -0,0 +1,184 @@ +"use client"; + +import Client from "@blink.so/api"; +import { useRouter } from "next/navigation"; +import { useMemo, useState } from "react"; + +export function VisibilitySection({ + agentId, + currentVisibility, + organizationName, +}: { + agentId: string; + currentVisibility: "private" | "public" | "organization"; + organizationName: string; +}) { + const [isEditing, setIsEditing] = useState(false); + const [localVisibility, setLocalVisibility] = useState(currentVisibility); + const client = useMemo(() => new Client(), []); + const router = useRouter(); + + const updateVisibility = async ( + visibility: "private" | "public" | "organization" + ) => { + setLocalVisibility(visibility); + await client.agents.update({ + id: agentId, + visibility, + }); + setIsEditing(false); + router.refresh(); + }; + + return ( +
+
+

+ Access Scope +

+

+ Control who can discover and access this agent. +

+
+ + {!isEditing ? ( +
+
+
+ {localVisibility === "private" ? ( + + + + ) : localVisibility === "organization" ? ( + + + + ) : ( + + + + )} +
+

+ {localVisibility === "private" + ? "Restricted" + : localVisibility === "organization" + ? "Team" + : "Public"} +

+

+ {localVisibility === "private" + ? `Only members with explicit permissions can access` + : localVisibility === "organization" + ? `All members of ${organizationName} can discover and access` + : `Anyone with the link can access`} +

+
+
+ +
+
+ ) : ( +
+ + + + +
+ )} +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/chats/[[...id]]/page.tsx b/packages/site/app/(app)/[organization]/[agent]/chats/[[...id]]/page.tsx new file mode 100644 index 0000000..f67963f --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/chats/[[...id]]/page.tsx @@ -0,0 +1,75 @@ +import { auth } from "@/app/(auth)/auth"; +import Chat from "@/components/chat"; +import ChatSidebar from "@/components/chat-sidebar"; +import { getQuerier } from "@/lib/database"; +import { slugToUuid } from "@/lib/utils"; +import * as convert from "@blink.so/database/convert"; +import type { Metadata } from "next"; +import { notFound, redirect } from "next/navigation"; +import { getAgent, getOrganization, getUser } from "../../../layout"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string; id?: string[] }>; +}): Promise { + const session = await auth(); + const params = await props.params; + const { organization, agent } = params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const [org, ag] = await Promise.all([ + getOrganization(session.user.id, organization), + getAgent(organization, agent), + ]); + const chatSlug = params.id && params.id.length > 0 ? params.id[0] : undefined; + let chatTitle: string | undefined; + if (chatSlug) { + const db = await getQuerier(); + const chat = await db.selectChatByID({ id: slugToUuid(chatSlug) }); + chatTitle = chat?.title ?? undefined; + } + const prefix = chatTitle ? `${chatTitle} - ` : ""; + return { title: `${prefix}${ag.name} - Blink` }; +} + +export default async function ChatsPage({ + params: paramsPromise, +}: { + params: Promise<{ organization: string; agent: string; id?: string[] }>; +}) { + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + const params = await paramsPromise; + const userID = session.user.id; + const id = + params.id && params.id.length > 0 ? slugToUuid(params.id[0]) : undefined; + const [organization, agent, user] = await Promise.all([ + getOrganization(userID, params.organization), + getAgent(params.organization, params.agent), + getUser(userID), + ]); + const db = await getQuerier(); + const chat = id ? await db.selectChatByID({ id }) : null; + if (id && !chat) { + notFound(); + } + + return ( +
+ + +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/components/agent-daily-chats.tsx b/packages/site/app/(app)/[organization]/[agent]/components/agent-daily-chats.tsx new file mode 100644 index 0000000..b25e55e --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/agent-daily-chats.tsx @@ -0,0 +1,75 @@ +"use client"; + +import { AreaChart } from "@/components/ui/area-chart"; +import { MessageCircle } from "lucide-react"; +import { useMemo, useState } from "react"; + +type AgentDailyChat = { + interval: string; + unique_chats: number; +}; + +export default function AgentDailyChats({ data }: { data: AgentDailyChat[] }) { + const [hoveredValue, setHoveredValue] = useState< + | { + interval: string; + unique_chats: number; + } + | undefined + >(undefined); + + const displayValue = useMemo(() => { + if (hoveredValue === undefined) { + return data[data.length - 1]?.unique_chats ?? 0; + } + return hoveredValue.unique_chats; + }, [hoveredValue, data]); + + const displayText = useMemo(() => { + if (hoveredValue === undefined) { + return "Daily Chats"; + } + return new Date(hoveredValue.interval).toLocaleDateString("en-US", { + month: "short", + day: "numeric", + weekday: "long", + }); + }, [hoveredValue]); + + return ( +
+
+ + {displayText} +
+
+
+ {displayValue} +
+ { + if (!value.payload[0]) { + setHoveredValue(undefined); + return; + } + setHoveredValue({ + interval: value.payload[0]?.index, + unique_chats: value.payload[0]?.value, + }); + return null; + }} + /> +
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/components/agent-logs.stories.tsx b/packages/site/app/(app)/[organization]/[agent]/components/agent-logs.stories.tsx new file mode 100644 index 0000000..0b11a58 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/agent-logs.stories.tsx @@ -0,0 +1,618 @@ +import { withFetch } from "@/.storybook/utils"; +import type { Meta, StoryObj } from "@storybook/react"; +import { AgentLogs, type AgentLogsProps } from "./agent-logs"; + +const meta: Meta = { + title: "Components/AgentLogs", + component: (props: AgentLogsProps) => ( +
+ +
+ ), + parameters: { + layout: "fullscreen", + }, + args: { + agentId: "test-agent-123", + organizationId: "test-org-456", + agentName: "Test Agent", + }, +}; + +export default meta; +type Story = StoryObj; + +// Mock data for different log scenarios +const mockLogsData = [ + { + timestamp: new Date(Date.now() - 1000 * 60 * 5), + message: "Agent started successfully", + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 5), + message: JSON.stringify({ + message: { + someField: "Nested message", + }, + }), + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 8), + message: JSON.stringify({ + event: "user_request", + message: "Processing user request to create React component", + request_id: "req_12345", + trace_id: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6", + span_id: "span1234567890ab", + user: { + id: "user_789", + profile: { + name: "John Doe", + email: "john@example.com", + }, + }, + action: "create_component", + metadata: { + type: "React", + framework: "Next.js", + }, + }), + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 10), + message: "Processing user request: Create a new React component", + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 12), + message: JSON.stringify({ + level: "warning", + service: "api_gateway", + metrics: { + rate_limit: { + current: 800, + max: 1000, + percentage: 80, + }, + requests: [ + { endpoint: "/api/chat", count: 450 }, + { endpoint: "/api/logs", count: 350 }, + ], + }, + timestamp: "2024-01-15T10:30:00Z", + }), + level: "warn" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 15), + message: "Warning: API rate limit approaching (80% capacity)", + level: "warn" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 18), + message: JSON.stringify({ + message: "Database connection failed after 3 retries", + error: "database_connection_failed", + trace_id: "trace_abc123def456", + span_id: "span_error_db001", + correlation: { + trace_id: "trace_abc123", + agents: [ + { + id: "agent_001", + deployment: { + id: "deploy_xyz789", + version: "1.2.3", + region: "us-east-1", + }, + }, + { + id: "agent_002", + deployment: { + id: "deploy_def456", + version: "1.2.2", + region: "us-west-2", + }, + }, + ], + }, + details: { + timeout_ms: 5000, + retry_count: 3, + last_error: "Connection refused", + }, + }), + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 20), + message: "Failed to connect to database: Connection timeout after 5000ms", + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 25), + message: "Successfully generated code completion for user request", + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 28), + message: JSON.stringify({ + message: "Search completed for 'React components' - found 15 files", + event: "search_completed", + query: "React components", + trace_id: "search_trace_xyz789", + results: { + total_files: 15, + matches: [ + { file: "src/components/Button.tsx", score: 0.95 }, + { file: "src/components/Modal.tsx", score: 0.87 }, + { file: "src/components/Form.tsx", score: 0.76 }, + ], + execution_time_ms: 234, + }, + }), + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 30), + message: "Codebase search completed: Found 15 matching files", + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 35), + message: "Error parsing user input: Invalid JSON syntax at line 12", + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 40), + message: "Agent initialized with configuration: model=claude-3-5-sonnet", + level: "info" as const, + }, +]; + +const searchResultsData = [ + { + timestamp: new Date(Date.now() - 1000 * 60 * 5), + message: "Failed to connect to database: Connection timeout after 5000ms", + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 10), + message: JSON.stringify({ + error: "database_error", + trace_id: "db_error_trace_001", + span_id: "db_span_001", + query: "SELECT * FROM logs WHERE agent_id = ?", + parameters: ["agent_123"], + connection: { + host: "localhost", + port: 5432, + database: "blink_logs", + ssl: false, + }, + stack_trace: [ + "at DatabaseConnection.execute (db.js:45)", + "at LogService.fetchLogs (logs.js:123)", + "at AgentLogsController.getLogs (controller.js:67)", + ], + }), + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 35), + message: "Error parsing user input: Invalid JSON syntax at line 12", + level: "error" as const, + }, +]; + +export const Default: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + return new Response( + JSON.stringify({ + logs: mockLogsData, + }), + { + status: 200, + headers: { "Content-Type": "application/json" }, + } + ); + } + return undefined; + }), + ], +}; + +export const Loading: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + return new Promise(() => {}); // Never resolves, simulates loading state + } + return undefined; + }), + ], +}; + +export const Error: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + return new Response("{}", { + status: 500, + statusText: "Internal Server Error", + headers: { "Content-Type": "application/json" }, + }); + } + return undefined; + }), + ], +}; + +export const NetworkError: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + return new Response("", { + status: 500, + statusText: "Network error: Unable to reach server", + headers: { "Content-Type": "application/json" }, + }); + } + return undefined; + }), + ], +}; + +export const EmptyLogs: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + return new Response( + JSON.stringify({ + logs: [], + }), + { + status: 200, + headers: { "Content-Type": "application/json" }, + } + ); + } + return undefined; + }), + ], +}; + +export const WithSearchResults: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + return new Response( + JSON.stringify({ + logs: searchResultsData, + }), + { + status: 200, + headers: { "Content-Type": "application/json" }, + } + ); + } + return undefined; + }), + ], +}; + +export const LargeDataset: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + // Mock fetch to return many log entries + const largeMockData = Array.from({ length: 100 }, (_, i) => { + let level: "error" | "warn" | "info"; + if (i % 10 === 0) { + level = "error"; + } else if (i % 5 === 0) { + level = "warn"; + } else { + level = "info"; + } + + return { + timestamp: new Date(Date.now() - 1000 * 60 * i), + message: `Log entry ${i + 1}: ${ + i % 10 === 0 + ? "Critical system event occurred" + : i % 5 === 0 + ? "Warning: Performance degradation detected" + : `Regular operation completed successfully (batch ${Math.floor(i / 10) + 1})` + }`, + level, + }; + }); + + return new Response( + JSON.stringify({ + logs: largeMockData, + }), + { + status: 200, + headers: { "Content-Type": "application/json" }, + } + ); + } + return undefined; + }), + ], +}; + +export const OnlyErrors: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + const errorOnlyData = [ + { + timestamp: new Date(Date.now() - 1000 * 60 * 5), + message: + "Database connection failed: Cannot connect to postgres://localhost:5432", + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 8), + message: JSON.stringify({ + error: "api_timeout", + trace_id: "api_timeout_trace_456", + span_id: "timeout_span_002", + request: { + method: "POST", + url: "/api/chat", + headers: { + "Content-Type": "application/json", + Authorization: "Bearer ***", + }, + body_size_bytes: 1024, + }, + timeout: { + configured_ms: 30000, + actual_ms: 30001, + }, + retries: { + attempted: 3, + max: 3, + }, + }), + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 10), + message: + "API request timeout: Request to /api/chat took more than 30s", + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 15), + message: + "File upload failed: Maximum file size exceeded (10MB limit)", + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 18), + message: JSON.stringify({ + error: "authentication_failed", + token: { + type: "JWT", + issued_at: "2024-01-15T09:30:00Z", + expires_at: "2024-01-15T10:30:00Z", + issuer: "auth.blink.so", + }, + validation: { + signature_valid: false, + claims_valid: true, + expired: false, + }, + client: { + ip: "192.168.1.100", + user_agent: "Mozilla/5.0...", + session_id: "sess_abc123", + }, + }), + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 20), + message: "Authentication error: Invalid JWT token signature", + level: "error" as const, + }, + ]; + + return new Response( + JSON.stringify({ + logs: errorOnlyData, + }), + { + status: 200, + headers: { "Content-Type": "application/json" }, + } + ); + } + return undefined; + }), + ], +}; + +export const MixedLevels: Story = { + decorators: [ + withFetch((url) => { + if ( + url.pathname.includes("/api/agents/") && + url.pathname.endsWith("/logs") + ) { + const mixedLevelData = [ + { + timestamp: new Date(Date.now() - 1000 * 60 * 2), + message: + "User session created: user_id=12345, session_duration=3600s", + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 3), + message: JSON.stringify({ + event: "session_created", + trace_id: "session_trace_789xyz", + user: { + id: "12345", + email: "user@example.com", + preferences: { + theme: "dark", + notifications: true, + language: "en", + }, + }, + session: { + id: "sess_xyz789", + duration_s: 3600, + created_at: "2024-01-15T10:00:00Z", + }, + }), + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 4), + message: + "Cache miss: Rebuilding index for search query 'react components'", + level: "warn" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 4.5), + message: JSON.stringify({ + message: "Cache miss detected for search query", + event: "cache_miss", + query: "react components", + cache: { + hit_rate: 0.78, + size_mb: 245, + evictions: 12, + }, + rebuild: { + started_at: "2024-01-15T10:05:00Z", + estimated_duration_s: 30, + affected_queries: [ + "react components", + "vue templates", + "angular directives", + ], + }, + }), + level: "warn" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 5), + message: JSON.stringify({ + event: "cache_statistics", + cache: { + hit_rate: 0.78, + miss_rate: 0.22, + size_mb: 245, + evictions: 12, + entries: 1542, + }, + performance: { + avg_lookup_ms: 2.3, + max_lookup_ms: 45.7, + total_requests: 8934, + }, + }), + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 6), + message: "Code execution completed: exit_code=0, duration=1.2s", + level: "info" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 8), + message: "Memory usage high: 85% of allocated heap used", + level: "warn" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 9), + message: JSON.stringify({ + alert: "health_check_failed", + service: "chat-api", + failures: { + consecutive: 3, + total_today: 7, + threshold: 3, + }, + checks: [ + { + timestamp: "2024-01-15T10:08:00Z", + status: "failed", + response_time_ms: null, + error: "Connection refused", + }, + { + timestamp: "2024-01-15T10:07:30Z", + status: "failed", + response_time_ms: 30000, + error: "Timeout", + }, + { + timestamp: "2024-01-15T10:07:00Z", + status: "failed", + response_time_ms: null, + error: "DNS resolution failed", + }, + ], + }), + level: "error" as const, + }, + { + timestamp: new Date(Date.now() - 1000 * 60 * 10), + message: + "Critical: Service health check failed 3 consecutive times", + level: "error" as const, + }, + ]; + + return new Response( + JSON.stringify({ + logs: mixedLevelData, + }), + { + status: 200, + headers: { "Content-Type": "application/json" }, + } + ); + } + return undefined; + }), + ], +}; diff --git a/packages/site/app/(app)/[organization]/[agent]/components/agent-logs.tsx b/packages/site/app/(app)/[organization]/[agent]/components/agent-logs.tsx new file mode 100644 index 0000000..95098ee --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/agent-logs.tsx @@ -0,0 +1,503 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import type { FieldFilterGroup } from "@blink.so/api"; +import Client from "@blink.so/api"; +import { Activity, AlertCircle, RefreshCw, Search } from "lucide-react"; +import { useCallback, useEffect, useMemo, useState } from "react"; +import { + TraceFiltersContent, + TraceFiltersPanel, +} from "../traces/trace-filters-panel"; +import { + DateRangeFilter, + getDateRangeValues, + type DateRange, +} from "./date-range-filter"; +import { LogDetailsSidebar } from "./log-details-sidebar"; + +const client = new Client(); + +const LOG_FILTER_FIELDS: readonly string[] = []; + +type LogEntry = { + timestamp: Date; + original: string; + message?: string; + level: "info" | "error" | "warn"; +} & ({ type: "text" } | { type: "json"; parsed: unknown }); + +// Function to try parsing a string as JSON +const tryParseJSON = (str: string): { isJSON: boolean; data?: any } => { + try { + const parsed = JSON.parse(str); + // Only consider it JSON if it's an object or array + if (typeof parsed === "object" && parsed !== null) { + return { isJSON: true, data: parsed }; + } + return { isJSON: false }; + } catch { + return { isJSON: false }; + } +}; + +// Helper function to format date in user's timezone with the desired format +const formatTimestamp = (date: Date) => { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, "0"); + const day = String(date.getDate()).padStart(2, "0"); + const hours = String(date.getHours()).padStart(2, "0"); + const minutes = String(date.getMinutes()).padStart(2, "0"); + const seconds = String(date.getSeconds()).padStart(2, "0"); + const milliseconds = String(date.getMilliseconds()).padStart(3, "0"); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`; +}; + +// Helper function to get timezone display +const getTimezoneDisplay = () => { + const now = new Date(); + const offset = -now.getTimezoneOffset(); + const hours = Math.floor(Math.abs(offset) / 60); + const minutes = Math.abs(offset) % 60; + const sign = offset >= 0 ? "+" : "-"; + return `GMT${sign}${hours}${minutes > 0 ? `:${minutes.toString().padStart(2, "0")}` : ""}`; +}; + +const hasTraceDetails = (log: LogEntry): boolean => { + return ( + log.type === "json" && + log.parsed != null && + typeof log.parsed === "object" && + ("trace_id" in log.parsed || "span_id" in log.parsed) + ); +}; + +export interface AgentLogsProps { + agentId: string; + organizationId: string; + agentName: string; + initialFilters?: FieldFilterGroup; + initialStartTime?: Date; + initialEndTime?: Date; + initialSearchQuery?: string; +} + +export function AgentLogs({ + agentId, + organizationId, + agentName, + initialFilters, + initialStartTime, + initialEndTime, + initialSearchQuery, +}: AgentLogsProps) { + const [dateRange, setDateRange] = useState(() => { + if (initialStartTime && initialEndTime) { + return { + from: { + id: "custom", + label: initialStartTime.toLocaleDateString(), + value: initialStartTime, + }, + to: { + id: "custom", + label: initialEndTime.toLocaleDateString(), + value: initialEndTime, + }, + fromCustom: initialStartTime, + toCustom: initialEndTime, + }; + } + return { + from: { + id: "24h", + label: "24 hours ago", + value: new Date(Date.now() - 24 * 60 * 60 * 1000), + }, + to: { + id: "now", + label: "Now", + value: "now", + }, + }; + }); + const [searchQuery, setSearchQuery] = useState(initialSearchQuery || ""); + const [debouncedSearchQuery, setDebouncedSearchQuery] = useState( + initialSearchQuery || "" + ); + const [filters, setFilters] = useState( + initialFilters || { + type: "and", + filters: [], + } + ); + const [filtersExpanded, setFiltersExpanded] = useState(false); + + // Stabilize filters to prevent unnecessary refetches when logically equivalent + const stableFilters = useMemo(() => { + const validFilters = filters.filters.filter( + (f) => f.type === "eq" && f.key !== "" + ); + return { + type: filters.type, + filters: validFilters, + } as FieldFilterGroup; + }, [ + JSON.stringify( + filters.filters.filter((f) => f.type === "eq" && f.key !== "") + ), + ]); + + // Data state + const [logs, setLogs] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + // Sidebar state + const [selectedLog, setSelectedLog] = useState(null); + const [sidebarOpen, setSidebarOpen] = useState(false); + + const handleDateRangeChange = (newDateRange: DateRange) => { + setDateRange(newDateRange); + }; + + const handleSearch = (query: string) => { + setSearchQuery(query); + }; + + const handleFiltersChange = (newFilters: FieldFilterGroup) => { + setFilters(newFilters); + }; + + // Debounce search query to avoid excessive API calls + useEffect(() => { + const timer = setTimeout(() => { + setDebouncedSearchQuery(searchQuery); + }, 500); // 500ms delay + + return () => clearTimeout(timer); + }, [searchQuery]); + + // Fetch logs + const fetchLogs = useCallback(async () => { + if (!organizationId) return; + + setLoading(true); + try { + const { from: fromDate, to: toDate } = getDateRangeValues(dateRange); + + const response = await client.agents.logs.logs({ + agent_id: agentId, + start_time: fromDate, + end_time: toDate, + limit: 500, + message_pattern: debouncedSearchQuery.trim() || undefined, + filters: stableFilters.filters.length > 0 ? stableFilters : undefined, + }); + + const responseData: LogEntry[] = response.logs.map((log) => { + const parseResult = tryParseJSON(log.message); + + if (parseResult.isJSON) { + // Extract message field from JSON if it exists + const jsonMessage = + parseResult.data && + typeof parseResult.data === "object" && + "message" in parseResult.data && + typeof parseResult.data.message === "string" + ? String(parseResult.data.message) + : undefined; + + return { + timestamp: log.timestamp, + original: log.message, + message: jsonMessage, + level: log.level, + type: "json" as const, + parsed: parseResult.data, + }; + } else { + return { + timestamp: log.timestamp, + original: log.message, + message: log.message, + level: log.level, + type: "text" as const, + }; + } + }); + setLogs(responseData); + setError(null); + } catch (err) { + console.error("Error fetching logs:", err); + setError(err instanceof Error ? err.message : "Failed to fetch logs"); + setLogs([]); + } finally { + setLoading(false); + } + }, [organizationId, dateRange, agentId, debouncedSearchQuery, stableFilters]); + + // Load logs when filters change with debounce + useEffect(() => { + const timer = setTimeout(() => { + fetchLogs(); + }, 500); + + return () => clearTimeout(timer); + }, [fetchLogs]); + + const handleReload = () => { + fetchLogs(); + }; + + const handleLogClick = (log: LogEntry) => { + setSelectedLog(log); + setSidebarOpen(true); + }; + + const handleCloseSidebar = () => { + setSidebarOpen(false); + setSelectedLog(null); + }; + + // Agent Logs is a full-screen component - it fills up the entire available space on the page + // but not more. If you change that behavior, you must also update the logs sidebar. Otherwise, + // it will not display correctly when you scroll down a large list of logs. + return ( +
+
+ {/* Filter and Search Row */} +
+
+
+ + handleSearch(e.target.value)} + className="pl-10 h-9 bg-white dark:bg-neutral-900 border-neutral-200 dark:border-neutral-800 focus:border-neutral-400 dark:focus:border-neutral-600 transition-colors" + /> +
+
+ setFiltersExpanded(!filtersExpanded)} + availableFields={LOG_FILTER_FIELDS} + /> + + +
+
+ {filtersExpanded && ( + + )} +
+ + {/* Content */} +
+ {error ? ( +
+
+
+ +
+
+

+ Error Loading Logs +

+

+ {error} +

+
+ +
+
+ ) : loading ? ( +
+
+
+ {/* Table Header */} +
+
+ Time ({getTimezoneDisplay()}) +
+
+ Level +
+
+ Message +
+
+ {/* Skeleton Rows */} + {Array.from({ length: 20 }).map((_, index) => ( +
+
+
+ ))} +
+
+
+ ) : logs.length === 0 ? ( +
+
+
+ +
+
+

+ No Logs Found +

+

+ No logs found for the selected filters. Try adjusting your + date range or search terms. +

+
+
+
+ Current filters: +
+
+ Agent: {agentName} +
+
+ Time:{" "} + + {dateRange.from.id === "custom" && dateRange.fromCustom + ? `${dateRange.fromCustom.toLocaleDateString()} ${dateRange.fromCustom.toLocaleTimeString( + [], + { + hour: "2-digit", + minute: "2-digit", + } + )}` + : dateRange.from.label} + {" "} + to{" "} + + {dateRange.to.id === "custom" && dateRange.toCustom + ? `${dateRange.toCustom.toLocaleDateString()} ${dateRange.toCustom.toLocaleTimeString( + [], + { + hour: "2-digit", + minute: "2-digit", + } + )}` + : dateRange.to.label.toLowerCase()} + +
+ {searchQuery && ( +
+ Search:{" "} + + "{searchQuery}" + +
+ )} +
+
+
+ ) : ( +
+
+
+ {/* Table Header */} +
+
+ Time ({getTimezoneDisplay()}) +
+
+ Level +
+
+ Message +
+
+ {/* Table Body */} + {logs.map((log, index) => ( +
handleLogClick(log)} + > +
+ {formatTimestamp(log.timestamp)} +
+
+ + {log.level.toUpperCase()} + +
+
+ {hasTraceDetails(log) && ( + + )} + + {log.message || log.original} + +
+
+ ))} +
+
+
+ )} +
+
+ + {/* Sidebar */} + +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/components/agent-source.tsx b/packages/site/app/(app)/[organization]/[agent]/components/agent-source.tsx new file mode 100644 index 0000000..5391373 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/agent-source.tsx @@ -0,0 +1,511 @@ +"use client"; + +import type { AgentDeployment } from "@blink.so/api"; +import Client from "@blink.so/api"; +import { AlertCircle, File, Folder, FolderOpen } from "lucide-react"; +import { useTheme } from "next-themes"; +import { usePathname, useSearchParams } from "next/navigation"; +import { useEffect, useMemo, useRef, useState } from "react"; +import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; +import { + vs, + vscDarkPlus, +} from "react-syntax-highlighter/dist/esm/styles/prism"; + +interface FileNode { + name: string; + path: string; + id: string; + type: "file"; +} + +interface DirectoryNode { + name: string; + path: string; + type: "directory"; + children: TreeNode[]; + expanded: boolean; +} + +type TreeNode = FileNode | DirectoryNode; + +// Build a file tree from flat list of files +function buildFileTree(files: Array<{ path: string; id: string }>): TreeNode[] { + const root: DirectoryNode[] = []; + + files.forEach((file) => { + const parts = file.path.split("/").filter(Boolean); + let currentLevel: TreeNode[] = root; + + parts.forEach((part, index) => { + const isFile = index === parts.length - 1; + const currentPath = parts.slice(0, index + 1).join("/"); + + if (isFile) { + currentLevel.push({ + name: part, + path: currentPath, + id: file.id, + type: "file", + }); + } else { + let dir = currentLevel.find( + (node) => node.type === "directory" && node.name === part + ) as DirectoryNode | undefined; + + if (!dir) { + dir = { + name: part, + path: currentPath, + type: "directory", + children: [], + expanded: true, // Expand all by default + }; + currentLevel.push(dir); + } + + currentLevel = dir.children; + } + }); + }); + + return root; +} + +// Get language from file extension +function getLanguageFromExtension(filePath: string): string { + const ext = filePath.split(".").pop()?.toLowerCase(); + + const extensionMap: Record = { + js: "javascript", + jsx: "jsx", + ts: "typescript", + tsx: "tsx", + mjs: "javascript", + cjs: "javascript", + py: "python", + pyw: "python", + pyi: "python", + html: "html", + htm: "html", + css: "css", + scss: "scss", + sass: "sass", + less: "less", + go: "go", + rs: "rust", + c: "c", + cpp: "cpp", + cxx: "cpp", + cc: "cpp", + h: "c", + hpp: "cpp", + java: "java", + kt: "kotlin", + kts: "kotlin", + cs: "csharp", + php: "php", + rb: "ruby", + sh: "bash", + bash: "bash", + zsh: "bash", + fish: "bash", + json: "json", + yaml: "yaml", + yml: "yaml", + toml: "toml", + xml: "xml", + sql: "sql", + md: "markdown", + mdx: "markdown", + dockerfile: "dockerfile", + txt: "text", + log: "text", + }; + + return extensionMap[ext || ""] || "text"; +} + +// Find default file to select +function findDefaultFile( + files: Array<{ path: string; id: string }> +): { path: string; id: string } | null { + // Try README.md first + const readme = files.find((f) => f.path.toLowerCase() === "readme.md"); + if (readme) return readme; + + // Try package.json + const packageJson = files.find( + (f) => f.path.toLowerCase() === "package.json" + ); + if (packageJson) return packageJson; + + // Return first file or null + return files[0] || null; +} + +// Parse file parameter which can include line number (e.g., "path/to/file.ts:42") +function parseFileParam(fileParam: string): { path: string; line?: number } { + const match = fileParam.match(/^(.+?)(?::(\d+))?$/); + if (!match) return { path: fileParam }; + + const [, path, lineStr] = match; + const line = lineStr ? parseInt(lineStr, 10) : undefined; + return { path, line }; +} + +interface FileTreeItemProps { + node: TreeNode; + level: number; + selectedPath: string | null; + onSelect: (node: FileNode) => void; + onToggle: (path: string) => void; +} + +function FileTreeItem({ + node, + level, + selectedPath, + onSelect, + onToggle, +}: FileTreeItemProps) { + const isSelected = node.type === "file" && node.path === selectedPath; + + if (node.type === "file") { + return ( + + ); + } + + return ( +
+ + {node.expanded && ( +
+ {node.children.map((child) => ( + + ))} +
+ )} +
+ ); +} + +export default function AgentSource({ + deployment, +}: { + deployment: AgentDeployment; +}) { + const { resolvedTheme } = useTheme(); + const pathname = usePathname(); + const searchParams = useSearchParams(); + const [fileTree, setFileTree] = useState([]); + const [selectedFile, setSelectedFile] = useState(null); + const [selectedLine, setSelectedLine] = useState(null); + const [fileContent, setFileContent] = useState(null); + const [loading, setLoading] = useState(false); + const [showLoading, setShowLoading] = useState(false); + const [error, setError] = useState(null); + const codeContainerRef = useRef(null); + + const client = useMemo(() => new Client(), []); + + // Update URL when file or line changes (using pushState to avoid reload) + const updateURL = (filePath: string, lineNumber?: number | null) => { + const params = new URLSearchParams(searchParams.toString()); + + if (lineNumber) { + params.set("file", `${filePath}:${lineNumber}`); + } else { + params.set("file", filePath); + } + + const newUrl = `${pathname}?${params.toString()}`; + window.history.replaceState({ ...window.history.state }, "", newUrl); + }; + + // Initialize file tree and select file from URL or default + useEffect(() => { + if (!deployment.source_files || deployment.source_files.length === 0) { + setFileTree([]); + setSelectedFile(null); + return; + } + + const tree = buildFileTree(deployment.source_files); + setFileTree(tree); + + // Check URL for file parameter + const fileParam = searchParams.get("file"); + let fileToSelect: { path: string; id: string } | null = null; + let lineToSelect: number | undefined; + + if (fileParam) { + const { path, line } = parseFileParam(fileParam); + fileToSelect = + deployment.source_files.find((f) => f.path === path) || null; + lineToSelect = line; + } + + // Fall back to default file if URL param not found + if (!fileToSelect) { + fileToSelect = findDefaultFile(deployment.source_files); + } + + if (fileToSelect) { + setSelectedFile({ + name: fileToSelect.path.split("/").pop() || fileToSelect.path, + path: fileToSelect.path, + id: fileToSelect.id, + type: "file", + }); + setSelectedLine(lineToSelect || null); + + // Update URL if we're showing a default file and no file param exists + if (!fileParam && fileToSelect) { + updateURL(fileToSelect.path); + } + } + }, [deployment.source_files, searchParams]); + + // Scroll to selected line when content loads + useEffect(() => { + if (selectedLine && fileContent && codeContainerRef.current) { + // Wait for syntax highlighter to render + setTimeout(() => { + const lineElement = codeContainerRef.current?.querySelector( + `[data-line-number="${selectedLine}"]` + ); + if (lineElement) { + lineElement.scrollIntoView({ behavior: "smooth", block: "center" }); + } + }, 100); + } + }, [selectedLine, fileContent]); + + // Delay showing loading state + useEffect(() => { + if (!loading) { + setShowLoading(false); + return; + } + + const timer = setTimeout(() => { + setShowLoading(true); + }, 500); + + return () => clearTimeout(timer); + }, [loading]); + + // Fetch file content when selection changes + useEffect(() => { + if (!selectedFile) { + setFileContent(null); + return; + } + + // Clear content immediately to avoid showing old content with new syntax highlighting + setFileContent(null); + setLoading(true); + setError(null); + + const fetchContent = async () => { + try { + const response = await client.request( + "GET", + `/api/files/${selectedFile.id}` + ); + if (!response.ok) { + throw new Error(`Failed to fetch file: ${response.statusText}`); + } + const text = await response.text(); + setFileContent(text); + } catch (err) { + setError(err instanceof Error ? err.message : "Failed to load file"); + setFileContent(null); + } finally { + setLoading(false); + } + }; + + fetchContent(); + }, [selectedFile, client]); + + const handleToggle = (path: string) => { + const toggleNode = (nodes: TreeNode[]): TreeNode[] => { + return nodes.map((node) => { + if (node.type === "directory") { + if (node.path === path) { + return { ...node, expanded: !node.expanded }; + } + return { ...node, children: toggleNode(node.children) }; + } + return node; + }); + }; + + setFileTree(toggleNode(fileTree)); + }; + + const handleSelectFile = (node: FileNode) => { + setSelectedFile(node); + setSelectedLine(null); + updateURL(node.path); + }; + + const handleLineClick = (lineNumber: number) => { + if (!selectedFile) return; + setSelectedLine(lineNumber); + updateURL(selectedFile.path, lineNumber); + }; + + // Empty state + if (!deployment.source_files || deployment.source_files.length === 0) { + return ( +
+
+ +

No source files available

+
+
+ ); + } + + return ( +
+ {/* File tree sidebar */} +
+
+ {fileTree.map((node) => ( + + ))} +
+
+ + {/* Code viewer */} +
+ {selectedFile && ( + <> + {/* File header */} +
+
+ + + {selectedFile.path} + {selectedLine && ( + + :{selectedLine} + + )} + +
+
+ + {/* File content */} +
+ {showLoading ? ( +
+

Loading...

+
+ ) : error ? ( +
+
+ +

{error}

+
+
+ ) : fileContent !== null ? ( +
+ ({ + cursor: "pointer", + userSelect: "none", + backgroundColor: + selectedLine === lineNumber + ? "rgba(59, 130, 246, 0.1)" + : "transparent", + display: "inline-block", + paddingRight: "1em", + })} + lineProps={(lineNumber) => ({ + style: { + backgroundColor: + selectedLine === lineNumber + ? "rgba(59, 130, 246, 0.1)" + : "transparent", + }, + "data-line-number": lineNumber, + onClick: () => handleLineClick(lineNumber), + })} + > + {fileContent} + +
+ ) : null} +
+ + )} +
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/components/date-range-filter.tsx b/packages/site/app/(app)/[organization]/[agent]/components/date-range-filter.tsx new file mode 100644 index 0000000..dd95c2b --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/date-range-filter.tsx @@ -0,0 +1,282 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Input } from "@/components/ui/input"; +import { cn } from "@/lib/utils"; +import { ArrowRight, Calendar, Check, ChevronDown } from "lucide-react"; +import React, { useState } from "react"; + +export type DateRangeOption = { + id: string; + label: string; + value: Date | "now" | "custom"; +}; + +const FROM_OPTIONS: DateRangeOption[] = [ + { + id: "1h", + label: "1 hour ago", + value: new Date(Date.now() - 60 * 60 * 1000), + }, + { + id: "24h", + label: "24 hours ago", + value: new Date(Date.now() - 24 * 60 * 60 * 1000), + }, + { + id: "7d", + label: "7 days ago", + value: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), + }, + { + id: "custom", + label: "Custom date/time", + value: "custom", + }, +]; + +const TO_OPTIONS: DateRangeOption[] = [ + { + id: "now", + label: "Now", + value: "now", + }, + { + id: "custom", + label: "Custom date/time", + value: "custom", + }, +]; + +export type DateRange = { + from: DateRangeOption; + fromCustom?: Date; + to: DateRangeOption; + toCustom?: Date; +}; + +interface DateRangeFilterProps { + dateRange: DateRange; + onDateRangeChange: (dateRange: DateRange) => void; +} + +function formatCustomDateTime(date: Date): string { + return date.toISOString().slice(0, 16); // Format for datetime-local input +} + +function parseCustomDateTime(dateTimeString: string): Date { + return new Date(dateTimeString); +} + +function DateRangeDropdown({ + options, + selected, + onSelect, + customValue, + onCustomChange, + label, +}: { + options: DateRangeOption[]; + selected: DateRangeOption; + onSelect: (option: DateRangeOption) => void; + customValue?: Date; + onCustomChange?: (date: Date) => void; + label: string; +}) { + const [isOpen, setIsOpen] = useState(false); + const [customDateTime, setCustomDateTime] = useState( + customValue + ? formatCustomDateTime(customValue) + : formatCustomDateTime(new Date()) + ); + + const handleOptionSelect = (option: DateRangeOption) => { + onSelect(option); + if (option.id !== "custom") { + setIsOpen(false); + } + }; + + const handleCustomDateTimeChange = ( + e: React.ChangeEvent + ) => { + const value = e.target.value; + setCustomDateTime(value); + if (value && onCustomChange) { + onCustomChange(parseCustomDateTime(value)); + } + }; + + const handleCustomApply = () => { + if (customDateTime && onCustomChange) { + onCustomChange(parseCustomDateTime(customDateTime)); + } + setIsOpen(false); + }; + + const displayLabel = (() => { + if (selected.id === "custom") { + if (customValue) { + // Format the custom date for display + return `${customValue.toLocaleDateString()} ${customValue.toLocaleTimeString( + [], + { + hour: "2-digit", + minute: "2-digit", + } + )}`; + } + return "Custom"; + } + return selected.label; + })(); + + return ( + + + + + +
+ {options.map((option) => { + const isSelected = selected.id === option.id; + return ( +
+
handleOptionSelect(option)} + > +
+ {isSelected && } +
+ {option.label} +
+ + {/* Custom datetime input */} + {option.id === "custom" && isSelected && ( +
+
+ + +
+
+ )} +
+ ); + })} +
+
+
+ ); +} + +export function DateRangeFilter({ + dateRange, + onDateRangeChange, +}: DateRangeFilterProps) { + const handleFromChange = (fromOption: DateRangeOption) => { + onDateRangeChange({ + ...dateRange, + from: fromOption, + }); + }; + + const handleFromCustomChange = (customDate: Date) => { + onDateRangeChange({ + ...dateRange, + fromCustom: customDate, + }); + }; + + const handleToChange = (toOption: DateRangeOption) => { + onDateRangeChange({ + ...dateRange, + to: toOption, + }); + }; + + const handleToCustomChange = (customDate: Date) => { + onDateRangeChange({ + ...dateRange, + toCustom: customDate, + }); + }; + + return ( +
+ + + +
+ ); +} + +// Helper function to get the actual date values +export function getDateRangeValues(dateRange: DateRange): { + from: Date; + to: Date; +} { + let fromDate: Date; + let toDate: Date; + + if (dateRange.from.id === "custom" && dateRange.fromCustom) { + fromDate = dateRange.fromCustom; + } else if (dateRange.from.value instanceof Date) { + fromDate = dateRange.from.value; + } else { + fromDate = new Date(Date.now() - 24 * 60 * 60 * 1000); // Default to 24 hours ago + } + + if (dateRange.to.id === "custom" && dateRange.toCustom) { + toDate = dateRange.toCustom; + } else if (dateRange.to.value === "now") { + toDate = new Date(); + } else { + toDate = new Date(); // Default to now + } + + return { from: fromDate, to: toDate }; +} diff --git a/packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.stories.tsx b/packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.stories.tsx new file mode 100644 index 0000000..5f8c21c --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.stories.tsx @@ -0,0 +1,305 @@ +import { Button } from "@/components/ui/button"; +import type { Meta, StoryObj } from "@storybook/react"; +import { useState } from "react"; +import { LogDetailsSidebar } from "./log-details-sidebar"; + +type LogEntry = { + timestamp: Date; + original: string; + message?: string; + level: "info" | "error" | "warn"; +} & ({ type: "text" } | { type: "json"; parsed: unknown }); + +const meta: Meta = { + title: "Components/LogDetailsSidebar", + component: (props) => { + const [isOpen, setIsOpen] = useState(props.isOpen); + + return ( +
+
+ +
+ setIsOpen(false)} + /> +
+ ); + }, + parameters: { + layout: "fullscreen", + nextjs: { + appDirectory: true, + navigation: { + pathname: "/test-org/test-agent/logs", + query: {}, + }, + }, + }, +}; + +export default meta; +type Story = StoryObj; + +const textLog: LogEntry = { + timestamp: new Date("2024-01-15T10:30:00.123Z"), + original: "Failed to connect to database: Connection timeout after 5000ms", + level: "error", + type: "text", +}; + +const jsonLog: LogEntry = { + timestamp: new Date("2024-01-15T10:30:01.456Z"), + original: JSON.stringify({ + message: "Database query completed successfully", + duration_ms: 45, + rows_returned: 1, + query: "SELECT * FROM users WHERE id = $1", + user_id: "user_12345", + }), + level: "info", + type: "json", + parsed: { + message: "Database query completed successfully", + duration_ms: 45, + rows_returned: 1, + query: "SELECT * FROM users WHERE id = $1", + user_id: "user_12345", + }, +}; + +const jsonLogWithTraceInfo: LogEntry = { + timestamp: new Date("2024-01-15T10:30:02.789Z"), + original: JSON.stringify({ + message: "Processing user request", + trace_id: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6", + span_id: "span1234567890ab", + request_id: "req_12345", + user_agent: "Mozilla/5.0", + }), + level: "info", + type: "json", + parsed: { + message: "Processing user request", + trace_id: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6", + span_id: "span1234567890ab", + request_id: "req_12345", + user_agent: "Mozilla/5.0", + }, +}; + +const jsonLogWithOnlyTraceId: LogEntry = { + timestamp: new Date("2024-01-15T10:30:03.012Z"), + original: JSON.stringify({ + message: "Background task started", + trace_id: "trace789xyz123abc456def", + task_type: "cleanup", + }), + level: "info", + type: "json", + parsed: { + message: "Background task started", + trace_id: "trace789xyz123abc456def", + task_type: "cleanup", + }, +}; + +const jsonLogWithOnlySpanId: LogEntry = { + timestamp: new Date("2024-01-15T10:30:04.345Z"), + original: JSON.stringify({ + message: "Cache operation completed", + span_id: "span_cache_001", + cache_key: "user:profile:12345", + hit: true, + }), + level: "info", + type: "json", + parsed: { + message: "Cache operation completed", + span_id: "span_cache_001", + cache_key: "user:profile:12345", + hit: true, + }, +}; + +const complexJsonLog: LogEntry = { + timestamp: new Date("2024-01-15T10:30:05.678Z"), + original: JSON.stringify({ + message: "Request completed with nested details", + level: "info", + request: { + method: "POST", + url: "/api/chat", + headers: { + "Content-Type": "application/json", + Authorization: "Bearer ***", + }, + }, + response: { + status_code: 200, + body_size_bytes: 4096, + }, + metadata: { + user: { + id: "user_789", + profile: { + name: "John Doe", + email: "john@example.com", + }, + }, + timing: { + db_ms: 45, + llm_ms: 1200, + total_ms: 1300, + }, + }, + }), + level: "info", + type: "json", + parsed: { + message: "Request completed with nested details", + level: "info", + request: { + method: "POST", + url: "/api/chat", + headers: { + "Content-Type": "application/json", + Authorization: "Bearer ***", + }, + }, + response: { + status_code: 200, + body_size_bytes: 4096, + }, + metadata: { + user: { + id: "user_789", + profile: { + name: "John Doe", + email: "john@example.com", + }, + }, + timing: { + db_ms: 45, + llm_ms: 1200, + total_ms: 1300, + }, + }, + }, +}; + +const warnLog: LogEntry = { + timestamp: new Date("2024-01-15T10:30:06.901Z"), + original: JSON.stringify({ + message: "API rate limit approaching (80% capacity)", + warning_type: "rate_limit", + current: 800, + max: 1000, + percentage: 80, + }), + level: "warn", + type: "json", + parsed: { + message: "API rate limit approaching (80% capacity)", + warning_type: "rate_limit", + current: 800, + max: 1000, + percentage: 80, + }, +}; + +const errorLog: LogEntry = { + timestamp: new Date("2024-01-15T10:30:07.234Z"), + original: JSON.stringify({ + message: "Request failed with error", + error: "Connection timeout after 5000ms", + error_type: "TimeoutError", + retry_count: 3, + trace_id: "error_trace_123", + span_id: "error_span_001", + }), + level: "error", + type: "json", + parsed: { + message: "Request failed with error", + error: "Connection timeout after 5000ms", + error_type: "TimeoutError", + retry_count: 3, + trace_id: "error_trace_123", + span_id: "error_span_001", + }, +}; + +export const Closed: Story = { + args: { + selectedLog: textLog, + isOpen: false, + }, +}; + +export const TextLog: Story = { + args: { + selectedLog: textLog, + isOpen: true, + }, +}; + +export const JsonLog: Story = { + args: { + selectedLog: jsonLog, + isOpen: true, + }, +}; + +export const JsonLogWithTraceInfo: Story = { + args: { + selectedLog: jsonLogWithTraceInfo, + isOpen: true, + }, +}; + +export const JsonLogWithOnlyTraceId: Story = { + args: { + selectedLog: jsonLogWithOnlyTraceId, + isOpen: true, + }, +}; + +export const JsonLogWithOnlySpanId: Story = { + args: { + selectedLog: jsonLogWithOnlySpanId, + isOpen: true, + }, +}; + +export const ComplexJsonLog: Story = { + args: { + selectedLog: complexJsonLog, + isOpen: true, + }, +}; + +export const WarnLog: Story = { + args: { + selectedLog: warnLog, + isOpen: true, + }, +}; + +export const ErrorLog: Story = { + args: { + selectedLog: errorLog, + isOpen: true, + }, +}; + +export const NoLogSelected: Story = { + args: { + selectedLog: null, + isOpen: true, + }, +}; diff --git a/packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.tsx b/packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.tsx new file mode 100644 index 0000000..bca6dc6 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/components/log-details-sidebar.tsx @@ -0,0 +1,374 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { Activity, Check, Copy, X } from "lucide-react"; +import { useParams, useRouter } from "next/navigation"; +import { useCallback, useEffect, useState } from "react"; +import { toast } from "sonner"; + +type LogEntry = { + timestamp: Date; + original: string; + message?: string; + level: "info" | "error" | "warn"; +} & ({ type: "text" } | { type: "json"; parsed: unknown }); + +interface LogDetailsSidebarProps { + selectedLog: LogEntry | null; + isOpen: boolean; + onClose: () => void; +} + +// Helper function to format date in user's timezone with the desired format +const formatTimestamp = (date: Date) => { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, "0"); + const day = String(date.getDate()).padStart(2, "0"); + const hours = String(date.getHours()).padStart(2, "0"); + const minutes = String(date.getMinutes()).padStart(2, "0"); + const seconds = String(date.getSeconds()).padStart(2, "0"); + const milliseconds = String(date.getMilliseconds()).padStart(3, "0"); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`; +}; + +// Helper function to get timezone display +const getTimezoneDisplay = () => { + const now = new Date(); + const offset = -now.getTimezoneOffset(); + const hours = Math.floor(Math.abs(offset) / 60); + const minutes = Math.abs(offset) % 60; + const sign = offset >= 0 ? "+" : "-"; + return `GMT${sign}${hours}${minutes > 0 ? `:${minutes.toString().padStart(2, "0")}` : ""}`; +}; + +// Function to flatten nested objects into dot notation +const flattenObject = ( + obj: any, + prefix = "", + result: Record = {} +): Record => { + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + const newKey = prefix ? `${prefix}.${key}` : key; + const value = obj[key]; + + if (value === null || value === undefined) { + result[newKey] = value; + } else if (Array.isArray(value)) { + // Handle arrays by indexing each element + value.forEach((item, index) => { + const arrayKey = `${newKey}[${index}]`; + if (typeof item === "object" && item !== null) { + flattenObject(item, arrayKey, result); + } else { + result[arrayKey] = item; + } + }); + } else if (typeof value === "object") { + // Recursively flatten nested objects + flattenObject(value, newKey, result); + } else { + result[newKey] = value; + } + } + } + return result; +}; + +export function LogDetailsSidebar({ + selectedLog, + isOpen, + onClose, +}: LogDetailsSidebarProps) { + const params = useParams(); + const router = useRouter(); + const [sidebarWidth, setSidebarWidth] = useState(600); + const [isResizing, setIsResizing] = useState(false); + const [isCopied, setIsCopied] = useState(false); + + // Use pre-computed JSON data from LogEntry + const isJSONLog = selectedLog?.type === "json"; + const flattenedData = isJSONLog ? flattenObject(selectedLog.parsed) : null; + + // Extract trace_id and span_id if they exist + const traceId = flattenedData?.["trace_id"] as string | undefined; + const spanId = flattenedData?.["span_id"] as string | undefined; + const hasTraceInfo = !!(traceId || spanId); + + const handleMouseDown = useCallback((e: React.MouseEvent) => { + e.preventDefault(); + setIsResizing(true); + }, []); + + const handleMouseMove = useCallback( + (e: MouseEvent) => { + if (!isResizing) return; + + const containerRect = + e.target instanceof Element + ? e.target + .closest(".flex.flex-col.max-h-full") + ?.getBoundingClientRect() + : null; + + if (containerRect) { + const newWidth = containerRect.right - e.clientX; + const minWidth = 280; // Minimum width + const maxWidth = Math.min(800, containerRect.width * 0.8); // Max 80% of container width + setSidebarWidth(Math.max(minWidth, Math.min(maxWidth, newWidth))); + } + }, + [isResizing] + ); + + const handleMouseUp = useCallback(() => { + setIsResizing(false); + }, []); + + useEffect(() => { + if (isResizing) { + document.addEventListener("mousemove", handleMouseMove); + document.addEventListener("mouseup", handleMouseUp); + document.body.style.cursor = "ew-resize"; + document.body.style.userSelect = "none"; + + return () => { + document.removeEventListener("mousemove", handleMouseMove); + document.removeEventListener("mouseup", handleMouseUp); + document.body.style.cursor = ""; + document.body.style.userSelect = ""; + }; + } + }, [isResizing, handleMouseMove, handleMouseUp]); + + const copyToClipboard = useCallback(() => { + if (!selectedLog) return; + + let textToCopy: string; + try { + // Try to parse as JSON and stringify with indent + const parsed = JSON.parse(selectedLog.original); + textToCopy = JSON.stringify(parsed, null, 2); + } catch { + // If parsing fails, just copy the original + textToCopy = selectedLog.original; + } + + navigator.clipboard.writeText(textToCopy).then( + () => { + toast.success("Copied to clipboard"); + setIsCopied(true); + setTimeout(() => setIsCopied(false), 2000); + }, + () => { + toast.error("Failed to copy"); + } + ); + }, [selectedLog]); + + const navigateToTrace = useCallback(() => { + if (!selectedLog || !params.organization || !params.agent) return; + + const filters: { + type: "and"; + filters: Array<{ type: "eq"; key: string; value: string }>; + } = { + type: "and", + filters: [], + }; + + if (traceId) { + filters.filters.push({ + type: "eq", + key: "span.trace_id", + value: traceId, + }); + } + + if (spanId) { + filters.filters.push({ + type: "eq", + key: "span.id", + value: spanId, + }); + } + + // Calculate time range (±15 minutes from log timestamp) + const logTime = selectedLog.timestamp; + const startTime = new Date(logTime.getTime() - 15 * 60 * 1000); + const endTime = new Date(logTime.getTime() + 15 * 60 * 1000); + + // Construct the URL + const url = new URL( + `/${params.organization}/${params.agent}/traces`, + window.location.origin + ); + url.searchParams.set("filters", JSON.stringify(filters)); + url.searchParams.set("start_time", startTime.toISOString()); + url.searchParams.set("end_time", endTime.toISOString()); + + router.push(url.pathname + url.search); + }, [selectedLog, params.organization, params.agent, traceId, spanId, router]); + + if (!isOpen || !selectedLog) { + return null; + } + + return ( +
+ {/* Resize Handle */} +
+
+
+ + {/* Sidebar Header */} +
+
+

+ Log Details +

+ + {hasTraceInfo && ( + + )} +
+ +
+ + {/* Sidebar Content */} +
+
+ {/* Timestamp */} +
+ +
+ + {formatTimestamp(selectedLog.timestamp)} + +
+
+ + {/* Level */} +
+ +
+ + {selectedLog.level.toUpperCase()} + +
+
+ + {/* Message */} +
+ +
+ {isJSONLog && flattenedData ? ( +
+ {(() => { + const entries = Object.entries(flattenedData); + // Move message field to the front if it exists + const messageEntry = entries.find( + ([key]) => key === "message" + ); + const otherEntries = entries.filter( + ([key]) => key !== "message" + ); + const sortedEntries = messageEntry + ? [messageEntry, ...otherEntries] + : entries; + + return sortedEntries.map(([key, value]) => ( +
+
+
+ {key} +
+
+ {value === null ? ( + + null + + ) : value === undefined ? ( + + undefined + + ) : typeof value === "string" ? ( + + "{value}" + + ) : ( + + {String(value)} + + )} +
+
+
+ )); + })()} +
+ ) : ( +
+
+ {selectedLog.original} +
+
+ )} +
+
+
+
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/deployments/[number]/page.tsx b/packages/site/app/(app)/[organization]/[agent]/deployments/[number]/page.tsx new file mode 100644 index 0000000..ef38883 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/deployments/[number]/page.tsx @@ -0,0 +1,53 @@ +import { auth } from "@/app/(auth)/auth"; +import type { Metadata } from "next"; +import { redirect } from "next/navigation"; +import { getAgent, getOrganization } from "../../../layout"; +import DeploymentDetailClient from "./view"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string; number: string }>; +}): Promise { + const session = await auth(); + const { organization, agent, number } = await props.params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const [org, ag] = await Promise.all([ + getOrganization(session.user.id, organization), + getAgent(organization, agent), + ]); + return { title: `Deployment #${number} · ${ag.name} · ${org.name} - Blink` }; +} + +export default async function Page({ + params, +}: { + params: Promise<{ organization: string; agent: string; number: string }>; +}) { + const { + organization: organizationName, + agent: agentName, + number, + } = await params; + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + const [organization, agent] = await Promise.all([ + getOrganization(session.user.id, organizationName), + getAgent(organizationName, agentName), + ]); + + return ( +
+ +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/deployments/[number]/view.tsx b/packages/site/app/(app)/[organization]/[agent]/deployments/[number]/view.tsx new file mode 100644 index 0000000..fb86398 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/deployments/[number]/view.tsx @@ -0,0 +1,328 @@ +"use client"; + +import Avatar from "@/components/ui/avatar"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Skeleton } from "@/components/ui/skeleton"; +import type { + AgentDeployment, + ListAgentRunStepsResponse, + ListAgentRunsResponse, +} from "@blink.so/api"; +import Client from "@blink.so/api"; +import { Activity, AlertCircle, ArrowLeft, MessageSquare } from "lucide-react"; +import Link from "next/link"; +import { useMemo } from "react"; +import useSWR from "swr"; + +const client = new Client(); + +function StatusDot({ status }: { status: string | null | undefined }) { + const s = (status || "").toLowerCase(); + const color = + s === "success" + ? "bg-green-500" + : s === "failed" + ? "bg-red-500" + : s === "deploying" + ? "bg-blue-500" + : "bg-slate-400"; + return ; +} + +function formatTime(value?: string | null) { + if (!value) return "—"; + try { + const d = new Date(value); + return `${d.toLocaleDateString()} ${d.toLocaleTimeString()}`; + } catch { + return value as string; + } +} + +function formatDuration( + createdAt?: string | null, + updatedAt?: string | null, + inProgress?: boolean +): string { + if (!createdAt) return "—"; + const start = new Date(createdAt).getTime(); + const end = inProgress + ? Date.now() + : updatedAt + ? new Date(updatedAt).getTime() + : start; + const ms = Math.max(0, end - start); + const seconds = Math.floor(ms / 1000); + const m = Math.floor(seconds / 60); + const s = seconds % 60; + if (m > 0) return `${m}m ${s}s`; + return `${s}s`; +} + +function CreatedBy({ + organizationId, + userId, +}: { + organizationId: string; + userId: string | null | undefined; +}) { + const { data } = useSWR( + userId ? `org-member-${organizationId}-${userId}` : null, + () => { + if (!userId) return null; + return client.organizations.members.get({ + organization_id: organizationId, + user_id: userId, + }); + } + ); + const user = data?.user; + if (!user) return ; + return ( + + {user.display_name || user.username} + + + ); +} + +export default function DeploymentDetailClient({ + agentId, + agentName, + deploymentNumber, + organizationId, + organizationName, + agentSlug, +}: { + agentId: string; + agentName: string; + deploymentNumber: number; + organizationId: string; + organizationName: string; + agentSlug: string; +}) { + const { data, error, isLoading } = useSWR( + `agent-deployment-${agentId}-${deploymentNumber}`, + () => + client.agents.deployments.get({ + agent_id: agentId, + deployment_number: deploymentNumber, + }), + { refreshInterval: 5000 } + ); + + const { data: runsData } = useSWR( + data?.id ? `agent-deployment-runs-${agentId}-${data.id}` : null, + async (): Promise => { + if (!data?.id) return { items: [], next_cursor: null }; + return client.agents.runs.list({ + agent_id: agentId, + agent_deployment_id: data.id, + limit: 100, + }); + } + ); + + const { data: stepsData } = useSWR( + data?.id ? `agent-deployment-steps-${agentId}-${data.id}` : null, + async (): Promise => { + if (!data?.id) return { items: [], next_cursor: null }; + return client.agents.steps.list({ + agent_id: agentId, + agent_deployment_id: data.id, + limit: 100, + }); + } + ); + + // Build URLs for filtered logs and traces (before early returns to follow Rules of Hooks) + const logsUrl = useMemo(() => { + if (!data?.id) return `/${organizationName}/${agentSlug}/logs`; + const filters = { + type: "and", + filters: [{ type: "eq", key: "agent.deployment_id", value: data.id }], + }; + const params = new URLSearchParams({ + filters: JSON.stringify(filters), + }); + return `/${organizationName}/${agentSlug}/logs?${params.toString()}`; + }, [data?.id, organizationName, agentSlug]); + + const tracesUrl = useMemo(() => { + if (!data?.id) return `/${organizationName}/${agentSlug}/traces`; + const filters = { + type: "and", + filters: [{ type: "eq", key: "agent.deployment_id", value: data.id }], + }; + const params = new URLSearchParams({ + filters: JSON.stringify(filters), + }); + return `/${organizationName}/${agentSlug}/traces?${params.toString()}`; + }, [data?.id, organizationName, agentSlug]); + + if (isLoading) { + return ( +
+ + +
+ ); + } + + if (error || !data) { + return ( +
+ Failed to load deployment +
+ ); + } + + const d: AgentDeployment = data; + const inProgress = ["deploying", "pending"].includes(d.status.toLowerCase()); + + const totalRuns = runsData?.items?.length || 0; + const totalSteps = stepsData?.items?.length || 0; + + return ( +
+
+
+
+ + + +
+

#{d.number}

+ + {d.target} + +
+ + {d.status} +
+
+ + {formatDuration(d.created_at, d.updated_at, inProgress)} + +
+ +
+ + + + + + +
+
+
+ +
+ {/* Stats */} +
+
+
+ + Chat Runs +
+
+ {totalRuns.toLocaleString()} + {totalRuns === 100 && "+"} +
+
+ +
+
+ + Steps +
+
+ {totalSteps.toLocaleString()} + {totalSteps === 100 && "+"} +
+
+ +
+
+ + Status +
+
{d.status}
+
+
+ + {/* Details */} +
+
+
Deployment Info
+
+
+ Created + {formatTime(d.created_at)} +
+
+ Updated + {formatTime(d.updated_at)} +
+
+ Created by + +
+
+
+ +
+
Platform Details
+
+
+ Platform + {d.platform || "—"} +
+
+ Memory + + {d.platform_memory_mb ? `${d.platform_memory_mb} MB` : "—"} + +
+
+ Region + {d.platform_region || "—"} +
+
+
+
+ + {/* User Message */} + {d.user_message && ( +
+
Deployment Message
+
+ {d.user_message} +
+
+ )} +
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/deployments/list.tsx b/packages/site/app/(app)/[organization]/[agent]/deployments/list.tsx new file mode 100644 index 0000000..6f055e8 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/deployments/list.tsx @@ -0,0 +1,442 @@ +"use client"; + +import Avatar from "@/components/ui/avatar"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Skeleton } from "@/components/ui/skeleton"; +import Client from "@blink.so/api"; +import { + MapPin, + MemoryStick, + MessageSquareText, + MoreHorizontal, + RotateCw, + Sparkles, +} from "lucide-react"; +import Link from "next/link"; +import { useState } from "react"; +import useSWR from "swr"; +import useSWRInfinite from "swr/infinite"; + +const client = new Client(); + +function getStatusLabel(status: string | null | undefined): string { + const s = (status || "").toLowerCase(); + if (s === "success") return "Ready"; + if (s === "failed") return "Failed"; + if (s === "deploying") return "Deploying"; + return "Pending"; +} + +function StatusDot({ status }: { status: string | null | undefined }) { + const s = (status || "").toLowerCase(); + const color = + s === "success" + ? "bg-green-500" + : s === "failed" + ? "bg-red-500" + : s === "deploying" + ? "bg-blue-500" + : "bg-slate-400"; + return ( + + ); +} + +function formatDuration( + createdAt?: string | null, + updatedAt?: string | null, + inProgress?: boolean +): string { + if (!createdAt) return "—"; + const start = new Date(createdAt).getTime(); + const end = inProgress + ? Date.now() + : updatedAt + ? new Date(updatedAt).getTime() + : start; + const ms = Math.max(0, end - start); + const seconds = Math.floor(ms / 1000); + const m = Math.floor(seconds / 60); + const s = seconds % 60; + if (m > 0) return `${m}m ${s}s`; + return `${s}s`; +} + +// New: human friendly created-at relative time like "1 hour ago" +function formatTimeAgo(value: string | null | undefined): string { + if (!value) return "—"; + const date = new Date(value); + const now = new Date(); + const diffMs = Math.max(0, now.getTime() - date.getTime()); + const minutes = Math.floor(diffMs / (1000 * 60)); + const hours = Math.floor(minutes / 60); + const days = Math.floor(hours / 24); + + if (minutes < 1) return "now"; + if (minutes < 60) + return `${minutes} ${minutes === 1 ? "minute" : "minutes"} ago`; + if (hours < 24) return `${hours} ${hours === 1 ? "hour" : "hours"} ago`; + if (days < 7) return `${days} ${days === 1 ? "day" : "days"} ago`; + return date.toLocaleDateString(); +} + +function CreatedBy({ + organizationId, + userId, +}: { + organizationId: string; + userId: string; +}) { + const { data } = useSWR( + userId ? `org-member-${organizationId}-${userId}` : null, + () => + client.organizations.members.get({ + organization_id: organizationId, + user_id: userId, + }) + ); + const user = data?.user; + if (!user) return null; + return ( + + by {user.username} + + + ); +} + +export default function DeploymentsList({ + agentId, + organizationId, + activeDeploymentId, + canDeploy = false, +}: { + agentId: string; + organizationId: string; + activeDeploymentId?: string | null; + canDeploy?: boolean; +}) { + const [redeployDialogOpen, setRedeployDialogOpen] = useState(false); + const [selectedDeployment, setSelectedDeployment] = useState(null); + const [isRedeploying, setIsRedeploying] = useState(false); + + const { data, error, isLoading, size, setSize, mutate } = useSWRInfinite( + (index: number, previousPage: any | null) => { + if (!agentId) return null; + if (index === 0) return ["agent-deployments", agentId, 1]; + if (!previousPage || previousPage.has_more === false) return null; + return ["agent-deployments", agentId, index + 1]; + }, + async ([_label, id, page]: [string, string, number]) => { + return client.agents.deployments.list({ + agent_id: id, + per_page: 10, + order: "desc", + page, + }); + }, + { refreshInterval: 5000, persistSize: true } + ); + + // Live active deployment id (polls client-side) + const { data: agentState } = useSWR( + agentId ? `agent-${agentId}` : null, + () => client.agents.get(agentId), + { refreshInterval: 5000 } + ); + const activeDeploymentIdLive = + agentState?.active_deployment_id ?? activeDeploymentId; + + const handleRedeploy = async () => { + if (!selectedDeployment) return; + setIsRedeploying(true); + try { + await client.agents.deployments.redeploy({ + agent_id: agentId, + deployment_id: selectedDeployment.id, + }); + await mutate(); + setRedeployDialogOpen(false); + setSelectedDeployment(null); + } catch (err) { + console.error("Failed to redeploy:", err); + } finally { + setIsRedeploying(false); + } + }; + + if (isLoading) { + return ( +
+
+ {Array.from({ length: 10 }).map((_, i) => ( +
+
+
+ +
+
+ +
+
+
+
+ + +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+ ))} +
+
+ ); + } + + if (error) { + return ( +
+ Failed to load deployments +
+ ); + } + + const pages = data ?? []; + const items = pages.flatMap((p: any) => p.items ?? []); + const hasMore = pages.length > 0 ? pages[pages.length - 1]?.has_more : false; + const isLoadingMore = + isLoading || (size > 0 && typeof pages[size - 1] === "undefined"); + + if (items.length === 0) { + return ( +
+ No deployments yet +
+ ); + } + + return ( + <> +
+
+ {items.map((deployment: any) => { + const inProgress = ["deploying", "pending"].includes( + (deployment.status || "").toLowerCase() + ); + const duration = formatDuration( + deployment.created_at, + deployment.updated_at, + inProgress + ); + const isActive = + activeDeploymentIdLive && + deployment.id === activeDeploymentIdLive; + return ( +
+ + + {/* Left: number with target below */} +
+
+ + #{deployment.number} + +
+
+ {deployment.target} + {isActive && ( + + Active + + )} +
+
+ + {/* Status with duration under */} +
+
+ + + {getStatusLabel(deployment.status)} + +
+
+ {duration}{" "} + + ({formatTimeAgo(deployment.created_at)}) + +
+
+ + {/* Middle: message with icon, then memory and region with icons */} +
+
+ {deployment.user_message ? ( + <> + + + {deployment.user_message} + + + ) : null} +
+
+ {deployment.platform_memory_mb ? ( + + + {deployment.platform_memory_mb} MB + + ) : null} + {deployment.platform_region ? ( + + + {deployment.platform_region} + + ) : null} + {!deployment.platform_memory_mb && + !deployment.platform_region ? ( + + ) : null} +
+
+ +
+ + {formatTimeAgo(deployment.created_at)} + + {deployment.created_by && ( + + + + )} + {canDeploy && ( + + + + + + { + e.stopPropagation(); + setSelectedDeployment(deployment); + setRedeployDialogOpen(true); + }} + > + + Re-deploy + + + + )} +
+
+ ); + })} +
+ + {hasMore ? ( +
+ +
+ ) : null} +
+ + + + + Re-deploy #{selectedDeployment?.number}? + + This will create a new deployment with the same configuration as + deployment #{selectedDeployment?.number}. The new deployment will + use the same files and settings. + + + + + + + + + + ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/deployments/page.tsx b/packages/site/app/(app)/[organization]/[agent]/deployments/page.tsx new file mode 100644 index 0000000..c626349 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/deployments/page.tsx @@ -0,0 +1,55 @@ +import { auth } from "@/app/(auth)/auth"; +import { PageContainer, PageHeader } from "@/components/page-header"; +import type { Metadata } from "next"; +import { redirect } from "next/navigation"; +import { getAgent, getOrganization } from "../../layout"; +import DeploymentsList from "./list"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string }>; +}): Promise { + const session = await auth(); + const { organization, agent } = await props.params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const [org, ag] = await Promise.all([ + getOrganization(session.user.id, organization), + getAgent(organization, agent), + ]); + return { title: `Deployments · ${ag.name} · ${org.name} - Blink` }; +} + +export default async function Page({ + params, +}: { + params: Promise<{ organization: string; agent: string }>; +}) { + const { organization: organizationName, agent: agentName } = await params; + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + const [organization, agent] = await Promise.all([ + getOrganization(session.user.id, organizationName), + getAgent(organizationName, agentName), + ]); + + const permission = agent.user_permission ?? "read"; + const canDeploy = permission === "write" || permission === "admin"; + + return ( + + + + + ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/develop/page.tsx b/packages/site/app/(app)/[organization]/[agent]/develop/page.tsx new file mode 100644 index 0000000..3bd3df2 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/develop/page.tsx @@ -0,0 +1,26 @@ +import { auth } from "@/app/(auth)/auth"; +import type { Metadata } from "next"; +import { getAgent } from "../../layout"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string }>; +}): Promise { + const session = await auth(); + const { organization, agent } = await props.params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const ag = await getAgent(organization, agent); + return { title: `Develop · ${ag.name} · ${organization} - Blink` }; +} + +export default async function Page({ + params, +}: { + params: Promise<{ organization: string; agent: string }>; +}) { + const { organization: organizationName, agent: agentName } = await params; + const agent = await getAgent(organizationName, agentName); + + return
{agent.name}
; +} diff --git a/packages/site/app/(app)/[organization]/[agent]/layout.tsx b/packages/site/app/(app)/[organization]/[agent]/layout.tsx new file mode 100644 index 0000000..2cdad99 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/layout.tsx @@ -0,0 +1,50 @@ +import { auth } from "@/app/(auth)/auth"; +import Header from "@/components/header"; +import { getQuerier } from "@/lib/database"; +import { redirect } from "next/navigation"; +import { getAgent, getOrganization, getUser } from "../layout"; +import { AgentNavigation } from "./navigation"; + +export default async function AgentLayout({ + children, + params, +}: { + children: React.ReactNode; + params: Promise<{ organization: string; agent: string }>; +}) { + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + const { organization: organizationName, agent: agentName } = await params; + const [organization, agent] = await Promise.all([ + getOrganization(session.user.id, organizationName), + getAgent(organizationName, agentName), + ]); + const user = await getUser(session.user.id); + + // Get organization kind from database for navigation + const db = await getQuerier(); + const dbOrg = await db.selectOrganizationForUser({ + organizationName, + userID: session.user.id, + }); + const isPersonalOrg = dbOrg?.kind === "personal"; + + return ( + // many tabs, like logs, traces, and chats, depend on the class name below to + // display their content properly. + // don't remove it without a thorough review of the dependents. +
+
+ +
+ {children} +
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/logs/page.tsx b/packages/site/app/(app)/[organization]/[agent]/logs/page.tsx new file mode 100644 index 0000000..50b4422 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/logs/page.tsx @@ -0,0 +1,94 @@ +import { auth } from "@/app/(auth)/auth"; +import type { Metadata } from "next"; +import { notFound, redirect } from "next/navigation"; +import { getAgent, getOrganization } from "../../layout"; +import { AgentLogs } from "../components/agent-logs"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string }>; +}): Promise { + const session = await auth(); + const { organization, agent } = await props.params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const [org, ag] = await Promise.all([ + getOrganization(session.user.id, organization), + getAgent(organization, agent), + ]); + return { title: `Logs · ${ag.name} · ${org.name} - Blink` }; +} + +export default async function LogsPage({ + params, + searchParams, +}: { + params: Promise<{ organization: string; agent: string }>; + searchParams: Promise<{ [key: string]: string | string[] | undefined }>; +}) { + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + const userID = session.user.id; + const { organization: organizationName, agent: agentName } = await params; + const search = await searchParams; + const [organization, agent] = await Promise.all([ + getOrganization(userID, organizationName), + getAgent(organizationName, agentName), + ]); + + // Check permission - logs require write or admin access + const permission = agent.user_permission ?? "read"; + if (permission !== "write" && permission !== "admin") { + notFound(); + } + + // Parse filters from query params + let initialFilters = undefined; + if (search.filters && typeof search.filters === "string") { + try { + initialFilters = JSON.parse(search.filters); + } catch (error) { + console.error("Failed to parse filters from query params:", error); + } + } + + // Parse start_time and end_time from query params + let initialStartTime = undefined; + let initialEndTime = undefined; + if (search.start_time && typeof search.start_time === "string") { + try { + initialStartTime = new Date(search.start_time); + } catch (error) { + console.error("Failed to parse start_time from query params:", error); + } + } + if (search.end_time && typeof search.end_time === "string") { + try { + initialEndTime = new Date(search.end_time); + } catch (error) { + console.error("Failed to parse end_time from query params:", error); + } + } + + // Parse search query from query params + let initialSearchQuery = undefined; + if (search.q && typeof search.q === "string") { + initialSearchQuery = search.q; + } + + return ( +
+ +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/navigation.tsx b/packages/site/app/(app)/[organization]/[agent]/navigation.tsx new file mode 100644 index 0000000..a62c681 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/navigation.tsx @@ -0,0 +1,106 @@ +"use client"; + +import { Navigation, type NavigationItem } from "@/components/ui/navigation"; +import type { Agent, Organization } from "@blink.so/api"; +import { + Activity, + BarChart2, + Code, + LayoutDashboard, + Logs, + MessageSquare, + Server, + Settings, + Users, +} from "lucide-react"; + +export function AgentNavigation({ + organization, + agent, + isPersonalOrg, +}: { + organization: Organization; + agent: Agent; + isPersonalOrg: boolean; +}) { + const base = `/${organization.name}/${agent.name}`; + const permission = agent.user_permission ?? "read"; + const isAdmin = permission === "admin"; + const isWrite = permission === "write" || permission === "admin"; + + const items: NavigationItem[] = [ + { + value: "overview", + label: "Overview", + href: `${base}`, + icon: LayoutDashboard, + }, + { + value: "deployments", + label: "Deployments", + href: `${base}/deployments`, + icon: Server, + }, + { + value: "chats", + label: "Chats", + href: `${base}/chats`, + icon: MessageSquare, + }, + { + value: "source", + label: "Source", + href: `${base}/source`, + icon: Code, + }, + // Only show logs and traces to write/admin users + ...(isWrite + ? [ + { + value: "logs" as const, + label: "Logs", + href: `${base}/logs`, + icon: Logs, + }, + { + value: "traces" as const, + label: "Traces", + href: `${base}/traces`, + icon: Activity, + }, + ] + : []), + { + value: "usage", + label: "Usage", + href: `${base}/usage`, + icon: BarChart2, + }, + // Only show access to admins in non-personal organizations + ...(isAdmin && !isPersonalOrg + ? [ + { + value: "access" as const, + label: "Access", + href: `${base}/access`, + icon: Users, + disabled: true, + tooltip: "Coming Soon", + }, + ] + : []), + // Only show settings to admins + ...(isAdmin + ? [ + { + value: "settings" as const, + label: "Settings", + href: `${base}/settings`, + icon: Settings, + }, + ] + : []), + ]; + + return ; +} diff --git a/packages/site/app/(app)/[organization]/[agent]/page.stories.tsx b/packages/site/app/(app)/[organization]/[agent]/page.stories.tsx new file mode 100644 index 0000000..4bcf316 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/page.stories.tsx @@ -0,0 +1,87 @@ +import { withFetch } from "@/.storybook/utils"; +import Layout from "@/app/(app)/layout"; +import { getQuerier } from "@/lib/database.mock"; +import type { Meta, StoryObj } from "@storybook/react"; +import { mocked } from "@storybook/test"; +import { SessionProvider } from "next-auth/react"; +import OrganizationLayout from "../layout"; +import AgentLayout from "./layout"; +import AgentPage from "./page"; + +const meta: Meta = { + title: "Page/Agent", + component: AgentPage, + args: { + params: Promise.resolve({ + organization: "coder", + agent: "blonk", + }), + }, + decorators: [ + (Story, { args }) => ( + + + + + + + + + + ), + ], +}; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + beforeEach: async () => { + mocked(getQuerier).mockResolvedValue({ + ...(await getQuerier()), + selectAgentByOrganizationIDAndName: async () => ({ + id: "1", + name: "Blonk", + created_at: new Date(), + updated_at: new Date(), + organization_id: "1", + created_by: "1", + visibility: "private", + description: "Test Agent", + avatar_file_id: null, + webhook_id: "1", + active_deployment_id: null, + chat_expire_ttl: null, + last_deployment_number: 0, + last_run_number: 0, + }), + }); + }, + decorators: [ + withFetch((url) => { + if (!url.pathname.endsWith("/steps")) { + return undefined; + } + + return new Response( + JSON.stringify({ + items: [], + has_more: false, + }), + { + status: 200, + } + ); + }), + ], +}; diff --git a/packages/site/app/(app)/[organization]/[agent]/page.tsx b/packages/site/app/(app)/[organization]/[agent]/page.tsx new file mode 100644 index 0000000..105e826 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/page.tsx @@ -0,0 +1,169 @@ +import { auth } from "@/app/(auth)/auth"; +import Avatar from "@/components/ui/avatar"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { getQuerier } from "@/lib/database"; +import { Clock, Globe, Lock } from "lucide-react"; +import Link from "next/link"; +import { redirect } from "next/navigation"; +import { getAgent, getOrganization } from "../layout"; +import AgentDailyChats from "./components/agent-daily-chats"; +// import AgentReadme from "./components/agent-readme"; +// import RecentSteps from "./recent-steps"; +import AgentPinned from "@/components/agent-pinned"; +import type { Metadata } from "next"; + +export async function generateMetadata(props: { + params: Promise<{ organization: string; agent: string }>; +}): Promise { + const session = await auth(); + const { organization, agent } = await props.params; + if (!session?.user?.id) { + return { title: "Blink" }; + } + const [org, ag] = await Promise.all([ + getOrganization(session.user.id, organization), + getAgent(organization, agent), + ]); + return { title: `${ag.name} · ${org.name} - Blink` }; +} + +function formatTimeAgo(value: string | Date | null | undefined): string { + if (!value) return "—"; + const date = typeof value === "string" ? new Date(value) : value; + const now = new Date(); + const diff = Math.max(0, now.getTime() - date.getTime()); + const mins = Math.floor(diff / 60000); + const hrs = Math.floor(mins / 60); + const days = Math.floor(hrs / 24); + if (mins < 1) return "now"; + if (mins < 60) return `${mins}m ago`; + if (hrs < 24) return `${hrs}h ago`; + if (days < 7) return `${days}d ago`; + return date.toLocaleDateString(); +} + +export default async function Page({ + params, +}: { + params: Promise<{ organization: string; agent: string }>; +}) { + const { organization: organizationName, agent: agentName } = await params; + const db = await getQuerier(); + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + const [organization, agent] = await Promise.all([ + getOrganization(session.user.id, organizationName), + getAgent(organizationName, agentName), + ]); + + const [latestDeployment, stats, creator] = await Promise.all([ + db.selectAgentDeploymentByIDOrActive({ + agentID: agent.id, + }), + db.selectAgentDailyChats({ + agentID: agent.id, + }), + db.selectUserByID(agent.created_by), + ]); + + // const readmeFileID = latestDeployment?.source_files?.find( + // (file) => file.path === "README.md" + // )?.id; + + // const baseURL = process.env.VERCEL_PROJECT_PRODUCTION_URL + // ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` + // : "http://localhost:3000"; + + // let readmeContent: string | undefined; + // if (readmeFileID) { + // const res = await fetch(`${baseURL}/api/files/${readmeFileID}`); + // readmeContent = await res.text(); + // } + + // const defaultReadmeMessage = + // "This agent does not have a README. Add a README to your agent so that users know how to use your agent."; + // if (!readmeContent || readmeContent.trim().length === 0) { + // readmeContent = defaultReadmeMessage; + // } + + return ( +
+
+ {/* Header */} +
+
+ +
+
+

{agent.name}

+ + {agent.visibility === "public" ? ( + + ) : ( + + )} + {agent.visibility} + +
+
+ + Last updated {formatTimeAgo(agent.updated_at)} +
+ {agent.description && ( +

+ {agent.description} +

+ )} +
+
+
+ +
+
+ +
+
+ {/* README section - keeping layout space empty for now */} +
+ +
+
+
+ Get Started +
+ +
+ + + + {creator && ( +
+
+ Collaborators +
+
+ +
+
+ )} +
+
+
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/settings/agent-avatar-form.tsx b/packages/site/app/(app)/[organization]/[agent]/settings/agent-avatar-form.tsx new file mode 100644 index 0000000..74669f9 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/settings/agent-avatar-form.tsx @@ -0,0 +1,142 @@ +"use client"; + +import { TrashIcon } from "@/components/icons"; +import Avatar from "@/components/ui/avatar"; +import { Button } from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { useAPIClient } from "@/lib/api-client"; +import type { Agent } from "@blink.so/api"; +import { useRouter } from "next/navigation"; +import { useCallback, useRef, useTransition } from "react"; +import { toast } from "sonner"; + +interface AgentAvatarFormProps { + agent: Agent; +} + +export function AgentAvatarForm({ agent }: AgentAvatarFormProps) { + const [isPending, startTransition] = useTransition(); + const fileInputRef = useRef(null); + const router = useRouter(); + const client = useAPIClient(); + + const handleImageUpload = useCallback( + async (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (!file) return; + + if (!file.type.startsWith("image/")) { + toast.error("Please select a valid image file."); + return; + } + + try { + const fd = new FormData(); + fd.append("file", file); + const resp = await fetch("/api/files", { + method: "POST", + body: fd, + }); + if (!resp.ok) { + throw new Error("Upload failed"); + } + const json = (await resp.json()) as { id: string }; + const fileId = json.id; + + await client.agents.update({ + id: agent.id, + avatar_file_id: fileId, + }); + + router.refresh(); + toast.success("Avatar updated successfully!"); + } catch (err) { + console.error("Failed to upload avatar:", err); + toast.error("Failed to update avatar"); + } + }, + [router, client, agent.id] + ); + + const handleRemoveAvatar = useCallback(() => { + startTransition(async () => { + try { + await client.agents.update({ + id: agent.id, + avatar_file_id: null, + }); + + router.refresh(); + toast.success("Avatar removed successfully!"); + } catch (e) { + console.error("Failed to remove avatar:", e); + toast.error("Failed to update avatar"); + } + if (fileInputRef.current) { + fileInputRef.current.value = ""; + } + }); + }, [router, client, agent.id]); + + const openFileDialog = useCallback(() => { + fileInputRef.current?.click(); + }, []); + + return ( +
+ +
+ +
+
+ + + {agent.avatar_url && ( + + + + + Remove + + )} +
+
+
+ +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/settings/agent-delete-form.tsx b/packages/site/app/(app)/[organization]/[agent]/settings/agent-delete-form.tsx new file mode 100644 index 0000000..fa8bdfb --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/settings/agent-delete-form.tsx @@ -0,0 +1,99 @@ +"use client"; + +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { useAPIClient } from "@/lib/api-client"; +import { Trash2 } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { toast } from "sonner"; + +interface AgentDeleteFormProps { + agentId: string; + agentName: string; + organizationName: string; +} + +export function AgentDeleteForm({ + agentId, + agentName, + organizationName, +}: AgentDeleteFormProps) { + const [isDeleting, setIsDeleting] = useState(false); + const router = useRouter(); + const client = useAPIClient(); + + const handleDelete = async () => { + setIsDeleting(true); + + try { + await client.agents.delete(agentId); + toast.success("Agent deleted successfully"); + router.push(`/${organizationName}`); + } catch (error) { + const message = + error instanceof Error ? error.message : "Failed to delete agent"; + toast.error(message); + setIsDeleting(false); + } + }; + + return ( + + + Danger Zone + + +
+

+ Deleting an agent is permanent and cannot be undone. This will + remove all associated data, deployments, and configurations. +

+ + + + + + + + Are you absolutely sure? + + This action cannot be undone. This will permanently delete the + agent "{agentName}" and remove all of its data from our + servers. + + + + Cancel + + Delete Agent + + + + +
+
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/settings/env/env-manager.tsx b/packages/site/app/(app)/[organization]/[agent]/settings/env/env-manager.tsx new file mode 100644 index 0000000..e376daf --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/settings/env/env-manager.tsx @@ -0,0 +1,629 @@ +"use client"; + +import Avatar from "@/components/ui/avatar"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Checkbox } from "@/components/ui/checkbox"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import Client from "@blink.so/api"; +import { Code, Lock, MoreHorizontal, Plus } from "lucide-react"; +import { useEffect, useMemo, useState } from "react"; +import { toast } from "sonner"; +import useSWR from "swr"; + +type Target = "preview" | "production"; + +type AgentEnvironmentVariable = { + id: string; + created_at: Date; + updated_at: Date; + created_by: string; + updated_by: string; + key: string; + value: string | null; + secret: boolean; + target: Array<"preview" | "production">; +}; + +export default function EnvManager({ + agentId, + organizationId, +}: { + agentId: string; + organizationId: string; +}) { + const client = useMemo(() => new Client(), []); + const [loading, setLoading] = useState(true); + const [envs, setEnvs] = useState([]); + const [newKey, setNewKey] = useState(""); + const [newValue, setNewValue] = useState(""); + const [newSecret, setNewSecret] = useState(false); + const [newTargets, setNewTargets] = useState([ + "preview", + "production", + ]); + const [saving, setSaving] = useState(false); + + const fetchEnvs = async () => { + try { + const list = await client.agents.env.list({ agent_id: agentId }); + setEnvs(list); + } catch (err) { + toast.error( + err instanceof Error + ? err.message + : "Failed to load environment variables" + ); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchEnvs(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [agentId]); + + const addEnv = async () => { + if (!newKey.trim()) { + toast.error("Key is required"); + return; + } + if (!newSecret && !newValue.trim()) { + toast.error("Value is required for non-secret variables"); + return; + } + if (newTargets.length === 0) { + toast.error("At least one environment is required"); + return; + } + setSaving(true); + try { + await client.agents.env.create({ + agent_id: agentId, + key: newKey.trim(), + value: newValue, + secret: newSecret, + target: newTargets, + }); + setNewKey(""); + setNewValue(""); + setNewSecret(false); + setNewTargets(["preview", "production"]); + await fetchEnvs(); + toast.success("Environment variable created"); + } catch (err) { + toast.error( + err instanceof Error ? err.message : "Failed to create variable" + ); + } finally { + setSaving(false); + } + }; + + const removeEnv = async (env: AgentEnvironmentVariable) => { + try { + await client.agents.env.delete({ agent_id: agentId, id: env.id }); + await fetchEnvs(); + toast.success("Environment variable deleted"); + } catch (err) { + toast.error( + err instanceof Error ? err.message : "Failed to delete variable" + ); + } + }; + + return ( +
+
+

+ Environment variables are encrypted at rest and exposed to your agent + at runtime. Changes to variables require redeployment. +

+
+ + + + Add Variable + + +
+
+ + setNewKey(e.target.value)} + className="font-mono" + autoComplete="off" + autoCorrect="off" + autoCapitalize="off" + spellCheck={false} + data-1p-ignore + data-lpignore="true" + /> +
+
+ + setNewValue(e.target.value)} + className="font-mono" + autoComplete="off" + autoCorrect="off" + autoCapitalize="off" + spellCheck={false} + data-1p-ignore + data-lpignore="true" + /> +
+
+ +
+ +
+
+ { + if (checked) { + setNewTargets([...newTargets, "preview"]); + } else { + setNewTargets(newTargets.filter((t) => t !== "preview")); + } + }} + /> + +
+
+ { + if (checked) { + setNewTargets([...newTargets, "production"]); + } else { + setNewTargets( + newTargets.filter((t) => t !== "production") + ); + } + }} + /> + +
+
+
+ +
+ setNewSecret(checked === true)} + /> + +
+ + +
+
+ +
+ {loading ? ( +
+ Loading environment variables… +
+ ) : envs.length === 0 ? ( +
+ No environment variables yet. Add one above to get started. +
+ ) : ( + envs.map((env) => ( + + )) + )} +
+
+ ); +} + +function EnvRow({ + env, + agentId, + organizationId, + onUpdate, + onDelete, +}: { + env: AgentEnvironmentVariable; + agentId: string; + organizationId: string; + onUpdate: () => Promise; + onDelete: (env: AgentEnvironmentVariable) => Promise; +}) { + const [isEditing, setIsEditing] = useState(false); + const [showDeleteDialog, setShowDeleteDialog] = useState(false); + const [editKey, setEditKey] = useState(env.key); + const [editValue, setEditValue] = useState( + env.secret ? "" : (env.value ?? "") + ); + const [editTargets, setEditTargets] = useState( + env.target as Target[] + ); + const [saving, setSaving] = useState(false); + const client = useMemo(() => new Client(), []); + + const handleSave = async () => { + if (!editKey.trim()) { + toast.error("Variable name is required"); + return; + } + if (!env.secret && !editValue.trim()) { + toast.error("Value is required for non-secret variables"); + return; + } + if (editTargets.length === 0) { + toast.error("At least one environment is required"); + return; + } + + setSaving(true); + try { + await client.agents.env.update({ + agent_id: agentId, + id: env.id, + key: editKey.trim(), + value: env.secret && !editValue ? undefined : editValue, + secret: env.secret, + target: editTargets, + }); + setIsEditing(false); + await onUpdate(); + toast.success("Environment variable updated"); + } catch (err) { + toast.error( + err instanceof Error ? err.message : "Failed to update variable" + ); + } finally { + setSaving(false); + } + }; + + const handleDelete = async () => { + await onDelete(env); + setShowDeleteDialog(false); + }; + + const formatTimeAgo = (date: Date) => { + const now = new Date(); + const diffMs = now.getTime() - new Date(date).getTime(); + const minutes = Math.floor(diffMs / (1000 * 60)); + const hours = Math.floor(minutes / 60); + const days = Math.floor(hours / 24); + + if (minutes < 1) return "just now"; + if (minutes < 60) + return `${minutes} ${minutes === 1 ? "minute" : "minutes"} ago`; + if (hours < 24) return `${hours} ${hours === 1 ? "hour" : "hours"} ago`; + if (days < 7) return `${days} ${days === 1 ? "day" : "days"} ago`; + return new Date(date).toLocaleDateString(); + }; + + const formatEnvironments = (targets: Target[]) => { + if (targets.length === 2) return "Preview and Production"; + if (targets.length === 1) + return targets[0].charAt(0).toUpperCase() + targets[0].slice(1); + return "None"; + }; + + const isUpdated = new Date(env.updated_at) > new Date(env.created_at); + const displayDate = isUpdated ? env.updated_at : env.created_at; + const displayVerb = isUpdated ? "Updated" : "Added"; + const displayUserId = isUpdated ? env.updated_by : env.created_by; + + return ( + <> + + +
+ {/* Icon */} +
+ {env.secret ? ( + + ) : ( + + )} +
+ + {/* Main content */} +
+
+ {env.key} + {env.secret && ( + + Secret + + )} +
+
+ {formatEnvironments(env.target as Target[])} +
+
+ + {/* Value */} +
+ {env.secret ? ( + + Hidden + + ) : ( + + {env.value || "—"} + + )} +
+ + {/* Metadata */} +
+
+ + {displayVerb} {formatTimeAgo(displayDate)} + + +
+ + {/* Actions dropdown */} + + + + + + setIsEditing(!isEditing)}> + Edit + + setShowDeleteDialog(true)} + className="text-destructive focus:text-destructive" + > + Remove + + + +
+
+ + {/* Edit form */} + {isEditing && ( +
+
+
+ + setEditKey(e.target.value)} + className="font-mono" + autoComplete="off" + autoCorrect="off" + autoCapitalize="off" + spellCheck={false} + data-1p-ignore + data-lpignore="true" + /> +
+
+ + setEditValue(e.target.value)} + placeholder={env.secret ? "••••••••" : ""} + className="font-mono" + autoComplete="off" + autoCorrect="off" + autoCapitalize="off" + spellCheck={false} + data-1p-ignore + data-lpignore="true" + /> +
+
+ +
+ +
+
+ { + if (checked) { + setEditTargets([...editTargets, "preview"]); + } else { + setEditTargets( + editTargets.filter((t) => t !== "preview") + ); + } + }} + /> + +
+
+ { + if (checked) { + setEditTargets([...editTargets, "production"]); + } else { + setEditTargets( + editTargets.filter((t) => t !== "production") + ); + } + }} + /> + +
+
+
+ +
+ + +
+
+ )} +
+
+ + {/* Delete confirmation dialog */} + + + + Delete Environment Variable + + Are you sure you want to delete {env.key}? This + action cannot be undone. + + + + + + + + + + ); +} + +function UserAvatar({ + userId, + organizationId, +}: { + userId: string; + organizationId: string; +}) { + const client = useMemo(() => new Client(), []); + const { data } = useSWR( + userId ? `org-member-${organizationId}-${userId}` : null, + () => + client.organizations.members.get({ + organization_id: organizationId, + user_id: userId, + }) + ); + + const user = data?.user; + if (!user) return null; + + return ( + + + +
+ +
+
+ {user.username || user.email} +
+
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/settings/env/page.tsx b/packages/site/app/(app)/[organization]/[agent]/settings/env/page.tsx new file mode 100644 index 0000000..8940ecd --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/settings/env/page.tsx @@ -0,0 +1,33 @@ +import { auth } from "@/app/(auth)/auth"; +import { notFound, redirect } from "next/navigation"; +import { getAgent, getOrganization } from "../../../layout"; +import EnvManager from "./env-manager"; + +export default async function EnvSettingsPage({ + params, +}: { + params: Promise<{ organization: string; agent: string }>; +}) { + const session = await auth(); + if (!session || !session?.user?.id) { + return redirect("/login"); + } + + const { organization: organizationName, agent: agentName } = await params; + const [organization, agent] = await Promise.all([ + getOrganization(session.user.id, organizationName), + getAgent(organizationName, agentName), + ]); + + // Check if user has write or admin permission for this agent + const permission = agent.user_permission ?? "read"; + if (permission !== "write" && permission !== "admin") { + return notFound(); + } + + return ( +
+ +
+ ); +} diff --git a/packages/site/app/(app)/[organization]/[agent]/settings/form.tsx b/packages/site/app/(app)/[organization]/[agent]/settings/form.tsx new file mode 100644 index 0000000..0eecb15 --- /dev/null +++ b/packages/site/app/(app)/[organization]/[agent]/settings/form.tsx @@ -0,0 +1,157 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { useAPIClient } from "@/lib/api-client"; +import type { Agent } from "@blink.so/api"; +import { useRouter } from "next/navigation"; +import { useState, useTransition } from "react"; +import { toast } from "sonner"; +import { AgentAvatarForm } from "./agent-avatar-form"; + +interface AgentSettingsFormProps { + agent: Agent; + organizationName: string; + agentName: string; +} + +export function AgentSettingsForm({ + agent, + organizationName, + agentName, +}: AgentSettingsFormProps) { + const [name, setName] = useState(agent.name); + const [description, setDescription] = useState(agent.description || ""); + // const [chatExpireTtl, setChatExpireTtl] = useState(agent.chat_expire_ttl); + const [isPending, startTransition] = useTransition(); + const router = useRouter(); + const client = useAPIClient(); + + const hasNameChanges = name !== agent.name; + const hasDescriptionChanges = description !== (agent.description || ""); + // const hasRetentionChanges = chatExpireTtl !== agent.chat_expire_ttl; + const hasChanges = hasNameChanges || hasDescriptionChanges; + // hasNameChanges || hasDescriptionChanges || hasRetentionChanges; + + const handleUpdate = async (e: React.FormEvent) => { + e.preventDefault(); + if (!hasChanges) return; + + startTransition(async () => { + try { + await client.agents.update({ + id: agent.id, + name: hasNameChanges ? name : undefined, + description: hasDescriptionChanges ? description : undefined, + // chat_expire_ttl: hasRetentionChanges ? chatExpireTtl : undefined, + }); + + toast.success("Agent updated successfully"); + + // If name changed, redirect to new URL, otherwise just refresh + if (hasNameChanges) { + router.push(`/${organizationName}/${name}/settings`); + } else { + router.refresh(); + } + } catch (error) { + console.error("Failed to update agent:", error); + toast.error( + error instanceof Error ? error.message : "Failed to update agent" + ); + } + }); + }; + + return ( +
+
+
+
+
+ + setName(e.target.value.toLowerCase())} + placeholder="Enter agent name" + maxLength={40} + pattern="[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}" + /> +

+ Lowercase letters, numbers, and hyphens only. Cannot start or + end with a hyphen. +

+
+ +
+ +